payara / Payara

Payara Server is an open source middleware platform that supports reliable and secure deployments of Java EE (Jakarta EE) and MicroProfile applications in any environment: on premise, in the cloud or hybrid.
http://www.payara.fish
Other
883 stars 306 forks source link

Problems with jndi lookup #535

Closed mlb1141 closed 8 years ago

mlb1141 commented 8 years ago

I created an ejb and deployed it to Payara. It has a module name: VPP_JavaEE_Chap4 and a bean name: EmployeeManagementImplementation

So I thought the following would work:

EmployeeManagementService service = (EmployeeManagementService) jndi.lookup("java:global/VPP_JavaEE_Chap4/EmployeeManagementImplementation");

I also tried the non-global version:

EmpMgmtService service = (EmpMgmtService) jndi.lookup("com.vpp4.staffmgmt.EmpMgmtService");

Neither worked.

Using the asadmin list-jndi-entries, I got the following:

UserTransaction: com.sun.enterprise.transaction.startup.TransactionLifecycleService$2 ejb: com.sun.enterprise.naming.impl.TransientContext java:global: com.sun.enterprise.naming.impl.TransientContext com.vpp4.staffmgmt.EmpMgmtService#com.vpp4.staffmgmt.EmpMgmtService: javax.naming.Reference com.vpp4.staffmgmt.EmpMgmtService: javax.naming.Reference com.vpp4.staffmgmt.EmpMgmtService__3_x_Internal_RemoteBusinessHome__: javax.naming.Reference 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 Command list-jndi-entries executed successfully.

Needless to say, I was surprised the portable version did not show up AND that the non-portable one did not work. That is question number 1.

In addition, I was getting the following java exceptions when I ran my standalone client:

javax.naming.InitialContext@1af2d44a Nov 24, 2015 10:01:06 PM org.glassfish.enterprise.iiop.impl.GlassFishORBManager initORB SEVERE: enterprise_util.excep_in_createorb org.omg.CORBA.DATA_CONVERSION: WARNING: 02410014: org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory is not a valid custom socket factory vmcid: OMG minor code: 14 completed: No at com.sun.proxy.$Proxy19.badCustomSocketFactory(Unknown Source) at com.sun.corba.ee.impl.orb.ParserTable$4.operate(ParserTable.java:763) at com.sun.corba.ee.impl.orb.NormalParserAction.apply(NormalParserAction.java:62) at com.sun.corba.ee.spi.orb.PropertyParser.parse(PropertyParser.java:84) at com.sun.corba.ee.spi.orb.ParserImplBase.init(ParserImplBase.java:77) at com.sun.corba.ee.impl.orb.ORBDataParserImpl.(ORBDataParserImpl.java:492) at com.sun.corba.ee.impl.orb.ORBImpl.postInit(ORBImpl.java:562) at com.sun.corba.ee.impl.orb.ORBImpl.set_parameters(ORBImpl.java:697) at com.sun.corba.ee.impl.orb.ORBImpl.setParameters(ORBImpl.java:684) at com.sun.corba.ee.spi.osgi.ORBFactory.initialize(ORBFactory.java:107) at org.glassfish.enterprise.iiop.impl.GlassFishORBManager.initORB(GlassFishORBManager.java:590) at org.glassfish.enterprise.iiop.impl.GlassFishORBManager.getORB(GlassFishORBManager.java:265) at org.glassfish.enterprise.iiop.impl.GlassFishORBFactoryImpl.createORB(GlassFishORBFactoryImpl.java:93) at org.glassfish.enterprise.iiop.api.GlassFishORBHelper.getORB(GlassFishORBHelper.java:162) at com.sun.enterprise.naming.impl.SerialContext.getORB(SerialContext.java:347) at com.sun.enterprise.naming.impl.SerialContext.getProviderCacheKey(SerialContext.java:354) at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:384) at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:329) at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:477) at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:438) at javax.naming.InitialContext.lookup(InitialContext.java:417) at com.vpp4.client.ClientApplicationTest.main(ClientApplicationTest.java:24) Caused by: org.omg.CORBA.BAD_OPERATION: WARNING: 01210054: Error while attempting to load class org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory vmcid: OMG minor code: 54 completed: No at com.sun.proxy.$Proxy19.classActionException(Unknown Source) at com.sun.corba.ee.spi.orb.OperationFactory$ClassAction.operate(OperationFactory.java:294) at com.sun.corba.ee.impl.orb.ParserTable$4.operate(ParserTable.java:749) ... 20 more Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory at com.sun.corba.ee.spi.orb.ORB$2.evaluate(ORB.java:880) at com.sun.corba.ee.spi.orb.ORB$2.evaluate(ORB.java:875) at com.sun.corba.ee.spi.orb.OperationFactory$ClassAction.operate(OperationFactory.java:291) ... 21 more Caused by: java.lang.ClassNotFoundException: org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at com.sun.corba.ee.spi.orb.ORB$2.evaluate(ORB.java:878) ... 23 more

