Sun Java Solaris Communities My SDN Account Join SDN
 
FAQ

The J2EE 1.4 Tutorial FAQ

 
 

This page attempts to answer the questions that readers most frequently send to the tutorial e-mail alias.

Here's a list of the questions, by category, that are posed and answered in this FAQ:

About the 1.4 Tutorial

What is The J2EE 1.4 Tutorial?

The J2EE 1.4 Tutorial is a programmer's guide for the J2EE platform and Sun Java System Application Server Platform Edition 8.2. This tutorial is intended for programmers interested in developing and deploying J2EE applications on the J2EE 1.4 SDK. The current version is online and documents the J2EE 1.4 SDK.


How does The J2EE 1.4 Tutorial relate to The J2EE Tutorial for the J2EE 1.3 platform?

In addition to web services technologies, The J2EE 1.4 Tutorial also includes new chapters that cover JavaServer Faces and major upgrades (JSP 2.0, EJB 2.1, JMS 1.1, and Connector 1.5) to existing J2EE technologies.


Where can I get The J2EE 1.4 Tutorial?

You can read The J2EE 1.4 Tutorial on-line. Start here. If you prefer to view it on your own system, you can download The J2EE 1.4 Tutorial. The J2EE 1.4 Tutorial is available in HTML and PDF.


What version of the J2EE SDK does The J2EE 1.4 Tutorial reflect?

The J2EE 1.4 Tutorial reflects the J2EE 1.4 SDK that contains the Sun Java System Application Server Platform Edition 8.2.


What platforms does the J2EE SDK support?

For a list of supported platforms, see the Release Notes.


Do The J2EE 1.4 Tutorial examples run on Windows 98?

No. The J2EE 1.4 Tutorial depends on the Sun Java System Application Server Platform Edition 8.2, which is not supported on Windows 98. For a list of supported platforms, see the Release Notes.


What topics are covered by The J2EE 1.4 Tutorial?

Check out the home page for a list of the chapters in The J2EE 1.4 Tutorial.


Where is the source code for the examples?

To get the source code, you need to download The J2EE 1.4 Tutorial bundle, install it, and go to the <INSTALL>/j2eetutorial14/examples directory. You cannot access the source code in the online version of The J2EE 1.4 Tutorial that is available on our public web site.


What is asant?

In The J2EE 1.4 Tutorial chapter About This Tutorial, see the section, "How to Build and Run the Examples."


I have problems compiling the examples using asant.
  • You get the error message:

    BUILD FAILED
    file:C:/j2eetutorial14/examples//common/targets.xml:8: C:\lib not found.
    

    You need to set the j2ee.home property in C:/j2eetutorial14/examples/common/build.properties to the location of your Sun Java System Application Server Platform Edition 8.2 installation. See the About This Tutorial chapter for information about building the examples.

    Note: Beginning with Update 5, the build system checks if j2ee.home is properly set. If not, it outputs an error message with information on how to set j2ee.home.

  • The build.xml seems to be missing:

    % asant converter
    Buildfile: build.xml does not exist!
    Build failed
    

    The build.xml file is in the directory for each technology. Make sure you are in that directory when you run asant. Alternatively, run asant with the flag -f <INSTALL>/j2eetutorial14/examples/<technology>/build.xml.

  • The directory structure for the examples is different than the structure described in the text. As a result, the asant converter command fails to compile the source code.

    The versions of tutorial and the J2EE SDK software do not match. For example, you might be reading The J2EE Tutorial for the J2EE 1.3 SDK but running the J2EE 1.4 SDK software.

  • You get a Syntax Error when running asant on Windows 2000.

    There is a bug in asant.bat that results in a Syntax Error in Windows 2000's command prompt. The line that sets the classpath is too long.

    There is a work-around. Open <J2EE_HOME>/bin/asant.bat (e.g. c:/Sun/AppServer/bin/asant.bat) in a text editor and remove the following lines:

    "-Dcom.sun.aas.instanceName=server"
    "-Djava.endorsed.dirs=%AS_INSTALL%\lib\endorsed"
    			

I'm having a problem running the hello3 example.

