Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2657

Weld creates invalid proxy for EJB classes in default package

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 4.0.1.Final, 3.1.7.Final
    • 3.1.6.Final, 4.0.0.Final
    • Proxies
    • None
    • Hide

      Create a jar with the following two classes:

      import jakarta.ejb.Remote;
      
      @Remote
      public interface Foo {
          String hello();
      }
      
      import jakarta.ejb.Stateless;
      
      @Stateless
      public class SlessEJB implements Foo {
          public String hello() {
                return null;
          }
      }
      

      Deploy to a Jakarta EE server running on JDK 11 using Weld 4.0.0.Final, for instance GlassFish 6.1.0-SNAPSHOT.

      Show
      Create a jar with the following two classes: import jakarta.ejb.Remote; @Remote public interface Foo { String hello(); } import jakarta.ejb.Stateless; @Stateless public class SlessEJB implements Foo { public String hello() { return null ; } } Deploy to a Jakarta EE server running on JDK 11 using Weld 4.0.0.Final, for instance GlassFish 6.1.0-SNAPSHOT.
    • Undefined

    Description

      On GlassFish 6.1.0-SNAPSHOT under JDK 11, which uses Weld 4.0.0.Final, deploying something as minimal as a .jar with only a single EJB and an interface in it, results in the following exception:

       

      java.lang.ClassFormatError: Illegal class name "/Sless$365510969$Proxy$_$$_Weld$EnterpriseProxy$" in class file /Sless$365510969$Proxy$_$$_Weld$EnterpriseProxy$
      	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
      	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      	at org.jboss.weld.util.bytecode.ClassFileUtils.toClass2(ClassFileUtils.java:143)
      	at org.jboss.weld.util.bytecode.ClassFileUtils.toClass(ClassFileUtils.java:112)
      Caught: java.lang.RuntimeException: java.lang.ClassFormatError: Illegal class name "/Sless$365510969$Proxy$_$$_Weld$EnterpriseProxy$" in class file /Sless$365510969$Proxy$_$$_Weld$EnterpriseProxy$
      	at org.jboss.weld.util.bytecode.ClassFileUtils.toClass(ClassFileUtils.java:116)
      	at org.jboss.weld.bean.proxy.ProxyFactory.createProxyClass(ProxyFactory.java:481)
      	at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:370)
      Caught: org.jboss.weld.exceptions.WeldException: WELD-001524: Unable to load proxy class for bean Session bean [class SlessEJB with qualifiers [@Any @Default]; local interfaces are [] with class class SlessEJB
      	at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:378)
      	at org.jboss.weld.module.ejb.SessionBeanProxyInstantiator.<init>(SessionBeanProxyInstantiator.java:48)
      	at org.jboss.weld.module.ejb.SessionBeanImpl.initializeAfterBeanDiscovery(SessionBeanImpl.java:283)
      	at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:111)
      	at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$AfterBeanDiscoveryInitializerFactory.doWork(ConcurrentBeanDeployer.java:102)
      	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:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

       

      Moving the EJB and its interface to a package solves the problem, but this still seems like a regression. On GlassFish 6.0.0 using Weld 4.0.0.Final as well, but running on JDK 8 the exception did not seem to happen.

      See also https://github.com/eclipse-ee4j/glassfish/issues/23371

       

       

      Attachments

        Activity

          People

            manovotn Matěj Novotný
            arjan.tijms@gmail.com Arjan Tijms (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: