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.

Errors

  1. Can't find SerialContextProvider
  2. SEVERE JMSInitialContext: Unable to get internal JNDI context
  3. javax.naming.NameNotFoundException: MyQueueConnectionFactory not found
  4. java.rmi.MarshalException
  5. javax.naming.NoInitialContextException
  6. package javax.jms does not exist
  7. SEVERE ConnectionFactoryImpl: Failed to lookup or connect to JMS service
  8. java.lang.NoClassDefFoundError


Answers

  1. 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 SerialContextProvider
    
    Likely cause:  The JavaTM 2, Enterprise Edition (J2EETM) server is not running. Use the command j2ee -verbose to start the server.

  2. 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.

  3. 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.

  4. java.rmi.MarshalException

    Error detail:

    java -Djms.properties=%J2EE_HOME%\config\jms_client.properties SimpleQueueSender MyQueue 3
    Queue name is MyQueue
    JNDI lookup failed: javax.naming.CommunicationException: java.rmi.MarshalException:
    CORBA MARSHAL 1398079699 Maybe; nested exception is:
        org.omg.CORBA.MARSHAL: Unable to read value from underlying bridge :   
    minor code: 1398079699 completed: Maybe
    org.omg.CORBA.MARSHAL: Unable to read value from underlying bridge :   
    minor code: 1398079699 completed: Maybe
        at com.sun.corba.ee.internal.iiop.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:923)
    
    Likely cause:  The version of the Java 2, Standard Edition (J2SETM) SDK used to run the program is probably not the same version of the J2SE SDK that the J2EE server is using. Make sure that the same version of the J2SE SDK is being used for both.

  5. 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.initial
    
    Likely cause:  If you installed a new version of the J2SE SDK without first removing the previous one, this problem and others can result.

  6. 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.

  7. 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.

  8. java.lang.NoClassDefFoundError

    Error detail:

    java -Djms.properties=%J2EE_HOME%\jms_client.properties SimpleQueueSender MyQueue 3
    Exception in thread "main" java.lang.NoClassDefFoundError: SimpleQueueSender
    
    Likely cause:  You may have forgotten to include the current directory (.) in your classpath.