Open Blavo opened 1 year ago
G'day,
Issue #24541 was that a context lookup() from an embedded glassfish app failed on a reference to method removed at Java 9. The fix to #24541 was a new glassfish-embedded-all.jar. I expected that with the fix in place that issue would revert to this one ie that issue was masking this one (whose reproducer has a bypass for the issue in the class path). That didn't happen - the lookup() actually worked with the fix in place. That led me to wonder if the fix fixed this issue as well.
So I applied the fix to #24541 to my copy of the reproducer for this issue by substituting the supplied glassfish-embedded-all.jar for glassfish-embedded-all-7.0.6.jar and removing pfl-basic-4.1.2 from the class path. The change had no effect.
There is one obvious difference between #24541 and this issue. In the former we use a short cut - we do the lookup() from a normal Java application with an embedded-all JAR in the class path. In the past that has been reliable in reproducing errors that occur in embedded glassfish apps and simplifies the reproducer. In the reproducer for this issue we don't use the short cut - we actually deploy a very simple app to an embedded glassfish.
This issue has been marked as inactive and old and will be closed in 7 days if there is no further activity. If you want the issue to remain open please add a comment
G’day,
Alexander Pincuk fixed issue #24522 and made a build available to me for testing. The test was successful and I presume the fix is in line for the next build (7.0.17 ?).
The link to his build no longer works but presumably the build, or one that incorporates it, still exists.
I suggest it would be worth retrying this issue on that build since the two issues are in the same area.
Otherwise, yes, I would like the issue left open.
Ian Blavins 0408 848 548
On 22 Aug 2024, at 10:21, github-actions[bot] @.***> wrote:
This issue has been marked as inactive and old and will be closed in 7 days if there is no further activity. If you want the issue to remain open please add a comment
— Reply to this email directly, view it on GitHub https://github.com/eclipse-ee4j/glassfish/issues/24548#issuecomment-2303336654, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKL4EMMFCSCNHQTWOSCG4TZSUVH5AVCNFSM6AAAAABM5BKOUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBTGMZTMNRVGQ. You are receiving this because you authored the thread.
Hi @Blavo,
Try with the latest master, please:
https://ci.eclipse.org/glassfish/job/glassfish_build-and-test-using-jenkinsfile/job/master/1524/artifact/bundles/glassfish.zip https://ci.eclipse.org/glassfish/job/glassfish_build-and-test-using-jenkinsfile/job/master/1524/artifact/embedded/glassfish-embedded-all.jar
G’day,
The problem reproducer has two parts:
it runs LookerUpper (from a class library) to do a direct context lookup against a running glassfish bean ie a lookup from outside embedded glassfish; this is expected to work and is intended to show that the bean being looked up is present in the target web app
it then runs embedded glassfish which in turn runs LookerUpper; since the lookup details are hard coded into LookerUpper this does exactly the same lookup against the same running glassfish; this is expected to fail with a naming exception saying the target is not found - thus demonstrating the problem described in #24548
Using the target libraries you supplied both parts now fail with the second part failing in a different way than expected.
the direct lookup fails with: Could not initialize access to ClassLoader.defineClass method; (see StackTrace1 attached)
the lookup from embedded glassfish fails because there are no org.apache.derby.client classes in the supplied embedded glassfish jar; the actual class not found is org.apache.derby.client.ClientAutoloadedDriver; the corresponding embedded glassfish JAR in 7.0.12 doesn’t contain the org.apache.derby.client classes either so under 7.0.12 they are either coming from somewhere else (not likely) or aren’t used; (see StackTrace2 attached)
Ian Blavins 0408 848 548
On 22 Aug 2024, at 16:15, Alexander Pinčuk @.***> wrote:
Hi @Blavo https://github.com/Blavo,
Try with the latest master, please:
https://ci.eclipse.org/glassfish/job/glassfish_build-and-test-using-jenkinsfile/job/master/1524/artifact/bundles/glassfish.zip https://ci.eclipse.org/glassfish/job/glassfish_build-and-test-using-jenkinsfile/job/master/1524/artifact/bundles/glassfish.zip https://ci.eclipse.org/glassfish/job/glassfish_build-and-test-using-jenkinsfile/job/master/1524/artifact/embedded/glassfish-embedded-all.jar https://ci.eclipse.org/glassfish/job/glassfish_build-and-test-using-jenkinsfile/job/master/1524/artifact/embedded/glassfish-embedded-all.jar — Reply to this email directly, view it on GitHub https://github.com/eclipse-ee4j/glassfish/issues/24548#issuecomment-2303865912, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOKL4EKMARIORXVZHPRXKRLZSV6XTAVCNFSM6AAAAABM5BKOUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBTHA3DKOJRGI. You are receiving this because you were mentioned.
@. ~ % java -jar "/Users/ian/Desktop/Development/ProblemReproducers/Glassfish 7/Open/GF7RemoteBeanLookup 24548/TestRepeatedEmbeddedLookups/dist/TestRepeatedEmbeddedLookups.jar"
Instantiated lookerUpper
Aug 26, 2024 8:48:35 PM com.sun.enterprise.v3.server.CommonClassLoaderServiceImpl findDerbyClient
INFO: Cannot find javadb client jar file, derby jdbc driver will not be available by default.
Set up naming context
Lookup string is: java:global/TestProblem24548WebApp/CommentBeanRemote!q.simpleGF7WebAppInterfaces.CommentServiceRemote
Aug 26, 2024 8:48:36 PM org.glassfish.enterprise.iiop.impl.GlassFishORBManager getORB
INFO: ORB initialization succeeded: @.
java.lang.Error: Could not initialize access to ClassLoader.defineClass method.
at com.sun.ejb.codegen.ClassGenerator.
@. ~ % java -jar "/Users/ian/Desktop/Development/ProblemReproducers/Glassfish 7/Open/GF7RemoteBeanLookup 24548/TestRepeatedEmbeddedLookups/dist/TestRepeatedEmbeddedLookups.jar"
Instantiated glassfish run time
Aug 26, 2024 8:50:30 PM com.sun.enterprise.v3.server.CommonClassLoaderServiceImpl findDerbyClient
INFO: Cannot find javadb client jar file, derby jdbc driver will not be available by default.
Instantiated glassfish server
Aug 26, 2024 8:50:30 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start0
INFO: Grizzly Framework 4.0.2 started in: 14 ms - bound to [/0.0.0.0:9080]
Aug 26, 2024 8:50:30 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start0
INFO: Grizzly Framework 4.0.2 started in: 0 ms - bound to [/0.0.0.0:9181]
Aug 26, 2024 8:50:30 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start0
INFO: Grizzly Framework 4.0.2 started in: 0 ms - bound to [/0.0.0.0:9848]
Aug 26, 2024 8:50:30 PM com.sun.enterprise.security.auth.realm.Realm doInstantiate
INFO: Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
Aug 26, 2024 8:50:30 PM com.sun.enterprise.security.auth.realm.Realm doInstantiate
INFO: Realm [file] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
Aug 26, 2024 8:50:30 PM com.sun.enterprise.security.auth.realm.Realm doInstantiate
INFO: Realm [certificate] of classtype [com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created.
Aug 26, 2024 8:50:30 PM org.glassfish.security.services.impl.authorization.AuthorizationServiceImpl initialize
INFO: Authorization Service has successfully initialized.
Aug 26, 2024 8:50:30 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start0
INFO: Grizzly Framework 4.0.2 started in: 0 ms - bound to [/0.0.0.0:9700]
Aug 26, 2024 8:50:30 PM com.sun.enterprise.v3.server.AppServerStartup postStartupJob
INFO: GlassFish (commit: null) startup time: Embedded (312 ms), startup services (270 ms), total (582 ms)
Aug 26, 2024 8:50:30 PM com.sun.enterprise.connectors.jms.util.JmsRaUtil getInstalledMqVersion
WARNING: Check for a new version of MQ installation failed : /var/folders/gs/rbhbh1nx6vb0gcbtg13yfjjm0000gn/T/gfembed2559384503653078658tmp/lib/install/applications/jmsra/../imqjmsra.rar:/var/folders/gs/rbhbh1nx6vb0gcbtg13yfjjm0000gn/T/gfembed2559384503653078658tmp/lib/install/applications/jmsra/imqjmsra.rar
Aug 26, 2024 8:50:30 PM com.sun.enterprise.v3.services.impl.GrizzlyProxy start0
INFO: Grizzly Framework 4.0.2 started in: 0 ms - bound to [/0.0.0.0:9676]
Started glassfish server
Instantiated deployer
Aug 26, 2024 8:50:30 PM org.glassfish.admin.mbeanserver.JMXStartupService$JMXConnectorsStarterThread startConnector
INFO: JMXStartupService has started JMXConnector on JMXService URL service:jmx:rmi://192-168-1-111.tpgi.com.au:9686/jndi/rmi://192-168-1-111.tpgi.com.au:9686/jmxrmi
Aug 26, 2024 8:50:30 PM org.hibernate.validator.internal.util.Version
Aug 26, 2024 8:50:31 PM org.glassfish.web.loader.WebappClassLoader close INFO: close(), this: @.***[name=TestProblem24548WebApp], urls=[ file:/private/var/folders/gs/rbhbh1nx6vb0gcbtg13yfjjm0000gn/T/gfembed2559384503653078658tmp/applications/TestProblem24548WebApp/WEB-INF/classes/ file:/private/var/folders/gs/rbhbh1nx6vb0gcbtg13yfjjm0000gn/T/gfembed2559384503653078658tmp/applications/TestProblem24548WebApp/WEB-INF/lib/TestProblem24548Interfaces.jar file:/private/var/folders/gs/rbhbh1nx6vb0gcbtg13yfjjm0000gn/T/gfembed2559384503653078658tmp/applications/TestProblem24548WebApp/WEB-INF/lib/TestProblem24548LookerUpper.jar file:/var/folders/gs/rbhbh1nx6vb0gcbtg13yfjjm0000gn/T/gfembed2559384503653078658tmp/generated/ejb/TestProblem24548WebApp/ ][delegate=true, context=TestProblem24548WebApp, status=RUNNING, antiJARLocking=false, securityManager=false, packageDefinitionSecurityEnabled=false, repositories=RepositoryManager[WEB-INF/classes/], notFound.size=46, pathTimestamps.size=5, resourceEntryCache.size=5] Aug 26, 2024 8:50:31 PM org.glassfish.deployment.admin.DeployCommand execute SEVERE: org/apache/derby/client/ClientAutoloadedDriver java.lang.ClassNotFoundException: org.apache.derby.client.ClientAutoloadedDriver at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150) at java.base/jdk.internal.loader.BuiltinClassLoader.defineClass(BuiltinClassLoader.java:862) at java.base/jdk.internal.loader.BuiltinClassLoader.findClassOnClassPathOrNull(BuiltinClassLoader.java:760) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull(BuiltinClassLoader.java:681) at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:639) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520) at java.base/java.lang.Class.forName0(Native Method) at java.base/java.lang.Class.forName(Class.java:467) at java.sql/java.sql.DriverManager.ensureDriversInitialized(DriverManager.java:635) at java.sql/java.sql.DriverManager.drivers(DriverManager.java:440) at org.glassfish.web.loader.ReferenceCleaner.clearReferencesJdbc(ReferenceCleaner.java:95) at org.glassfish.web.loader.ReferenceCleaner.clearReferences(ReferenceCleaner.java:74) at org.glassfish.web.loader.WebappClassLoader.close(WebappClassLoader.java:1140) at org.glassfish.web.loader.WebappClassLoader.preDestroy(WebappClassLoader.java:1196) at org.glassfish.deployment.common.DeploymentContextImpl.preDestroy(DeploymentContextImpl.java:164) at com.sun.enterprise.v3.server.ApplicationLifecycle$2.actOn(ApplicationLifecycle.java:311) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:555) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:257) at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:471) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:574) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:570) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/javax.security.auth.Subject.doAs(Subject.java:376) at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:569) at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:600) at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:592) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/javax.security.auth.Subject.doAs(Subject.java:376) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:591) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1484) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1862) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1738) at com.sun.enterprise.admin.cli.embeddable.DeployerImpl.deploy(DeployerImpl.java:110) at testrepeatedembeddedlookups.TestRepeatedEmbeddedLookups.main(TestRepeatedEmbeddedLookups.java:66)
Exception in thread "main" java.lang.RuntimeException: Failed to deploy app at testrepeatedembeddedlookups.TestRepeatedEmbeddedLookups.main(TestRepeatedEmbeddedLookups.java:68)
If I deploy a very simple web app to an embedded glassfish based on glassfish-embedded-all-7.0.6.jar, and that app does a context lookup() to lookup, say, a remote EJB, the lookup will fail with a javax.naming.NamingException saying that the name is not found; this assumes that the bypass in #24541 has been applied to the calling app (otherwise the error in #24541 will occur)
Environment Details
Glassfish 7.0.6 java version "17.0.7" 2023-04-18 LTS Java(TM) SE Runtime Environment (build 17.0.7+8-LTS-224) Java HotSpot(TM) 64-Bit Server VM (build 17.0.7+8-LTS-224, mixed mode, sharing) Mac OS 12.4 Monterey Database not applicable
Problem Description
So, I have a stand alone (non-enterprise client) app. I run the app with the bypass for #24541 in place. The app does a context lookup() against some running glassfish server. This works. The app then starts glassfish embedded and deploys a very simple web app to the embedded glassfish. (Currently that app can't have any EJBs, or it won't deploy - see #24521). The app does exactly the same context lookup(). The lookup() fails saying the name isn't found. Since the lookup() already worked outside embedded glassfish it should work from within embedded glassfish.
The problem is reliably reproducible.
Steps to reproduce
1 Start a convenient glassfish that has a remote EJB for which the class definition is available in a JAR 2 Obtain the JNDI name for the remote reference to the chosen EJB from the glassfish log 3 Put that JNDI name as the value of 'lookupString' in the attached LookerUpper source 4 Compile LookerUpper as a class library 5 Compile the attached WebApp as a web application with the EJB JAR and the LookerUpper JAR in the compile class path 6 Obtain the path to the .war file produced in the above step 7 Change the value of 'warPath' in the attached TestRepeatedEmbeddedLookups source to the path from above 8 Copy the domain.xml file from the above glassfish somewhere convenient 9 Change the following ports in the copied domain XML file to avoid clashes with the running glassfish:
For extra credit
This issue probably masks another (as it was masked by #24541) - see Payara/payara #6299. Rather than wait for the solution for this one to be delivered before testing the potentially masked issue I mention it here so the two can be resolved at the same time.
To provided a test of the masked issue the reproducer for this one does 50 lookup()s , not just the one that would be enough to demonstrate the issue raised here,
The masked issue is that after 'sufficient' lookup() calls being received from the one client a server will switch to a faster, but less debuggable, implementation of the lookup. In the payara issue this 2nd implementation reliably fails with a ClassCastException. So, if after resolving the issue raised here, you find that some, but not all, of the lookup()s done by the web app succeed with the remainder failing with a ClassCastException, then you have demonstrated the masked issue (and you have a reproducer).
Impact of Issue
I intend to offer two alternate configurations of my project to my intended customers - one that runs as a remote client of a non-embedded server and (the preferred one) that runs as a client of an embedded server. I can continue development using the former but at some stage I will need a fix to this before I can resume QA of, and ship, the latter.
LookerUpper.txt StackTrace.txt WebApp.txt TestRepeatedEmbeddedLookups.txt