IBM Support

NMSV0307E: Naming error seen when using the embeddable EJB Container in J2SE program

Troubleshooting


Problem

When writing a J2SE program that performs java:comp lookups using the embeddable EJB container, you must remember that java:comp is only accessible within an EJB method. If you attempt to lookup a java:comp name directly from the main method, you will get an NMSV0307E error.

Symptom

NMSV0307E: A java: URL name was used, but Naming was not configured to handle java: URL names. The likely cause is a user in error attempting to specify a java: URL name in a non-J2EE client or server environment. Throwing ConfigurationException.
javax.naming.ConfigurationException: Name space accessor for the java: name space has not been set. Possible cause is that the user is specifying a java: URL name in a JNDI Context method call but is not running in a J2EE client or server environment.
at com.ibm.ws.naming.java.javaURLContextFactory.isNameSpaceAccessable
at com.ibm.ws.naming.urlbase.UrlContextFactory.getObjectInstance
at javax.naming.spi.NamingManager.getURLContext
at javax.naming.InitialContext.getURLOrDefaultInitCtx
at javax.naming.InitialContext.lookup
at com.ibm.test.EmbeddableEJBTest.main

[{"Product":{"code":"SSEQTP","label":"WebSphere Application Server"},"Business Unit":{"code":"BU048","label":"IBM Software"},"Component":"EJB Container","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"9.0;8.5.5;8.0","Edition":"","Line of Business":{"code":"LOB77","label":"Automation Platform"}}]

Log InLog in to view more of this document

This document has the abstract of a technical article that is available to authorized users once you have logged on. Please use Log in button above to access the full document. After log in, if you do not have the right authorization for this document, there will be instructions on what to do next.

Document Information

Modified date:
03 March 2025

UID

swg21580598