The hello3 example exposes a bug with welcome files, bug 6372570. When you run the example as described in the tutorial (http://localhost:8080/hello3/), you will see a list of files in the WAR file rather than the starting page of the application. The workaround is to add a servlet-mapping element to the example's web.xml file, as shown here:

   <servlet>
     <servlet-name>greeting</servlet-name>
     <servlet-class>greeting.jsp</servlet-class>
 </servlet>

 <servlet-mapping>
     <servlet-name>greeting</servlet-name>
     <url-pattern>/greeting/*</url-pattern>
 </servlet-mapping>

If you want to run the example without changing the web.xml file, you can simply run it as described in the tutorial and click on the link to the greeting.jsp page that appears in the list of files included in the WAR file.


Why do I get a javax.naming.NameNotFoundException error when I run the JMS example programs in "A Simple Example of Synchronous Message Receives" in Chapter 33?

You get the following error:

javax.naming.NameNotFoundException: JupiterConnectionFactory not found

because there is an error in each of the following source files:

  • <INSTALL>/j2eetutorial14/examples/jms/simple/src/SimpleProducer.java
  • <INSTALL>/j2eetutorial14/examples/jms/simple/src/SimpleSynchConsumer.java

To correct the error, open each of these source files in an editor and change the string "jms/JupiterConnectionFactory" to "jms/ConnectionFactory". There is one occurrence of this string in each file.

Recompile the programs using the command "asant build". Then, in deploytool, choose Tools->Update Module Files to add the recompiled source files to the SimpleProducer.jar and SimpleSynchConsumer.jar files. Save the changed JAR files, and run the programs again using the appclient command.


Why don't the SAAJ myuddiping example and the JAXR examples work?

These examples don't work because the public UDDI v2 registries no longer exist. You can, however, use the Registry Server, the private UDDI registry that comes with Java WSDP 1.5.

In order to run the JAXR examples, the SAAJ examples, or the Coffee Break example on AS8.2, you need to use the Java WSDP Registry Server, a private UDDI version 2 registry. To obtain this registry, you need to download and install Java WSDP 1.5 and then to install the Registry Server in the Application Server.

To download Java WSDP 1.5, perform these steps:

  1. Go to the following URL:

    http://java.sun.com/webservices/downloads/1.5/index.html

  2. Under Java Web Services Developer Pack v1.5, click Download.
  3. On the Login page, click the Download link. (You do not have to log in.)
  4. Select the Accept radio button to accept the license agreement.
  5. Click the download arrow for your platform (Solaris or Windows).
  6. Choose the directory from which to download Java WSDP.

Install Java WSDP as follows:

  1. Go to the directory where you downloaded Java WSDP 1.5.
  2. Run the Java WSDP installer. You can follow the instructions that are linked to from http://java.sun.com/webservices/downloads/1.5/index.html, although these instructions refer to a newer version of Java WSDP.
  3. On the Select a Web Container page of the installer, select No Web Container.
  4. Choose a directory where you will install Java WSDP.
  5. Select either a Typical or a Custom installation. If you select Custom, remove the check marks from every checkbox you can except Java WSDP Registry Server. (You cannot remove the check marks from JAXB, JAXP, JAXR, or SAAJ; these technologies are required.)

After the installation completes, install the Registry Server in the Application Server as follows:

  1. Stop the Application Server if it is running.
  2. Copy the two WAR files in the directory <JWSDP_HOME>/registry-server/webapps, RegistryServer.war and Xindice.war, to the following directory:

    <JAVAEE_HOME>/domains/domain1/autodeploy

  3. Start the Application Server.

Before you run the examples, perform these steps:

  1. In the directory examples/jaxr/simple/src, edit the following source files:
    • JAXRPublish.java
    • JAXRPublishConcept.java
    • JAXRPublishHelloOrg.java
    • JAXRPublishPostal.java
    • JAXRQueryByNAICSClassification.java
    • JAXRQueryByWSDLClassification.java
    • JAXRSaveClassificationScheme.java

    In each file, change each occurrence of "UUID:" to "uuid:" (note the colon).

  2. In the same directory, open the file JAXRExamples.properties and delete the following lines:
    ## Uncomment one pair of query and publish URLs.
    ## IBM:
    query.url=http://uddi.ibm.com/testregistry/inquiryapi
    publish.url=https://uddi.ibm.com/testregistry/publishapi
    ## Microsoft:
    #query.url=http://test.uddi.microsoft.com/inquire
    #publish.url=https://test.uddi.microsoft.com/publish
    ## Specify username and password
    registry.username=
    registry.password=

    Replace the lines with the following:

    ## Registry Server:
    query.url=http://localhost:8080/RegistryServer/
    publish.url=http://localhost:8080/RegistryServer/
    registry.username=testuser
    registry.password=testuser

    Once you have made these edits, you can ignore the first three instructions on editing this file in the section "Before You Compile the Examples" in Chapter 10.

  3. In the directory examples/jaxr/clientsession/src, edit the PubQueryBean.java file, changing the occurrence of "UUID:" to "uuid:".
  4. In the same directory, edit the file PubQueryBeanExample.properties, making exactly the same change that you made to JAXRExamples.properties.
  5. In the directory examples/saaj/myuddiping, edit the file uddi.properties. Remove these lines:
    URL: http://uddi.ibm.com/testregistry/inquiryapi
    #URL: http://test.uddi.microsoft.com/inquire

    Replace them with this line:

    URL: http://localhost:8080/RegistryServer/

    To obtain results when you run the myuddiping example, run the JAXR examples first, and do not delete the organizations you publish. Then run the myuddiping example with the argument string "the":

    asant run -Dbusiness-name=the
  6. In the directory examples/cb/jaxrpc/src/registry/com/sun/cb, edit the file JAXRPublisher.java, changing the occurrence of "UUID:" to "uuid:".
  7. In the directory examples/cb/common/src/com/sun/cb, edit the file CoffeeBreak.properties the same way you edited the file JAXRExamples.properties in Step 5.

Note: whenever you publish an object to the Registry Server, the following warning appears in the server log, followed by a stack trace:

[#|2006-02-03T14:19:20.630-0500|WARNING|sun-appserver-pe8.2|com.sun.registry_ser
ver|_ThreadID=12;|While retriving node :
com.sun.xnode.XNodeException: org.xmldb.api.base.XMLDBException while
retrieving
node '109315ab-1231-0931-4f89-b3475c26f698' from collection 'uddi':
null
 ...

This warning is benign; you can ignore it.

About Downloading The J2EE 1.4 Tutorial

How do I download The J2EE 1.4 Tutorial?

See the J2EE download page.

Note: If you download The J2EE 1.4 Tutorial, feel free to make it available locally at your site. Please do not publicly mirror it to the Web!. See the next question and answer to find out why.


May I mirror The J2EE 1.4 Tutorial publicly?

Anyone is permitted have a copy of The J2EE 1.4 Tutorial as long as it's visible only within their own institution (university, business, or whatever) and no one is profiting from the Tutorial's distribution.

We've taken this position because the many tutorial mirrors mean that search engines generally don't find the most up-to-date version of The J2EE 1.4 Tutorial. Instead, search engines find mirror sites, which invariably fall behind. We end up getting e-mail about problems that have been corrected in newer versions of The J2EE 1.4 Tutorial. Or perhaps worse, we don't get e-mail and the reputation of The J2EE 1.4 Tutorial suffers. We allow local copies because we realize that browsing java.sun.com isn't always practical.

When you tell us about a mirror, we send the offender a friendly e-mail asking them to please move their copy of The J2EE 1.4 Tutorial to a place that isn't visible from the outside world.


Where can I download the J2EE 1.4 Application Server?

See J2EE 1.4 SDK download.


I'm having trouble downloading The J2EE 1.4 Tutorial. What should I do?

Go to http://java.sun.com/feedback/sitecomments.html and submit a trouble report. Describe exactly what the problem is. They can't help you if you don't give them enough information. Make sure you tell them the hardware platform, operating system, and browser you're using.


When I unzip the download file, all of the files have a size of zero. What should I do?

The download did not complete successfully. Please perform the download again and make sure that the entire file was downloaded. The size of the file is listed at the top of the last page you encounter during the download sequence (the page with the buttons).


I'm having trouble unarchiving The J2EE 1.4 Tutorial. What should I do?

Go to http://java.sun.com/feedback/sitecomments.html and submit a trouble report. Make sure you indicate what hardware platform, operating system, and tools you're using to unarchive The J2EE 1.4 Tutorial files.

About Getting the J2EE 1.4 Tutorial in Other Formats

Can I get PDF version of The J2EE 1.4 Tutorial?

Go to thedownload page, and download and install the tutorial bundle. The PDF version is located in <INSTALL>/j2eetutorial14/doc/J2EETutorial.pdf.


How do I print The J2EE 1.4 Tutorial?

Open the PDF version in Adobe Acrobat, and click the printer button.


How do I buy The J2EE 1.4 Tutorial?

This tutorial has been published in the Java Series by Addison-Wesley as The Java Tutorial, Second Edition. For information on the book and links to online booksellers, go to http://java.sun.com/docs/books/j2eetutorial/index.html#second.

About the Tutorial Team

Who are the members of the tutorial team?

For information about the authors, read our bios page.


How do I contact the authors?

You can send feedback with this form.

Other Questions

Can you help me with my J2EE programming problem?

This question is actually a series of similar questions:

  • Here's my code. Can you help me debug it?
  • How do I set up my CLASSPATH?
  • When I try to run one of The J2EE 1.4 Tutorial examples it doesn't work at all. Help me.
  • I want to write a insert description of some program here. Where do I begin?
  • What's a compiler?

Unfortunately we are not staffed to provide answers to these types of questions at this address. Please consult the resources page to help you get an answer to your question.

By the way, we tested all of the examples in the book on Solaris systems and Windows PCs. The examples work for us. If you are having problems with the examples, then you are probably having configuration problems.


Where's the change history for The J2EE 1.4 Tutorial?

Read a complete change history of The J2EE 1.4 Tutorial.

Oracle is reviewing the Sun product roadmap and will provide guidance to customers in accordance with Oracle's standard product communication policies. Any resulting features and timing of release of such features as determined by Oracle's review of roadmaps, are at the sole discretion of Oracle. All product roadmap information, whether communicated by Sun Microsystems or by Oracle, does not represent a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. It is intended for information purposes only, and may not be incorporated into any contract.