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

ClassFormatError: Illegal class name when using interceptor with JDK9+tomcat

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Do
    • Icon: Minor Minor
    • 3.0.x
    • 3.0.0.Alpha17
    • None

      Got following exception on deploying a servlet application that uses Interceptor to Tomcat+CDI
      apache-tomcat-9.0.0.M17
      weld-servlet-3.0.0.Alpha1.jar
      cdi-api-2.0.Beta1.jar
      javax.inject-1.jar
      javax.annotation-api-1.2.jar
      javax.interceptor-api-1.2.jar
      JDK 9 (tried b138, b143, b153)

      24-Jan-2017 23:05:18.682 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /opt/tomcat/apache-tomcat-9.0.0.M17/webapps/servlet5.war
      24-Jan-2017 23:05:20.043 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
      log4j:WARN No appenders could be found for logger (org.jboss.logging).
      log4j:WARN Please initialize the log4j system properly.
      log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
      [EventCDIExtension]: beforeBeanDiscovery(): beforeBeanDiscovery=org.jboss.weld.bootstrap.events.BeforeBeanDiscoveryImpl@90b0dec, beanManager=Weld BeanManager for /opt/tomcat/apache-tomcat-9.0.0.M17/webapps/servlet5/WEB-INF/classes [bean count=3]
      24-Jan-2017 23:05:21.435 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
      org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/servlet5]]
      at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:441)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952)
      at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823)
      at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
      at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1161)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
      at java.base/java.lang.Thread.run(Thread.java:844)
      Caused by: org.jboss.weld.exceptions.WeldException: WELD-001524: Unable to load proxy class for bean Managed Bean [class MyBean] with qualifiers [@Any @Default] with class class MyBean using classloader ParallelWebappClassLoader
      context: servlet5
      delegate: false
      ----------> Parent Classloader:
      java.net.URLClassLoader@4bbfb90a

      at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:347)
      at org.jboss.weld.injection.producer.SubclassedComponentInstantiator.createEnhancedSubclass(SubclassedComponentInstantiator.java:97)
      at org.jboss.weld.injection.producer.SubclassedComponentInstantiator.initEnhancedSubclass(SubclassedComponentInstantiator.java:81)
      at org.jboss.weld.injection.producer.SubclassedComponentInstantiator.<init>(SubclassedComponentInstantiator.java:74)
      at org.jboss.weld.injection.producer.SubclassedComponentInstantiator.forInterceptedDecoratedBean(SubclassedComponentInstantiator.java:58)
      at org.jboss.weld.injection.producer.BeanInjectionTarget.initializeAfterBeanDiscovery(BeanInjectionTarget.java:138)
      at org.jboss.weld.injection.producer.InjectionTargetInitializationContext.initialize(InjectionTargetInitializationContext.java:42)
      at org.jboss.weld.injection.producer.InjectionTargetService.initialize(InjectionTargetService.java:63)
      at org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:423)
      at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83)
      at org.jboss.weld.environment.servlet.WeldServletLifecycle.initialize(WeldServletLifecycle.java:172)
      at org.jboss.weld.environment.servlet.EnhancedListener.onStartup(EnhancedListener.java:60)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5168)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
      ... 10 more
      Caused by: java.lang.RuntimeException: java.lang.ClassFormatError: Illegal class name "/MyBean$Proxy$$$_WeldSubclass" in class file /MyBean$Proxy$$$_WeldSubclass
      at org.jboss.weld.util.bytecode.ClassFileUtils.toClass(ClassFileUtils.java:101)
      at org.jboss.weld.bean.proxy.ProxyFactory.createProxyClass(ProxyFactory.java:463)
      at org.jboss.weld.bean.proxy.ProxyFactory.getProxyClass(ProxyFactory.java:340)
      ... 23 more
      Caused by: java.lang.ClassFormatError: Illegal class name "/MyBean$Proxy$$$_WeldSubclass" in class file /MyBean$Proxy$$$_WeldSubclass
      at java.base/java.lang.ClassLoader.defineClass1(Native Method)
      at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:977)
      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:543)
      at org.jboss.weld.util.bytecode.ClassFileUtils.toClass2(ClassFileUtils.java:108)
      at org.jboss.weld.util.bytecode.ClassFileUtils.toClass(ClassFileUtils.java:97)
      ... 25 more

      24-Jan-2017 23:05:21.438 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive /opt/tomcat/apache-tomcat-9.0.0.M17/webapps/servlet5.war
      java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/servlet5]]
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:756)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952)
      at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823)
      at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
      at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1161)
      at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
      at java.base/java.lang.Thread.run(Thread.java:844)

              Unassigned Unassigned
              hkang_jira h kang (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: