Bug Report: Payara 6.2023.2 + JDK 17 + Remote EJB JNDI look up fails from local instance/FISH-7217
Brief Summary
If you deploy a remote ejb on one Payara instance and try to access it from another Payara instance on the same machine, the JNDI look up fails. However, the same look up works using a standalone Java client.
Expected Outcome
The JNDI look up should work from another Payara instance.
Current Outcome
[2023-02-27T13:29:47.030+0530] [Payara 6.2023.2] [SEVERE] [] [] [tid: _ThreadID=82 _ThreadName=http-thread-pool::http-listener-1(2)] [timeMillis: 1677484787030] [levelValue: 1000] [[ javax.naming.CommunicationException: Communication exception for SerialContext[myEnv={org.omg.CORBA.ORBInitialPort=7001, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory, java.naming.factory.url.pkgs=com.sun.enterprise.naming, org.omg.CORBA.ORBInitialHost=localhost} [Root exception is java.lang.NullPointerException: Cannot invoke "com.sun.enterprise.naming.impl.SerialContextProvider.lookup(String)" because "prvdr" is null] at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:518) at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:442) at java.naming/javax.naming.InitialContext.lookup(InitialContext.java:409) at java.naming/javax.naming.InitialContext.lookup(InitialContext.java:409) at com.test.web.MyServlet.lookUpTest(MyServlet.java:51) at com.test.web.MyServlet.doGet(MyServlet.java:26) at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:527) at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:614) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1569) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:259) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:166) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:757) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:577) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:158) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:372) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:239) at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:520) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:217) at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:174) at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:153) at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:196) at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:88) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:246) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:178) at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:118) at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:96) at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:51) at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:510) at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:82) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:83) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:101) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:535) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:515) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: java.lang.NullPointerException: Cannot invoke "com.sun.enterprise.naming.impl.SerialContextProvider.lookup(String)" because "prvdr" is null at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:483) ... 34 more ]]
Reproducer
I have attached the source code of a test application using ant - https://github.com/vibhav72/-Payara-6.2023.2-JNDI-Issue.
To run the test application first the GLASSFISH_HOME evnironmental variable should be set up.
To run
- ant setup - basically creates a new 'test' domain sets up the 2 local payara instances namely 'applicationServer' and 'webServer'
-
Create the domain - %GLASSFISH_HOME%/bin/asadmin.bat --user test-user --passwordfile server_password.txt create-domain --adminport 4848 --instanceport 800 --domainproperties orb.listener.port=3705:jms.port=7677 test
-
Create the Application Server - %GLASSFISH_HOME%/bin/asadmin.bat --user test-user --passwordfile server_password.txt create-instance --node localhost-test --systemproperties IIOP_LISTENER_PORT=7001:HTTP_LISTENER_PORT=7000:JMS_PROVIDER_PORT=7676 applicationServer
-
Create the Web Server - %GLASSFISH_HOME%/bin/asadmin.bat --user test-user --passwordfile server_password.txt create-instance --node localhost-test --systemproperties HTTP_LISTENER_PORT=8080:JMS_PROVIDER_PORT=7678 webServer
-
ant compile - Compiles the code into build directory.
-
ant deploy - Deploys EJB on 'applicationServer' and servlet on 'webServer'
-
Deploy to the application server - %GLASSFISH_HOME%/bin/asadmin.bat --user test-user --passwordfile server_password.txt deploy --force=true --upload=false --target applicationServer app-ejb
-
Deploy to the web server - %GLASSFISH_HOME%/bin/asadmin.bat --user test-user --passwordfile server_password.txt deploy --force=true --upload=false --target webServer app-web
To test
-
Hit this URL in any browser - http://localhost:8080/app-web/myservlet. Note - this will generate the above stack trace
-
From build directory run below command in the command prompt. Note -this works without any issue. java --add-opens=java.base/java.lang=ALL-UNNAMED -cp .;c:\jeeServer\glassfish\lib\gf-client.jar; com.test.client.JNDILookUpTest
Operating System
Windows 10 Enterprise Version 21H2
JDK Version
Open JDK 17
Payara Distribution
Payara Server Full Profile
Hello @vibhav72,
Thank you for reporting this issue. I am able to reproduce it using your application without a problem. The only issue I found is understanding what the file in c:\jeeServer\glassfish\lib\gf-client.jar refers to. Is this the gf-client from Payara 6, or is it from a version of Glassfish?
Thank you @felixif for having a look.
Yes gf-client.jar is from Payara 6 located at c:\Payara\glassfish\lib. I just renamed the c:\Payara to c:\jeeServer.
Hello @vibhav72.
I'm sorry for not getting back to you sooner. I went back to the application, and managed to run the 2nd part of the reproducer as well, and I can confirm that it works. I have raised a new internal issue named FISH-7217 and will update this issue when a fix is released. Thank you very much for your report!
Thank you @felixif for confirming.
G'day,
I get the '"prvdr" is null' issue also, running against Payara Server 6.2023.6. But I get it in a stand alone Java program rather than another instance of Payara. The description of the problem (6214) says this shouldn't happen. And FISH-6027 (against Payara 5) says the inclusion of --add-opens=java.base/java.lang=ALL-UNNAMED in the command that runs the client fixes the issue. (I have included this though I suspect it is not needed for Payara 6.)
I suspect the reason I get this in a stand alone program is that I get access to the necessary classes to do the lookup by including payara-embedded-all-6.2023.6.jar in my class path. So effectively I am doing a lookup from another Payara instance as a result. If vibhva72 cares to advise what JARs he had in the class path of his standalone program I will run with those JARs instead of the embedded Payara 6 JAR with the expectation that the problem will go away.
Hi @Blavo,
I only had c:\Payara6\glassfish\lib\gf-client.jar in the class path for the stand alone program.
G'day,
As expected, when I removed payara-embedded-all-6.2023.6.jar from my stand alone program's class path and replaced it with gf-client.jar from the payara 6 install, the problem went away. (I didn't actually do a successful lookup because the bean being sought isn't in the target because the latest NetBeans (18) can't yet deploy to JEE 10, so I can't deploy the application with the beans to the target yet.)
G'day,
If its convenient could you see if you can reproduce #6338. It seems so unlikely that it would be good to have confirmation and you appear to have the set up to do it conveniently.