Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FISH-10049 bugfix: Split CDI bean deployment when multiple WARs exist in an EAR #7032

Merged
merged 1 commit into from
Feb 10, 2025

Conversation

lprimak
Copy link
Contributor

@lprimak lprimak commented Oct 18, 2024

Description

Bugfix. BeanManager isn't properly constructed when multiple CDI WARs exist in an EAR.
Also allows EAR-libraries to be scanned for CDI annotations

fixes #7031
also fixes #7078
Appears specifically when multiple WARs use OmniFaces

Important Info

This is the head PR in the CDI-performance and modernization sequence.
PRs #7165 and #7097 depend on this PR

Testing

Tested with the failing reproducer
** Needs TCK run

@lprimak
Copy link
Contributor Author

lprimak commented Oct 28, 2024

@Pandrex247 Do you think you can run the TCK against this PR?
I'd like to make sure I didn't break anything.

Thank you!

@lprimak lprimak changed the title bugfix: passing BeanManager in EAR deployment's invocation state object bugfix: Split CDI bean deployment when multiple WARs exist in an EAR Oct 28, 2024
@Pandrex247
Copy link
Member

@lprimak I ran it through the CDI and EJB TCKs and all seems green 👍

@lprimak
Copy link
Contributor Author

lprimak commented Oct 28, 2024

Thanks, Fantastic!
I gotta do a lot more testing on my end, but this is promising!

@lprimak
Copy link
Contributor Author

lprimak commented Nov 10, 2024

I have found a few issues that I found with "real" applications.
I think I worked through most of them, so stay tuned

@lprimak
Copy link
Contributor Author

lprimak commented Nov 10, 2024

I may also roll a fix for #6405 if that's trivial as well

@lprimak lprimak force-pushed the cdi-ear-exception branch 2 times, most recently from 89ef769 to 4a79348 Compare November 19, 2024 22:49
@lprimak
Copy link
Contributor Author

lprimak commented Nov 21, 2024

Im getting close. "Real" application runs.

@lprimak lprimak marked this pull request as ready for review November 26, 2024 20:17
@lprimak
Copy link
Contributor Author

lprimak commented Nov 26, 2024

Ready to go. Will do #6405 in a separate PR

@lprimak
Copy link
Contributor Author

lprimak commented Nov 27, 2024

Now I gotta fix the conflict :)

@lprimak lprimak marked this pull request as draft November 27, 2024 22:21
@lprimak
Copy link
Contributor Author

lprimak commented Nov 27, 2024

Once the tests passes I am going to squash the commits and un-draft the PR again

@lprimak lprimak marked this pull request as ready for review November 28, 2024 00:08
@lprimak
Copy link
Contributor Author

lprimak commented Nov 28, 2024

Ready to go again

@Pandrex247 Pandrex247 changed the title bugfix: Split CDI bean deployment when multiple WARs exist in an EAR FISH-10049 bugfix: Split CDI bean deployment when multiple WARs exist in an EAR Dec 5, 2024
@lprimak lprimak force-pushed the cdi-ear-exception branch 2 times, most recently from 975cb97 to a4f4f36 Compare December 12, 2024 04:15
@lprimak
Copy link
Contributor Author

lprimak commented Jan 20, 2025

This one is the head of the backlog now

@luiseufrasio
Copy link
Contributor

jenkins test please

@luiseufrasio
Copy link
Contributor

@lprimak I tried to run jenkins test again after your last update and it is not working

@lprimak
Copy link
Contributor Author

lprimak commented Jan 31, 2025

The conflicts arose due to merging of #7163
I believe that's fixed now

Copy link
Contributor

@luiseufrasio luiseufrasio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lprimak I had 2 issues:

  1. I could not build the reproducer on Windows 11, only on WSL (Ubuntu 22.04):
    image

  2. The deploy of ear1-1.x-SNAPSHOT.ear built in WSL works when running Payara Server on Windows 11 and on WSL, but when I launch the war applications it only works on WSL. On Windows 11 I had HTTP 500 error:
    image

@lprimak
Copy link
Contributor Author

lprimak commented Feb 4, 2025

I don't have windows so I really can't do anything about that. Not sure what the issue even may be

@lprimak
Copy link
Contributor Author

lprimak commented Feb 4, 2025

Reproducer builds fine on Windows, as it looks like, but it won't run.
Use -Ppayara-server-local to skip payara startup.

As far as 500 error, I have no idea as I don't have windows. Do you have an exception at least?
I may need your help reproducing this if it's not trivial.

@luiseufrasio
Copy link
Contributor

These are the log server, but it is not related to your application:

[#|2025-02-04T18:02:18.266-0300|INFO|Payara 6.2025.2|javax.enterprise.system.core|_ThreadID=245;_ThreadName=admin-thread-pool::admin-listener(2);_TimeMillis=1738702938266;_LevelValue=800;|
  ear1-1.x-SNAPSHOT was successfully deployed in 8,775 milliseconds.|#]

[#|2025-02-04T18:02:18.564-0300|SEVERE|Payara 6.2025.2|org.glassfish.admingui.common.util.JerseyRestResponse|_ThreadID=245;_ThreadName=admin-thread-pool::admin-listener(2);_TimeMillis=1738702938564;_LevelValue=1000;|
  Unsupported Response Format: 'text/html;charset=iso-8859-1'!|#]

[#|2025-02-04T18:02:18.565-0300|SEVERE|Payara 6.2025.2|org.glassfish.admingui|_ThreadID=245;_ThreadName=admin-thread-pool::admin-listener(2);_TimeMillis=1738702938565;_LevelValue=1000;|
  RestResponse.getResponse() gives FAILURE.  endpoint = 'http://local:4848/management/domain/nodes/node/localhost-domain1'; attrs = '{}'|#]

[#|2025-02-04T18:02:18.565-0300|INFO|Payara 6.2025.2|org.glassfish.admingui|_ThreadID=245;_ThreadName=admin-thread-pool::admin-listener(2);_TimeMillis=1738702938565;_LevelValue=800;|
  Exception Occurred :java.lang.RuntimeException: java.lang.RuntimeException: |#]

But a different error occurs when trying to undeploy:

[#|2025-02-04T18:09:26.413-0300|WARNING|Payara 6.2025.2|javax.enterprise.system.util|_ThreadID=299;_ThreadName=admin-thread-pool::admin-listener(4);_TimeMillis=1738703366413;_LevelValue=900;|
  ASURLClassLoader EarLibClassLoader :
doneCalled = true
doneSnapshot = ASURLClassLoader.done() called ON EarLibClassLoader :
urlSet = []
doneCalled = false
 Parent -> org.glassfish.internal.api.DelegatingClassLoader@57bf6309

 AT Tue Feb 04 18:09:26 GFT 2025
 BY :[java.base/java.lang.Thread.getStackTrace(Thread.java:2450), com.sun.enterprise.loader.ASURLClassLoader.done(ASURLClassLoader.java:205), com.sun.enterprise.loader.ASURLClassLoader.preDestroy(ASURLClassLoader.java:171), org
.glassfish.javaee.full.deployment.EarClassLoader.preDestroy(EarClassLoader.java:122), org.jvnet.hk2.internal.ServiceLocatorImpl.preDestroy(ServiceLocatorImpl.java:1068), org.jvnet.hk2.internal.ServiceLocatorImpl.preDestroy(Serv
iceLocatorImpl.java:1052), org.glassfish.internal.data.ApplicationInfo.clean(ApplicationInfo.java:490), com.sun.enterprise.v3.server.ApplicationLifecycle.unload(ApplicationLifecycle.java:1400), com.sun.enterprise.v3.server.Appl
icationLifecycle.undeploy(ApplicationLifecycle.java:1428), org.glassfish.deployment.admin.UndeployCommand.execute(UndeployCommand.java:431), com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:556), com
.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:552), java.base/java.security.AccessController.doPrivileged(AccessController.java:400), java.base/javax.security.auth.Subject.doAs(Subject.java:453), com
.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:551), com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:582), com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunne
rImpl.java:574), java.base/java.security.AccessController.doPrivileged(AccessController.java:400), java.base/javax.security.auth.Subject.doAs(Subject.java:453), com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRun
nerImpl.java:573), com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1497), com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1879), com.sun.enterprise.v3
.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1755), org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:272), org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.
java:240), org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:294), org.glassfish.admin.rest.resources.TemplateRestResource.runCommand(TemplateRestResource.java:570), org.glassfish.admin.rest.resources.Tem
plateRestResource.doDelete(TemplateRestResource.java:307), org.glassfish.admin.rest.resources.TemplateRestResource.delete(TemplateRestResource.java:190), java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMe
thodHandleAccessor.java:103), java.base/java.lang.reflect.Method.invoke(Method.java:580), org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.
java:52), org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:146), org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.inv
oke(AbstractJavaResourceMethodDispatcher.java:189), org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176), org.glassfish.jer
sey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:93), org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:478), org.glassfis
h.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:400), org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:81), org.glassfish.jersey.server.ServerRuntime$1.run(Se
rverRuntime.java:274), org.glassfish.jersey.internal.Errors$1.call(Errors.java:248), org.glassfish.jersey.internal.Errors$1.call(Errors.java:244), org.glassfish.jersey.internal.Errors.process(Errors.java:292), org.glassfish.jer
sey.internal.Errors.process(Errors.java:274), org.glassfish.jersey.internal.Errors.process(Errors.java:244), org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:266), org.glassfish.jersey.server.Serv
erRuntime.process(ServerRuntime.java:253), org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:696), org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:367)
, org.glassfish.admin.rest.adapter.RestAdapter$2.service(RestAdapter.java:335), org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:189), org.glassfish.admin.rest.adapter.RestManagementAdapter.service(RestMana
gementAdapter.java:66), com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:520), com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:217), org.glassfis
h.grizzly.http.server.HttpHandler.runService(HttpHandler.java:174), org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:153), org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.ja
va:202), org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:88), org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:246), org.glassfish.grizzly.filterchain
.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:178), org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:118), org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultF
ilterChain.java:96), org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:51), org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:510), org.glassfish.grizzly.strategies.Abstra
ctIOStrategy.fireIOEvent(AbstractIOStrategy.java:82), org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:83), org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.ru
n(WorkerThreadIOStrategy.java:101), org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:535), org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:515), java.base/java.lang.Thread.run(Thread.java:1583)] Parent -> org.glassfish.internal.api.DelegatingClassLoader@57bf6309
 was requested to find class org.omnifaces.cdi.eager.EagerBeansRepository after done was invoked from the following stack trace
java.lang.Throwable
        at com.sun.enterprise.loader.ASURLClassLoader.findClassData(ASURLClassLoader.java:791)
        at com.sun.enterprise.loader.ASURLClassLoader.findClass(ASURLClassLoader.java:704)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593)

@lprimak
Copy link
Contributor Author

lprimak commented Feb 4, 2025

Yes, that doesn't look at all related.

@luiseufrasio
Copy link
Contributor

Yes, that doesn't look at all related.

@lprimak forget about the 1st issue regarding Windows 11, It was my local maven repo which was corrupted.

Now please try to reproduce the Undeploy issue on your local, because this one seems to be related to your changes:
image
As you can see in the image above it is very slow and into the logs we have:

[#|2025-02-06T09:47:21.455-0300|WARNING|Payara 6.2025.2|javax.enterprise.system.util|_ThreadID=302;_ThreadName=admin-thread-pool::admin-listener(3);_TimeMillis=1738846041455;_LevelValue=900;|
  ASURLClassLoader EarLibClassLoader :
doneCalled = true
doneSnapshot = ASURLClassLoader.done() called ON EarLibClassLoader :
urlSet = []
doneCalled = false
 Parent -> org.glassfish.internal.api.DelegatingClassLoader@2437c706

 AT Thu Feb 06 09:47:21 GFT 2025
 BY :[java.base/java.lang.Thread.getStackTrace(Thread.java:2450), com.sun.enterprise.loader.ASURLClassLoader.done(ASURLClassLoader.java:205), com.sun.enterprise.loader.ASURLClassLoader.preDestroy(ASURLClassLoader.java:171), org
.glassfish.javaee.full.deployment.EarClassLoader.preDestroy(EarClassLoader.java:122), org.jvnet.hk2.internal.ServiceLocatorImpl.preDestroy(ServiceLocatorImpl.java:1068), org.jvnet.hk2.internal.ServiceLocatorImpl.preDestroy(Serv
iceLocatorImpl.java:1052), org.glassfish.internal.data.ApplicationInfo.clean(ApplicationInfo.java:490), com.sun.enterprise.v3.server.ApplicationLifecycle.unload(ApplicationLifecycle.java:1400), com.sun.enterprise.v3.server.Appl
icationLifecycle.undeploy(ApplicationLifecycle.java:1428), org.glassfish.deployment.admin.UndeployCommand.execute(UndeployCommand.java:431), com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:556), com
.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:552), java.base/java.security.AccessController.doPrivileged(AccessController.java:400), java.base/javax.security.auth.Subject.doAs(Subject.java:453), com
.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:551), com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:582), com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunne
rImpl.java:574), java.base/java.security.AccessController.doPrivileged(AccessController.java:400), java.base/javax.security.auth.Subject.doAs(Subject.java:453), com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRun
nerImpl.java:573), com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1497), com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1879), com.sun.enterprise.v3
.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1755), org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:272), org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.
java:240), org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:294), org.glassfish.admin.rest.resources.TemplateRestResource.runCommand(TemplateRestResource.java:570), org.glassfish.admin.rest.resources.Tem
plateRestResource.doDelete(TemplateRestResource.java:307), org.glassfish.admin.rest.resources.TemplateRestResource.delete(TemplateRestResource.java:190), java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMe
thodHandleAccessor.java:103), java.base/java.lang.reflect.Method.invoke(Method.java:580), org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.
java:52), org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:146), org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.inv
oke(AbstractJavaResourceMethodDispatcher.java:189), org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176), org.glassfish.jer
sey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:93), org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:478), org.glassfis
h.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:400), org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:81), org.glassfish.jersey.server.ServerRuntime$1.run(Se
rverRuntime.java:274), org.glassfish.jersey.internal.Errors$1.call(Errors.java:248), org.glassfish.jersey.internal.Errors$1.call(Errors.java:244), org.glassfish.jersey.internal.Errors.process(Errors.java:292), org.glassfish.jer
sey.internal.Errors.process(Errors.java:274), org.glassfish.jersey.internal.Errors.process(Errors.java:244), org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:266), org.glassfish.jersey.server.Serv
erRuntime.process(ServerRuntime.java:253), org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:696), org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:367)
, org.glassfish.admin.rest.adapter.RestAdapter$2.service(RestAdapter.java:335), org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:189), org.glassfish.admin.rest.adapter.RestManagementAdapter.service(RestMana
gementAdapter.java:66), com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:520), com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:217), org.glassfis
h.grizzly.http.server.HttpHandler.runService(HttpHandler.java:174), org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:153), org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.ja
va:196), org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:88), org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:246), org.glassfish.grizzly.filterchain
.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:178), org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:118), org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultF
ilterChain.java:96), org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:51), org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:510), org.glassfish.grizzly.strategies.Abstra
ctIOStrategy.fireIOEvent(AbstractIOStrategy.java:82), org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:83), org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.ru
n(WorkerThreadIOStrategy.java:101), org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:535), org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:515), java.base/java.lang.Thread.run(Thread.java:1583)] Parent -> org.glassfish.internal.api.DelegatingClassLoader@2437c706
 was requested to find class org.omnifaces.cdi.eager.EagerBeansRepository after done was invoked from the following stack trace
java.lang.Throwable
        at com.sun.enterprise.loader.ASURLClassLoader.findClassData(ASURLClassLoader.java:791)
        at com.sun.enterprise.loader.ASURLClassLoader.findClass(ASURLClassLoader.java:704)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593)
        at com.sun.enterprise.loader.CurrentBeforeParentClassLoader.loadClass(CurrentBeforeParentClassLoader.java:83)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
        at com.sun.enterprise.loader.CachingReflectionUtil.lambda$getClassFromCache$0(CachingReflectionUtil.java:61)
        at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)
        at com.sun.enterprise.loader.CachingReflectionUtil.getClassFromCache(CachingReflectionUtil.java:59)
        at com.sun.enterprise.loader.CacheCleaner.clearOmniFacesCache(CacheCleaner.java:79)
        at com.sun.enterprise.loader.CacheCleaner.clearCaches(CacheCleaner.java:51)
        at com.sun.enterprise.loader.ASURLClassLoader.done(ASURLClassLoader.java:211)
        at com.sun.enterprise.loader.ASURLClassLoader.preDestroy(ASURLClassLoader.java:171)
        at org.glassfish.javaee.full.deployment.EarClassLoader.preDestroy(EarClassLoader.java:122)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.preDestroy(ServiceLocatorImpl.java:1068)
        at org.jvnet.hk2.internal.ServiceLocatorImpl.preDestroy(ServiceLocatorImpl.java:1052)
        at org.glassfish.internal.data.ApplicationInfo.clean(ApplicationInfo.java:490)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.unload(ApplicationLifecycle.java:1400)
        at com.sun.enterprise.v3.server.ApplicationLifecycle.undeploy(ApplicationLifecycle.java:1428)
        at org.glassfish.deployment.admin.UndeployCommand.execute(UndeployCommand.java:431)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:556)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:552)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
        at java.base/javax.security.auth.Subject.doAs(Subject.java:453)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:551)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:582)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:574)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
        at java.base/javax.security.auth.Subject.doAs(Subject.java:453)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:573)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1497)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1879)
        at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1755)
        at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:272)
        at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:240)
        at org.glassfish.admin.rest.utils.ResourceUtil.runCommand(ResourceUtil.java:294)
        at org.glassfish.admin.rest.resources.TemplateRestResource.runCommand(TemplateRestResource.java:570)
        at org.glassfish.admin.rest.resources.TemplateRestResource.doDelete(TemplateRestResource.java:307)
        at org.glassfish.admin.rest.resources.TemplateRestResource.delete(TemplateRestResource.java:190)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:52)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:146)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:189)
        at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:176)
        at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:93)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:478)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:400)
        at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:81)
        at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:274)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:248)
        at org.glassfish.jersey.internal.Errors$1.call(Errors.java:244)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:292)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:274)
        at org.glassfish.jersey.internal.Errors.process(Errors.java:244)
        at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:266)
        at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:253)
        at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:696)
        at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:367)
        at org.glassfish.admin.rest.adapter.RestAdapter$2.service(RestAdapter.java:335)
        at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:189)
        at org.glassfish.admin.rest.adapter.RestManagementAdapter.service(RestManagementAdapter.java:66)
        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:1583)
|#]

@lprimak
Copy link
Contributor Author

lprimak commented Feb 8, 2025

I was able to reproduce the problem. It seems I forgot to re-test my sample app, just more sophisticated ones,
which for some reason, don't have the same issue :) Thanks for checking!
Should be an easy fix. Stay tuned.

…I-enabled library JARs

    - correctly copy BDA sets for each war in EAR
    - Make WAR's CDI beans available in EAR-libs
    - read web-fragment.xml from EAR-libs
    - processing ear-lib manifest
    - de-duplicate BDAs in CDI processing by using LinkedHashSet intead of ArrayList
    - made some structures final (cleanup)
    - fixed ear and concurrent classloader leaks, including refactored reflection caching
@lprimak
Copy link
Contributor Author

lprimak commented Feb 8, 2025

@luiseufrasio Fixed. Thank you

Copy link
Contributor

@luiseufrasio luiseufrasio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Deploy and Undeploy are ok now. I also did the manual tests and they worked well.

@Pandrex247 Pandrex247 merged commit 0f80a5a into payara:main Feb 10, 2025
1 check passed
@lprimak lprimak deleted the cdi-ear-exception branch February 10, 2025 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants