Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-9961

Annotations in applications, compiled using JDK 9, aren't recognized causing deployment issues

XMLWordPrintable

    • Workaround Exists
    • Hide

      A workaround to this issue is to compile the application using Java 8 and then deploy the application to WildFly 12.0.0.Final. The Java version to run WildFly itself can be Java 9, if you choose to, as long as the application being deployed in compiled using a version lesser than Java 9.
      Other workaround is to replace jandex in server installation with fixed version.
      To do that download Jandex 2.0.5.Final (or newer) jar from http://mvnrepository.com/artifact/org.jboss/jandex/2.0.5.Final and place it in WILDFLY_HOME/modules/system/layers/base/org/jboss/jandex/main than open module.xml in that folder and update reference resource-root to point to new jar.

      Show
      A workaround to this issue is to compile the application using Java 8 and then deploy the application to WildFly 12.0.0.Final. The Java version to run WildFly itself can be Java 9, if you choose to, as long as the application being deployed in compiled using a version lesser than Java 9. Other workaround is to replace jandex in server installation with fixed version. To do that download Jandex 2.0.5.Final (or newer) jar from http://mvnrepository.com/artifact/org.jboss/jandex/2.0.5.Final and place it in WILDFLY_HOME/modules/system/layers/base/org/jboss/jandex/main than open module.xml in that folder and update reference resource-root to point to new jar.

      After upgrading to WFLY 12 Final, the WebApplicationInitializer class residing in the *.war classes Folder is no longer being detected when built with JDK 9. However with JDK 1.8 it works as expected.

      With WFLY 11, both variants JDK9, and JDK1.8 Build were working.

      package de.test;
      
      import javax.servlet.ServletContext;
      import javax.servlet.ServletException;
      
      import org.springframework.web.WebApplicationInitializer;
      
      public class MyWebApplicationInitializer implements WebApplicationInitializer {
      
      	@Override
      	public void onStartup(ServletContext container) throws ServletException {
      
      		 System.out.println("!!!!!!!!!!!!!! ;-) !!!!!!!!!!!!");
      
      	}
      
      }
      
      

      Maybe related to this: https://issues.jboss.org/browse/WFLY-9081

      Even more serious: the @WebListener doesn't seem to be recognized with JDK9 as well:

      package de.test;
      
      import javax.servlet.ServletContextEvent;
      import javax.servlet.ServletContextListener;
      import javax.servlet.annotation.WebListener;
      import javax.servlet.http.HttpSessionEvent;
      import javax.servlet.http.HttpSessionIdListener;
      import javax.servlet.http.HttpSessionListener;
      
      
      @WebListener
      public class MyWebListener implements ServletContextListener, HttpSessionIdListener, HttpSessionListener {
      
      	@Override
      	public void contextInitialized(ServletContextEvent event) {
      		System.out.println("contextInitialized !!!!!!!! I'm only working when i was built with JDK8");
      	}
      		 
      	@Override
      	public void sessionIdChanged(HttpSessionEvent arg0, String arg1) {
      		// TODO Auto-generated method stub
      		
      	} 
      
      }
      
      

      The actual error seems to happen quite early: JBossWebMetaData

              sdouglas1@redhat.com Stuart Douglas (Inactive)
              pcom.progweb cnsgithub cnsgithub (Inactive)
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated:
                Resolved: