I am having trouble understanding where the java:comp/env naming context is supposed
to be used. For example, the EJB 1.1 spec(section 5.2.1) provides this example of a
client
looking up a home interface:
Context initialContext = new InitialContext();
CartHome cartHome =
(CartHome)javax.rmi.PortableRemoteObject.narrow(initialContext.lookup("java:comp/env/ejb/cart"),
CartHome.class);
However, if I try to use such JNDI name on the client side using j2sdkee 1.2.1 I get
the
following error:
javax.naming.NamingException: java:comp/env namespace is only available from within a
J2EE component
at com.sun.enterprise.naming.java.javaURLContext.getComponentContext
javaURLContext.java:392)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:51)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at com.bear.racs.test.logging.ejb.TstLogClient.main(TstLogClient.java:46)
I also have a problem if I try to assign a name like "java:comp/env/ejb/..." as the
JNDI name. For example, given this RI deployment info:
<j2ee-ri-specific-information>
<server-name></server-name>
<rolemapping />
<enterprise-beans>
<ejb>
<ejb-name>TstLog</ejb-name>
<jndi-name>java:comp/env/ejb/com.bear.racs.test.logging.ejb.TstLog</jndi-name>
</ejb>
</enterprise-beans>
</j2ee-ri-specific-information>
I get the following exception when this is deployed to the j2sdkee 1.2.1 server:
javax.naming.NamingException: invocation exception
com.sun.enterprise.InvocationException
at
com.sun.enterprise.naming.NamingManagerImpl.getComponentId(NamingManagerImpl.java:291)
at
com.sun.enterprise.naming.java.javaURLContext.getComponentContext(javaURLContext.java:394)
at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:51)
at
com.sun.enterprise.naming.NamingManagerImpl.createSubContexts(NamingManagerImpl.java:237)
at
com.sun.enterprise.naming.NamingManagerImpl.publishObject(NamingManagerImpl.java:165)
at
com.sun.enterprise.naming.NamingManagerImpl.publishObject(NamingManagerImpl.java:141)
at com.sun.ejb.containers.BaseContainer.setEJBHome(BaseContainer.java:233)
at
com.sun.ejb.containers.ContainerFactoryImpl.createContainer(ContainerFactoryImpl.java:105)
at
com.sun.enterprise.tools.deployment.backend.JarManagerImpl.deploy(JarManagerImpl.java:115)
at
com.sun.enterprise.tools.deployment.backend.JarManagerImpl.loadJar(JarManagerImpl.java:88)
at
com.sun.enterprise.tools.deployment.backend.JarInstallerImpl.deployEjbs(JarInstallerImpl.java:534)
at
com.sun.enterprise.tools.deployment.backend.JarInstallerImpl.deployApplication(JarInstallerImpl.java:193)
at
com.sun.enterprise.tools.deployment.backend.JarInstallerImpl.deployApplication(JarInstallerImpl.java:111)
at
org.omg.stub.com.sun.enterprise.tools.deployment.backend._JarInstallerImpl_Tie._invoke(Unknown
Source)
at com.sun.corba.ee.internal.corba.ServerDelegate.dispatch(ServerDelegate.java:223)
at com.sun.corba.ee.internal.iiop.ORB.process(ORB.java:227)
at com.sun.corba.ee.internal.iiop.CachedWorkerThread.doWork(IIOPConnection.java:262)
at com.sun.corba.ee.internal.iiop.CachedWorkerThread.run(IIOPConnection.java:230)
The only context where I seem to be able to use the "java:comp/env" namespace is inside
the J2EE server. Can anyone explain why "java:comp/env" should or should not be a
valid JNDI context on the client side?
Thanks,
Scott
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".