JavaTM Message Service
Tutorial
FREQUENTLY ASKED QUESTIONS
When you first run the tutorial examples, you may encounter problems that are related to setting up your environment. Here are some commonly encountered runtime errors and the likely cause for each.
Can't find SerialContextProvider
SEVERE JMSInitialContext: Unable to get internal JNDI context
javax.naming.NameNotFoundException: MyQueueConnectionFactory not found
java.rmi.MarshalException
javax.naming.NoInitialContextException
package javax.jms does not exist
SEVERE ConnectionFactoryImpl: Failed to lookup or connect to JMS service
java.lang.NoClassDefFoundError
Answers
Can't find SerialContextProvider
Error detail:
java -Djms.properties=%J2EE_HOME%\config\jms_client.properties SimpleQueueSender MyQueue 3 Queue name is MyQueue JNDI lookup failed: javax.naming.CommunicationException: Can't find SerialContextProviderLikely cause: The JavaTM 2, Enterprise Edition (J2EETM) server is not running. Use the command
j2ee -verbose to start the server.
SEVERE JMSInitialContext: Unable to get internal JNDI context
Error detail:
java -Djms.properties=%J2EE_HOME%\config\jms_client.properties SimpleQueueSender MyQueue 3 Queue name is MyQueue SEVERE JMSInitialContext: Unable to get internal JNDI context because: javax.naming.CommunicationException: Cannot connect to ORB [Root exception is org.omg.CORBA.COMM_FAILURE: minor code: 1398079689 completed: No]Likely cause: You made some error in specifying the client properties file. For example, you may have used Microsoft Windows syntax on a UNIX® system, or vice versa. Also, make sure that you have specified the correct path to the
jms_client.properties file, including the
config directory.
javax.naming.NameNotFoundException: MyQueueConnectionFactory not found
Error detail:
runclient -client MDBApp.ear -name SimpleClient Initiating login ... Binding name:`java:comp/env/jms/QueueName ` Binding name:`java:comp/env/jms/MyQueueConnectionFactory ` JNDI lookup failed: javax.naming.NameNotFoundException: MyQueueConnectionFactory not found Unbinding name:`java:comp/env/jms/QueueName ` Unbinding name:`java:comp/env/jms/MyQueueConnectionFactory `Likely cause: Notice in the above output that there is an extra space after
QueueName and MyQueueConnectionFactory,
before the closing single quote. If you pasted these names in with the extra
space, the J2EE SDK 1.3 deploytool regards the extra space as part of the name.
Use the Resource Refs tabbed pane to delete the extra space, then save the
application and deploy it again. This problem no longer occurs if you use the
J2EE SDK 1.3.1 deploytool.
javax.naming.NoInitialContextException
Error detail:
JNDI lookup failed: javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initialLikely cause: If you installed a new version of the J2SE SDK without first removing the previous one, this problem and others can result.
package javax.jms does not exist
Error detail:
java -Djms.properties=%J2EE_HOME%\config\jms_client.properties SimpleQueueSender MyQueue 3
SimpleQueueSender.java:18: package javax.jms does not exist
import javax.jms.*;
^
SimpleQueueSender.java:32: cannot resolve symbol
symbol : class QueueConnectionFactory
location: class SimpleQueueSender
QueueConnectionFactory queueConnectionFactory = null;
Likely cause: Either the CLASSPATH variable was
not set correctly, or the J2EE SDK was not correctly installed. Make sure
that j2sdkee1.3.1/lib/j2ee.jar is in your classpath, and that
the file exists on your system.
SEVERE ConnectionFactoryImpl: Failed to lookup or connect to JMS service
Error detail:
java -Djms.properties=%J2EE_HOME%\config\jms_client.properties SimpleQueueSender MyQueue 3
Queue name is MyQueue
Java(TM) Message Service 1.0.2 Reference Implementation (build b14)
SEVERE ConnectionFactoryImpl: Failed to lookup or connect to JMS service because:
javax.naming.CommunicationException: Cannot connect to ORB [Root exception is
org.omg.CORBA.COMM_FAILURE: minor code: 1398079696 completed: Maybe]
SEVERE ConnectionFactoryImpl: Failed to lookup or connect to JMS service because:
javax.naming.CommunicationException: Cannot connect to ORB [Root exception is
org.omg.CORBA.COMM_FAILURE: minor code: 1398079696 completed: Maybe]
Exception in thread "main" java.lang.NullPointerException
at com.sun.jms.client.ConnectionImpl.invokeRemoteCreateConnection(ConnectionImpl.java:149)
at com.sun.jms.ConnectionFactoryImpl.createConnection(ConnectionFactoryImpl.java:293)
at com.sun.jms.QueueConnectionFactoryImpl.createQueueConnection
(QueueConnectionFactoryImpl.java:77)
at com.sun.jms.QueueConnectionFactoryImpl.createQueueConnection
(QueueConnectionFactoryImpl.java:58)
at com.sun.enterprise.jms.ConnectionFactoryWrapperStandalone.createQueueConnection
(ConnectionFactoryWrapperStandalone.java:44)
at SimpleQueueSender.main(SimpleQueueSender.java:89)
Likely cause: If you get this error when you try to access a
remote connection factory, as described in Section 4.4, "Running JMS Client
Programs on Multiple Systems," make sure the J2EE server is running on the
remote system.
java.lang.NoClassDefFoundError
Error detail:
java -Djms.properties=%J2EE_HOME%\jms_client.properties SimpleQueueSender MyQueue 3 Exception in thread "main" java.lang.NoClassDefFoundError: SimpleQueueSenderLikely cause: You may have forgotten to include the current directory (
.) in your classpath.
Copyright © 2002 Sun Microsystems, Inc. All rights reserved.