java.lang.RuntimeException: Orb initialization erorr at org.glassfish.enterprise.iiop.api.GlassFishORBHelper.getORB(GlassFishORBHelper.java:190) at com.sun.enterprise.naming.impl.SerialContext.getORB(SerialContext.java:347) at com.sun.enterprise.naming.impl.SerialContext.getProviderCacheKey(SerialContext.java:354) at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:384) at com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.java:329) at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:477) at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:438) at javax.naming.InitialContext.lookup(InitialContext.java:417) at com.vpp4.client.ClientApplicationTest.main(ClientApplicationTest.java:24) Caused by: java.lang.RuntimeException: org.omg.CORBA.DATA_CONVERSION: WARNING: 02410014: org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory is not a valid custom socket factory vmcid: OMG minor code: 14 completed: No at org.glassfish.enterprise.iiop.impl.GlassFishORBManager.initORB(GlassFishORBManager.java:637) at org.glassfish.enterprise.iiop.impl.GlassFishORBManager.getORB(GlassFishORBManager.java:265) at org.glassfish.enterprise.iiop.impl.GlassFishORBFactoryImpl.createORB(GlassFishORBFactoryImpl.java:93) at org.glassfish.enterprise.iiop.api.GlassFishORBHelper.getORB(GlassFishORBHelper.java:162) ... 8 more Caused by: org.omg.CORBA.DATA_CONVERSION: WARNING: 02410014: org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory is not a valid custom socket factory vmcid: OMG minor code: 14 completed: No at com.sun.proxy.$Proxy19.badCustomSocketFactory(Unknown Source) at com.sun.corba.ee.impl.orb.ParserTable$4.operate(ParserTable.java:763) at com.sun.corba.ee.impl.orb.NormalParserAction.apply(NormalParserAction.java:62) at com.sun.corba.ee.spi.orb.PropertyParser.parse(PropertyParser.java:84) at com.sun.corba.ee.spi.orb.ParserImplBase.init(ParserImplBase.java:77) at com.sun.corba.ee.impl.orb.ORBDataParserImpl.(ORBDataParserImpl.java:492) at com.sun.corba.ee.impl.orb.ORBImpl.postInit(ORBImpl.java:562) at com.sun.corba.ee.impl.orb.ORBImpl.set_parameters(ORBImpl.java:697) at com.sun.corba.ee.impl.orb.ORBImpl.setParameters(ORBImpl.java:684) at com.sun.corba.ee.spi.osgi.ORBFactory.initialize(ORBFactory.java:107) at org.glassfish.enterprise.iiop.impl.GlassFishORBManager.initORB(GlassFishORBManager.java:590) ... 11 more Caused by: org.omg.CORBA.BAD_OPERATION: WARNING: 01210054: Error while attempting to load class org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory vmcid: OMG minor code: 54 completed: No at com.sun.proxy.$Proxy19.classActionException(Unknown Source) at com.sun.corba.ee.spi.orb.OperationFactory$ClassAction.operate(OperationFactory.java:294) at com.sun.corba.ee.impl.orb.ParserTable$4.operate(ParserTable.java:749) ... 20 more Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory at com.sun.corba.ee.spi.orb.ORB$2.evaluate(ORB.java:880) at com.sun.corba.ee.spi.orb.ORB$2.evaluate(ORB.java:875) at com.sun.corba.ee.spi.orb.OperationFactory$ClassAction.operate(OperationFactory.java:291) ... 21 more Caused by: java.lang.ClassNotFoundException: org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at com.sun.corba.ee.spi.orb.ORB$2.evaluate(ORB.java:878) ... 23 more javax.naming.NamingException: Lookup failed for 'com.vpp4.staffmgmt.EmpMgmtService' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is javax.naming.NamingException: Unable to acquire SerialContextProvider for SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl} [Root exception is java.lang.RuntimeException: Orb initialization erorr]] Picked up _JAVA_OPTIONS: -Xmx512M

I inquired about the "Caused by: java.lang.ClassNotFoundException: org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory" and was told that it was included in "Payara/payara41/glassfish/modules/orb-iiop.jar"

Since I am using gradle, printed by dependencies and got the following list (which included orb-iiop.jar): :printDependencies C:\Payara\payara41\glassfish\modules\endorsed\javax.annotation-api.jar C:\Payara\payara41\glassfish\modules\javax.batch-api.jar C:\Payara\payara41\glassfish\modules\javax.ejb-api.jar C:\Payara\payara41\glassfish\modules\javax.el.jar C:\Payara\payara41\glassfish\modules\javax.enterprise.concurrent-api.jar C:\Payara\payara41\glassfish\modules\javax.enterprise.concurrent.jar C:\Payara\payara41\glassfish\modules\javax.enterprise.deploy-api.jar C:\Payara\payara41\glassfish\modules\javax.faces.jar C:\Payara\payara41\glassfish\modules\javax.inject.jar C:\Payara\payara41\glassfish\modules\javax.interceptor-api.jar C:\Payara\payara41\glassfish\modules\javax.jms-api.jar C:\Payara\payara41\glassfish\modules\javax.json.jar C:\Payara\payara41\glassfish\modules\javax.mail.jar C:\Payara\payara41\glassfish\modules\javax.management.j2ee-api.jar C:\Payara\payara41\glassfish\modules\javax.persistence.jar C:\Payara\payara41\glassfish\modules\javax.resource-api.jar C:\Payara\payara41\glassfish\modules\javax.security.auth.message-api.jar C:\Payara\payara41\glassfish\modules\javax.security.jacc-api.jar C:\Payara\payara41\glassfish\modules\javax.servlet-api.jar C:\Payara\payara41\glassfish\modules\javax.servlet.jsp-api.jar C:\Payara\payara41\glassfish\modules\javax.servlet.jsp.jar C:\Payara\payara41\glassfish\modules\javax.servlet.jsp.jstl-api.jar C:\Payara\payara41\glassfish\modules\javax.servlet.jsp.jstl.jar C:\Payara\payara41\glassfish\modules\javax.transaction-api.jar C:\Payara\payara41\glassfish\modules\javax.websocket-api.jar C:\Payara\payara41\glassfish\modules\javax.ws.rs-api.jar C:\Payara\payara41\glassfish\modules\javax.xml.registry-api.jar C:\Payara\payara41\glassfish\modules\javax.xml.rpc-api.jar C:\Payara\payara41\glassfish\modules\orb-connector.jar C:\Payara\payara41\glassfish\modules\orb-enabler.jar C:\Payara\payara41\glassfish\modules\orb-iiop.jar C:\Payara\payara41\glassfish\modules\security.jar C:\Payara\payara41\glassfish\lib\appclient\weld-se-core.jar C:\Payara\payara41\glassfish\lib\appserv-rt.jar C:\Payara\payara41\glassfish\lib\asadmin\cli-optional.jar C:\Payara\payara41\glassfish\lib\asadmin\cluster-cli.jar C:\Payara\payara41\glassfish\lib\asadmin\osgi-cli-interactive.jar C:\Payara\payara41\glassfish\lib\asadmin\server-mgmt.jar C:\Payara\payara41\glassfish\lib\client\appserver-cli.jar C:\Payara\payara41\glassfish\lib\deployment\sun-as-jsr88-dm.jar C:\Payara\payara41\glassfish\lib\embedded\glassfish-embedded-shell.jar C:\Payara\payara41\glassfish\lib\embedded\glassfish-embedded-static-shell.jar C:\Payara\payara41\glassfish\lib\gf-client.jar C:\Payara\payara41\glassfish\lib\install\applications\jaxr-ra\jaxr-ra.jar C:\Payara\payara41\glassfish\lib\install\applications\jmsra\fscontext.jar C:\Payara\payara41\glassfish\lib\install\applications\jmsra\imqbroker.jar C:\Payara\payara41\glassfish\lib\install\applications\jmsra\imqjmsbridge.jar C:\Payara\payara41\glassfish\lib\install\applications\jmsra\imqjmsra.jar C:\Payara\payara41\glassfish\lib\install\applications\jmsra\imqjmx.jar C:\Payara\payara41\glassfish\lib\install\applications\jmsra\imqstomp.jar C:\Payara\payara41\glassfish\lib\install\applications\mejb.jar C:\Payara\payara41\glassfish\lib\install\applicationsadmingui\WEB-INF\extra\commons-fileupload-1.1.1.jar C:\Payara\payara41\glassfish\lib\install\applicationsadmingui\WEB-INF\extra\commons-io-1.3.1.jar C:\Payara\payara41\glassfish\lib\install\applicationsadmingui\WEB-INF\extra\dojo-ajax-nodemo-0.4.1.jar C:\Payara\payara41\glassfish\lib\install\applicationsadmingui\WEB-INF\extra\json-1.0.jar C:\Payara\payara41\glassfish\lib\install\applicationsadmingui\WEB-INF\extra\prototype-1.5.0.jar C:\Payara\payara41\glassfish\lib\install\applicationsadmingui\WEB-INF\extra\webui-jsf-4.0.2.10.jar C:\Payara\payara41\glassfish\lib\install\applicationsadmingui\WEB-INF\extra\webui-jsf-suntheme-4.0.2.10.jar C:\Payara\payara41\glassfish\lib\install\applicationsadmingui\WEB-INF\lib\console-core-4.1.jar C:\Payara\payara41\glassfish\lib\install\applicationscp_jdbc_racp_jdbc_ra.jar C:\Payara\payara41\glassfish\lib\install\applicationsdm_jdbc_radm_jdbc_ra.jar C:\Payara\payara41\glassfish\lib\install\applicationsds_jdbc_rads_jdbc_ra.jar C:\Payara\payara41\glassfish\lib\install\applicationsxa_jdbc_raxa_jdbc_ra.jar C:\Payara\payara41\glassfish\lib\javaee.jar C:\Payara\payara41\glassfish\lib\jndi-properties.jar C:\Payara\payara41\glassfish\lib\monitor\flashlight-agent.jar C:\Users\xxx.gradle\caches\modules-2\files-2.1\com.microsoft.sqlserver\sqljdbc4\4.2.6420.100\4d8a1bc64ddf2099dbc2a171e113f6654a1c02a6\sqljdbc4-4.2.6420.100.jar C:\Users\xxx.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-api\1.7.10\5b338f206827d88acd890739f400a9b7664e5984\slf4j-api-1.7.10.jar C:\Users\xxx.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-classic\1.1.2\b316e9737eea25e9ddd6d88eaeee76878045c6b2\logback-classic-1.1.2.jar C:\Users\xxx.gradle\caches\modules-2\files-2.1\ch.qos.logback\logback-core\1.1.2\2d23694879c2c12f125dac5076bdfd5d771cc4cb\logback-core-1.1.2.jar

