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

Deployment of EAR with Remote EJBs doesn't work #25054

Open
chicko12345 opened this issue Jul 17, 2024 · 2 comments
Open

Deployment of EAR with Remote EJBs doesn't work #25054

chicko12345 opened this issue Jul 17, 2024 · 2 comments

Comments

@chicko12345
Copy link

chicko12345 commented Jul 17, 2024

Deployment of EAR with Remote EJBs doesn't work

Hello Community,

first of all - thank you for your work. Since the glassfish AS development was moved to Eclipse, the progress is on another level. Kudos to you!

Environment Details

  • GlassFish Version 7.0.15:
  • JDK version 17:
  • OS Windows:
  • Database Oracle/Postgres:

Problem Description

We're trying to migrate our application from glassfish 5.1.0 to the current version (7.0.15)
Unfortunately the deployment of our EAR fails because several Remote EJBs cannot be found by the ejb-container.
We've tried to track the problem down and found the commit, which has changed the behaviour of the ejb-container in such way, that the deployment fails:
Commit HASH: 6fbf895
Commit Message: Fixes generated EJB remote interfaces loading
Class com.sun.ejb.codegen.ClassGenerator

Just one code line was replaced by this commit in the method:

private static boolean useMethodHandles(final ClassLoader loader, final Class<?> anchorClass,
final String targetPackageName)

old version:
return Objects.equals(targetPackageName, anchorClass.getPackageName());
new version:
return Objects.equals(anchorClass.getPackage(), loader.getDefinedPackage(targetPackageName));

To be sure, that was the only cause, we've reverted this commit, built the ejb-container locally and the application can be deployed without any further problems.

Our Remote EJB Interfaces and the corresponding implementations are parts of different jars within the EAR. The package names of the Remote EJB Interfaces and their implementation can also differ. The partition is done to provide Remote EJB Interface definitions to other remote service consumer applications in the minimal way.

Kind Regards

@chicko12345 chicko12345 changed the title Remote EJB injection EAR deployment with Remote EJBs doesn't work Jul 17, 2024
@chicko12345 chicko12345 changed the title EAR deployment with Remote EJBs doesn't work Deployment of EAR with Remote EJBs doesn't work Jul 17, 2024
@avpinchuk
Copy link
Contributor

Hi, @chicko12345.

Could you please provide the stack traces from the server.log? And, if possible, more information on how to reproduce the problem.

Thanks.

@chicko12345
Copy link
Author

chicko12345 commented Nov 5, 2024

Hi, @chicko12345.

Could you please provide the stack traces from the server.log? And, if possible, more information on how to reproduce the problem.

Thanks.

Hi, @avpinchuk,

sorry for the very late answer. Other projects + wanted to create an example to provide something reproducible without the copy of productive code :-D.

https://github.com/chicko12345/remote-ejb-test.git

The problem seems to be related to the signing of packages.
here:
https://github.com/chicko12345/remote-ejb-test/blob/feature/EJB_SIGN_PROBLEM/remote-ejb-interface/pom.xml
and here:
https://github.com/chicko12345/remote-ejb-test/blob/feature/EJB_SIGN_PROBLEM/remote-ejb-problem/pom.xml
the packages are signed with usage of a jks store.

if <jarsigner.skip>false</jarsigner.skip> the resulting ear cannot be deployed to glassfish.
Without signing(<jarsigner.skip>true</jarsigner.skip>) is all good.

The log contains in case of failed deployment:

`[#|2024-11-05T13:58:20.681333Z|SEVERE|GF 7.0.15|jakarta.enterprise.system.core|_ThreadID=55;_ThreadName=admin-listener(5);_LevelValue=1000;|
Exception while loading the app|#]

[#|2024-11-05T13:58:20.702327Z|SEVERE|GF 7.0.15|jakarta.enterprise.system.core|_ThreadID=55;_ThreadName=admin-listener(5);LevelValue=1000;|
Exception while loading the app : CDI deployment failure:WELD-001524: Unable to load proxy class for bean Session bean [class org.problem.example.TestEjbBean with qualifiers [@Any @default]; local interfaces are [] with class class org.problem.example.TestEjbBean
org.jboss.weld.exceptions.WeldException: WELD-001524: Unable to load proxy class for bean Session bean [class org.problem.example.TestEjbBean with qualifiers [@Any @default]; local interfaces are [] with class class org.problem.example.TestEjbBean
at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:421)
at org.jboss.weld.module.ejb.SessionBeanProxyInstantiator.(SessionBeanProxyInstantiator.java:48)
at org.jboss.weld.module.ejb.SessionBeanImpl.initializeAfterBeanDiscovery(SessionBeanImpl.java:294)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:113)
at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:104)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:62)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:55)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.glassfish.weld.services.WeldProxyException: Could not define class org.example.IRemoteEjbInterface$558338582$Proxy$
$$Weld$EnterpriseProxy$
at org.glassfish.weld.services.ProxyServicesImpl.defineClass(ProxyServicesImpl.java:137)
at org.glassfish.weld.services.ProxyServicesImpl.defineClass(ProxyServicesImpl.java:67)
at org.jboss.weld.bean.proxy.ProxyFactory.toClass(ProxyFactory.java:968)
at org.jboss.weld.bean.proxy.ProxyFactory.createProxyClass(ProxyFactory.java:509)
at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:413)
... 10 more
Caused by: com.sun.ejb.codegen.ClassGenerator$ClassDefinitionException: Could not define class 'org.example.IRemoteEjbInterface$558338582$Proxy$
$$_Weld$EnterpriseProxy$' by the class loader: EarClassLoader :
urlSet = [URLEntry : file:/C:/TEMP/_glassfish_7.0.15/glassfish/domains/domain1/applications/remote-ejb-ear-1.0.0-SNAPSHOT/remote-ejb-problem_jar/, URLEntry : file:/C:/TEMP/_glassfish_7.0.15/glassfish/domains/domain1/generated/ejb/remote-ejb-ear-1.0.0-SNAPSHOT/remote-ejb-problem_jar]
doneCalled = false
Parent -> org.glassfish.internal.api.DelegatingClassLoader@686cb581

    at com.sun.ejb.codegen.ClassGenerator.lambda$defineClass$3(ClassGenerator.java:208)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
    at com.sun.ejb.codegen.ClassGenerator.defineClass(ClassGenerator.java:211)
    at org.glassfish.weld.services.ProxyServicesImpl.defineClass(ProxyServicesImpl.java:135)
    ... 14 more

Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at com.sun.ejb.codegen.ClassGenerator.lambda$defineClass$3(ClassGenerator.java:206)
... 17 more
Caused by: java.lang.SecurityException: class "org.example.IRemoteEjbInterface$558338582$Proxy$_$$_Weld$EnterpriseProxy$"'s signer information does not match signer information of other classes in the same package
at java.base/java.lang.ClassLoader.checkCerts(ClassLoader.java:1158)
at java.base/java.lang.ClassLoader.preDefineClass(ClassLoader.java:902)
at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1010)
... 21 more
|#]`

Hope, it is enough to understand our problem.

Kind Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants