问题
The CORBA lookup, EntAppLookup, works so far as it goes, better than running the appclient
. However, I would at least like to use standard naming. Specifically, java:comp/env
, or similar conventions, to reference the EJB. Deploying the Enterprise Application, with EJB module, and running the CORBA lookup:
thufir@dur:~$
thufir@dur:~$ ll NetBeansProjects/EntAppEJB/dist/EntAppEJB.ear
-rw-rw-r-- 1 thufir thufir 4659 Oct 11 22:17 NetBeansProjects/EntAppEJB/dist/EntAppEJB.ear
thufir@dur:~$
thufir@dur:~$ glassfish-4.1/glassfish/bin/asadmin
Use "exit" to exit and "help" for online help.
asadmin>
asadmin> list-applications
Nothing to list.
No applications are deployed to this target server.
Command list-applications executed successfully.
asadmin>
asadmin> deploy NetBeansProjects/EntAppEJB/dist/EntAppEJB.ear
Application deployed with name EntAppEJB.
Command deploy executed successfully.
asadmin>
asadmin> list-jndi-entries
UserTransaction: com.sun.enterprise.transaction.startup.TransactionLifecycleService$2
ejb.EJBRemoteInterface__3_x_Internal_RemoteBusinessHome__: javax.naming.Reference
ejb: com.sun.enterprise.naming.impl.TransientContext
ejb.EJBRemoteInterface: javax.naming.Reference
java:global: com.sun.enterprise.naming.impl.TransientContext
jdbc: com.sun.enterprise.naming.impl.TransientContext
concurrent: com.sun.enterprise.naming.impl.TransientContext
com.sun.enterprise.container.common.spi.util.InjectionManager: com.sun.enterprise.container.common.impl.util.InjectionManagerImpl
jms: com.sun.enterprise.naming.impl.TransientContext
ejb.EJBRemoteInterface#ejb.EJBRemoteInterface: javax.naming.Reference
Command list-jndi-entries executed successfully.
asadmin>
asadmin> list-jndi-resources
Command list-jndi-resources executed successfully.
asadmin>
asadmin> exit
Command multimode executed successfully.
thufir@dur:~$
thufir@dur:~$ glassfish-4.1/glassfish/bin/appclient -client NetBeansProjects/EntAppLookup/dist/EntAppLookup.jar
Oct 11, 2014 10:21:55 PM entapplookup.EntAppLookup main
INFO: This is My Session Bean
thufir@dur:~$
glassfish log showing the EAR being deployed:
[2014-10-11T22:25:43.750-0700] [glassfish 4.1] [INFO] [AS_ACDEPL-00104] [javax.enterprise.system.container.appclient] [tid: _ThreadID=141 _ThreadName=admin-listener(7)] [timeMillis: 1413091543750] [levelValue: 800] [[
Java Web Start services stopped for the app client EntAppEJB/EntAppClient.jar]]
[2014-10-11T22:27:06.364-0700] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=41 _ThreadName=admin-listener(4)] [timeMillis: 1413091626364] [levelValue: 800] [[
visiting unvisited references]]
[2014-10-11T22:27:06.390-0700] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=41 _ThreadName=admin-listener(4)] [timeMillis: 1413091626390] [levelValue: 800] [[
visiting unvisited references]]
[2014-10-11T22:27:06.444-0700] [glassfish 4.1] [INFO] [] [javax.enterprise.system.tools.deployment.common] [tid: _ThreadID=41 _ThreadName=admin-listener(4)] [timeMillis: 1413091626444] [levelValue: 800] [[
visiting unvisited references]]
[2014-10-11T22:27:06.724-0700] [glassfish 4.1] [INFO] [AS-EJB-00054] [javax.enterprise.ejb.container] [tid: _ThreadID=41 _ThreadName=admin-listener(4)] [timeMillis: 1413091626724] [levelValue: 800] [[
Portable JNDI names for EJB MySession: [java:global/EntAppEJB/EntAppEJB-ejb/MySession, java:global/EntAppEJB/EntAppEJB-ejb/MySession!ejb.EJBRemoteInterface]]]
[2014-10-11T22:27:06.724-0700] [glassfish 4.1] [INFO] [AS-EJB-00055] [javax.enterprise.ejb.container] [tid: _ThreadID=41 _ThreadName=admin-listener(4)] [timeMillis: 1413091626724] [levelValue: 800] [[
Glassfish-specific (Non-portable) JNDI names for EJB MySession: [ejb.EJBRemoteInterface#ejb.EJBRemoteInterface, ejb.EJBRemoteInterface]]]
[2014-10-11T22:27:07.529-0700] [glassfish 4.1] [WARN] [] [org.jboss.weld.Event] [tid: _ThreadID=41 _ThreadName=admin-listener(4)] [timeMillis: 1413091627529] [levelValue: 900] [[
WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.]]
[2014-10-11T22:27:07.538-0700] [glassfish 4.1] [WARN] [] [org.jboss.weld.Event] [tid: _ThreadID=41 _ThreadName=admin-listener(4)] [timeMillis: 1413091627538] [levelValue: 900] [[
WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.]]
[2014-10-11T22:27:07.559-0700] [glassfish 4.1] [WARN] [] [org.jboss.weld.Event] [tid: _ThreadID=41 _ThreadName=admin-listener(4)] [timeMillis: 1413091627559] [levelValue: 900] [[
WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.gf.cdi.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.]]
[2014-10-11T22:27:09.402-0700] [glassfish 4.1] [WARNING] [AS-ACDEPL-00112] [javax.enterprise.system.container.appclient] [tid: _ThreadID=41 _ThreadName=admin-listener(4)] [timeMillis: 1413091629402] [levelValue: 900] [[
The following extensions or libraries are referenced from the manifest of /home/thufir/glassfish-4.1/glassfish/domains/domain1/applications/EntAppEJB/EntAppClient.jar but were not found where indicated: EJBRemoteInterface.jar ; ignoring and continuing]]
[2014-10-11T22:27:09.434-0700] [glassfish 4.1] [INFO] [AS-ACDEPL-00103] [javax.enterprise.system.container.appclient] [tid: _ThreadID=41 _ThreadName=admin-listener(4)] [timeMillis: 1413091629434] [levelValue: 800] [[
Java Web Start services started for the app client EntAppEJB/EntAppClient.jar (contextRoot: /EntAppEJB/EntAppClient)]]
[2014-10-11T22:27:09.554-0700] [glassfish 4.1] [INFO] [] [javax.enterprise.system.core] [tid: _ThreadID=41 _ThreadName=admin-listener(4)] [timeMillis: 1413091629554] [levelValue: 800] [[
EntAppEJB was successfully deployed in 3,216 milliseconds.]]
general documentation entry on github of my progress:
https://github.com/THUFIR/EntAppClientJWS
which includes links to the following:
the Enterprise Application and EJB module: EntAppEJB https://github.com/THUFIR/EntAppEJB
the CLI appclient: EntAppClient https://github.com/THUFIR/EntAppClient
the remote interface library: EJBRemoteInterface https://github.com/THUFIR/EJBRemoteInterface
the CORBA lookup: EntAppLookup https://github.com/THUFIR/EntAppLookup
When I try to lookup the EJB with java:comp/env/
type syntax, I get naming errors:
thufir@dur:~$
thufir@dur:~$ glassfish-4.1/glassfish/bin/appclient -client NetBeansProjects/EntAppLookup/dist/EntAppLookup.jar
Exception in thread "main" javax.naming.NamingException: Lookup failed for 'java:comp/env/ejb.EJBRemoteInterface' in SerialContext[myEnv={org.omg.CORBA.ORBInitialPort=3700, java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, Context.SECURITY_CREDENTIALS=pass123, org.omg.CORBA.ORBInitialHost=localhost, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, Context.SECURITY_PRINCIPAL=user1} [Root exception is javax.naming.NameNotFoundException: No object bound to name java:comp/env/ejb.EJBRemoteInterface]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:491)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:438)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at entapplookup.EntAppLookup.main(EntAppLookup.java:17)
Caused by: javax.naming.NameNotFoundException: No object bound to name java:comp/env/ejb.EJBRemoteInterface
at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:741)
at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:715)
at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:159)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:471)
... 3 more
thufir@dur:~$
thufir@dur:~$ glassfish-4.1/glassfish/bin/appclient -client NetBeansProjects/EntAppLookup/dist/EntAppLookup.jar
Exception in thread "main" javax.naming.NamingException: Lookup failed for 'java:comp/env/EJBRemoteInterface' in SerialContext[myEnv={org.omg.CORBA.ORBInitialPort=3700, java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, Context.SECURITY_CREDENTIALS=pass123, org.omg.CORBA.ORBInitialHost=localhost, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, Context.SECURITY_PRINCIPAL=user1} [Root exception is javax.naming.NameNotFoundException: No object bound to name java:comp/env/EJBRemoteInterface]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:491)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:438)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at entapplookup.EntAppLookup.main(EntAppLookup.java:16)
Caused by: javax.naming.NameNotFoundException: No object bound to name java:comp/env/EJBRemoteInterface
at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:741)
at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:715)
at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:159)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:471)
... 3 more
thufir@dur:~$
How can I deploy the Enterprise Application and look it up with CORBA using conventional java:comp/env/
type syntax? Why does this lookup fail when I run it?
来源:https://stackoverflow.com/questions/26322294/corba-lookup-for-javacomp-env-or-javaglobal