The J2EETM Tutorial
Home
TOC
Index
PREV TOP NEXT Search
Feedback

Common Problems and Their Solutions

Cannot Start the J2EE Server

Naming and Directory Service Port Conflict

Symptom: When you start the J2EE server with the -verbose option, it displays these lines:

J2EE server listen port: 1050 RuntimeException: Could not initialize server. . .

Solution: Another process is using port 1050. If the J2EE server is already running, you can stop it by typing j2ee -stop. If some other program is using the port, then you can change the default port number (1050) by editing the config/orb.properties file of your J2EE SDK installation.

For more information about default port numbers, see the Configuration Guide in the download bundle of the J2EE SDK.

Web Service Port Conflict

Symptom: When you start the J2EE server with the -verbose option, it displays these lines:

LifecycleException: HttpConnector[8000].open:	
java.net.BindException: Address in use. . .
 

Solution: Another process is using port 8000. You can change the default port number (8000) by editing the config/web.properties file of your J2EE SDK installation.

Incorrect XML Parser

Symptom: When you start the J2EE server with the -verbose option, it displays these lines:

Exception in thread "main"	
javax.xml.parsers.FactoryConfigurationError:	
org.apache.xerces.jaxp.SAXParserFactoryImpl at . . . 
 

Solution: Remove the jre/lib/jaxp.properties file from your J2SE installation.

Compilation Errors

ant Cannot Locate the Build File

Symptom: When you type ant converter, these messages appear:

Buildfile: build.xml does not exist!	
Build failed.
 

Solution: Before running ant, go to the j2eetutorial/examples/src directory. If you want to run ant from your current directory, you must specify the build file on the command line. For example, on Windows you would type this command on a single line:

ant -buildfile C:\j2eetutorial\examples\src\build.xml	
converter
 

The Compiler Cannot Resolve Symbols

Symptom: When you type ant converter, the compiler reports many errors, including these:

cannot resolve symbol	
. . .	
BUILD FAILED	
. . .	
Compile failed, messages should have been provided
 

Solution: Make sure that you've set the J2EE_HOME environment variable correctly. See Checking the Environment Variables.

ant 1.4 Will Not Compile the Example after You Run the Client

Symptom: ant 1.4 displays this error:

The filename, directory name, or volume label syntax is 
incorrect.
 

Solution: Use version 1.3 of ant. The 1.4 version of the ant.bat script and the scripts of the J2EE SDK all use the JAVACMD environment variable. The SDK's runclient.bat script, for example, sets JAVACMD to a value that causes problems for ant.bat.

Deployment Errors

The Incorrect XML Parser Is in Your Classpath

Symptom: The error displayed has the following text:

. . .	
[]java.rmi.RemoteException:Error saving/opening	
	
Deployment Error:Bad mapping of key{0}  class{1}, 	
not found: com.sum.enterprise.deployment.xml.ApplicationNode
 

Solution: Remove the jaxp.jar file from the jre/lib/ext directory of your J2SE installation. This JAR file contains XML parsing routines that are incompatible with the J2EE server. If you do not have a jaxp.jar file, then perhaps your classpath refers to the XML routines of a Tomcat installation. In this case, you should remove that reference from your classpath.

The Remote Home Interface Was Specified as a Local Home Interface

Symptom: An error such as the following is displayed:

LocalHomeImpl must be declared abstract. 	
It does not define javax.ejb.HomeHandle getHomeHandle() 	
from interface javax.ejb.EJBHome.
 

Solution: Remove the enterprise bean from the EAR file (EditDelete) and create a new bean with the New Enterprise Bean wizard. In the General dialog box of the wizard, select values from the Remote Home Interface and Remote Interface combo boxes.

J2EE Application Client Runtime Errors

The Client Throws a NoClassDefFoundError

Symptom: The client reports this exception:

java.lang.NoClassDefFoundError:converter.ConverterHome
 

Solution: This error occurs if the client cannot find the classes in the ConverterAppClient.jar file. Make sure that you've correctly followed the steps outlined in Running the J2EE Application Client.

The Client Cannot Find ConverterApp.ear

Symptom: The client reports this exception:

IOException: ConverterApp.ear does not exist
 

Solution: Ensure that the ConverterApp.ear file exists and that you've specified it with the -client option:

runclient -client ConverterApp.ear -name ConverterClient
 

You created the ConverterApp.ear file in the section, Creating the J2EE Application. See also the section Running the J2EE Application Client.

The Client Cannot Find the ConverterClient Component

Symptom: The client displays this line:

No application client descriptors defined for: . . .
 

Solution: Verify that you've created the ConverterClient component and that you've specified it for the -name option of the runclient command. You created the ConverterClient component in the section, Packaging the J2EE Application Client.

The Login Failed

Symptom: After you log in, the client displays this line:

Incorrect login and/or password
 

Solution: At the login prompts, enter guest as the user name and guest123 as the password.

The J2EE Application Has Not Been Deployed

Symptom: The client reports the following exception:

NameNotFoundException. Root exception is org.omg.CosNaming. . .
 

Solution: Deploy the application. For instructions, see Deploying the J2EE Application.

The JNDI Name Is Incorrect

Symptom: The client reports the following exception:

NameNotFoundException. Root exception is org.omg.CosNaming. . .
 

Solution: In the JNDI Names tabbed pane of the ConverterApp, make sure that the JNDI names for the ConverterBean and the ejb/SimpleConverter match. Edit the appropriate JNDI Name field and then redeploy the application.

Web Client Runtime Errors

The Web Context in the URL Is Incorrect

Symptom: The browser reports that the page cannot be found (HTTP 404).

Solution: Verify that the Web context (converter) in the URL matches the one you specified in the Component General Properties dialog box (See the section Packaging the Web Client). The case (upper or lower) of the Web context is significant.

The J2EE Application Has Not Been Deployed

Symptom: The browser reports that the page cannot be found (HTTP 404).

Solution: Deploy the application.

The JNDI Name Is Incorrect

Symptom: When you click Submit on the Web page, the browser reports

A Servlet Exception Has Occurred.
 

Solution: In the JNDI Names tabbed pane of the ConverterApp, make sure that the JNDI names for the ConverterBean and the ConverterWAR match. Edit the appropriate JNDI Name field and then redeploy the application.

Detecting Problems With the Verifier Tool

The verifier tool (verifier) can detect inconsistencies in deployment descriptors and method signatures. These inconsistencies often cause deployment or runtime errors. From deploytool, you can run the GUI version of verifier by selecting ToolsVerifier. You can also run a stand-alone GUI or command-line version of verifier. For more information, see Appendix B.

Comparing Your EAR Files with Ours

For most of the examples, the download bundle of the tutorial includes J2EE application EAR files, which are located in the j2eetutorial/examples/ears directory.

When All Else Fails

If none of these suggestions fixes the problem, you can uninstall the application and clean out the server's repository by running the cleanup script. You'll also need to shut down and restart the server:

j2ee -stop	
cleanup	
j2ee -verbose
 
Home
TOC
Index
PREV TOP NEXT Search
Feedback