2 Replies Latest reply on Jan 2, 2017 5:15 PM by sumanthreddybandi

    Wildfly 9.0.2 classloading issues

    sumanthreddybandi

      I am facing classloading issue in wildfly server. I have deployed my ear file in wildfly standalone server. And declared dependencies through jboss-deployment-structure.xml

      Everything seems to be working fine except this class.

      Caused by: java.lang.ClassNotFoundException: com.sun.el.ExpressionFactoryImpl 
                                                at java
      .net.URLClassLoader.findClass(URLClassLoader.java:381)
                                                at java
      .lang.ClassLoader.loadClass(ClassLoader.java:424)
                                                at java
      .lang.ClassLoader.loadClass(ClassLoader.java:357)
                                                at javax
      .el.FactoryFinder.newInstance(FactoryFinder.java:88)

      I tried to solve this by adding 'org.glassfish.javax.el' module to jboss-deployment-structure.xml

      I also tried to solve by adding this to global-modules in configuration file. But still i am getting the same error.

      I tried to log classloading by enabling TRACE on 'org.jboss.classloader' logger category but no luck.

      Then i enabled classloading from JAVA_OPTS (-verbose:class) to console but this class is found in the log. In fact i didn't find many jars mentioned in the jboss-deployment-structure.xml in the logs.

      Could someone please help me to solve this issue. Thank you in advance.

        • 1. Re: Wildfly 9.0.2 classloading issues
          jaikiran

          Please post the complete stacktrace and the contents of your jboss-deployment-structure.xml

          • 2. Re: Wildfly 9.0.2 classloading issues
            sumanthreddybandi

            Sorry it was code issue. I was migrating an application from JBoss 4 to Wildfly 9.

             

            There is a code where explicitly setting context classloader to parent classloaders

             

                      ClassLoader cl = TestXXX.class.getClassLoader().getParent().getParent().getParent().getParent();

                      Thread.currentThread().setContextClassLoader(cl);

             

            It worked when i removed this because the current class loader in wildfly is: org.jboss.modules.ModuleClassLoader and most of the dependent classes (including com.sun.el.ExpressionFactoryImpl) are loaded from module dependency.