BUILD SUCCESSFUL

I added the above dependencies to my run-time classpath, since it was a sucessful compilation.

My second question is why I am getting a class not found exception.

I have not added jndi.properties that I am aware of.

Any light that can be shed on any part of this issue will be greatly appreciated.

smillidge commented 8 years ago

The portable name should be there. The Transient Context reference at java:global is a naming context that does further resolution if traversed so what's under that reference does not show up in list-jndi-entries. See https://github.com/payara/Payara/issues/401 for a similar issue.

Can you try just adding gf-client.jar as described in https://github.com/payara/Payara/issues/516 to your standalone client. Please note you must reference gf-client.jar from its path in the Payara installation as it references other jars via relative paths in its MANIFEST.

mlb1141 commented 8 years ago

Excerpted from my list of dependencies above:

C:\Payara\payara41\glassfish\lib\embedded\glassfish-embedded-shell.jar C:\Payara\payara41\glassfish\lib\embedded\glassfish-embedded-static-shell.jar C:\Payara\payara41\glassfish\lib\gf-client.jar C:\Payara\payara41\glassfish\lib\install\applications\jaxr-ra\jaxr-ra.jar C:\Payara\payara41\glassfish\lib\install\applications\jmsra\fscontext.jar

mlb1141 commented 8 years ago

Can you elaborate on this: However DO NOT MOVE the jar as in its Manifest Classpath entry

smillidge commented 8 years ago

I think this is a bug. Please try replacing orb-iiop.jar in the glassfish/modules directory with the attached one to see if the problem goes away (after renaming it from .zip to .jar)

Attached org-iiop.jar orb-iiop.zip

mlb1141 commented 8 years ago

How can I get a copy of 4.1.61? I looked in GitHub (new to me) and it was not obvious.

From: Steve Millidge [mailto:notifications@github.com] Sent: Thursday, December 3, 2015 5:27 PM To: payara/Payara Cc: mlb1141 Subject: Re: [Payara] Problems with jndi lookup (#535)

I think this is a bug. Please try replacing orb-iiop.jar with the attached one to see if the problem goes away (after renaming it from .zip to .jar)

Attached org-iiop.jar orb-iiop.zip https://github.com/payara/Payara/files/51469/orb-iiop.zip

— Reply to this email directly or view it on GitHub https://github.com/payara/Payara/issues/535#issuecomment-161822525 .Image removed by sender.

smillidge commented 8 years ago

4.1.1.161 wont be released until the end of January 2016. Pre-release builds are available here built by Jenkins. http://www.payara.fish/upstream_builds However we are having Jenkins trouble at the moment so these are not up to date.