6 Replies Latest reply on Jun 15, 2017 12:58 PM by Antoine Herzog

    Service Module Loader: java.lang.NoClassDefFoundError: Failed to link

    Jon Loe Newbie

      hi -

          Trying to migrate from JBoss 5 to Wildfly 10 (Final).   I have an ear with embedded jars and a war.  Within the war, I have libs (jars) in WEB-INF/lib.   During startup, I getting this error:

       

      10:04:58,479 WARN  [org.jboss.modules] (MSC service thread 1-1) Failed to define class org.andromda.cartridges.jsf.taglib.ConvertDateTimeTag in Module "deployment.prism-1.3.6.ear.prism-web-1.3.6.war:main" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link org/andromda/cartridges/jsf/taglib/ConvertDateTimeTag (Module "deployment.prism-1.3.6.ear.prism-web-1.3.6.war:main" from Service Module Loader): org/apache/myfaces/taglib/core/ConvertDateTimeTag

              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

             

      10:04:58,489 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.subunit."prism-1.3.6.ear"."prism-web-1.3.6.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.subunit."prism-1.3.6.ear"."prism-web-1.3.6.war".POST_MODULE: WFLYSRV0153: Failed to process phase POST_MODULE of subdeployment "prism-web-1.3.6.war" of deployment "prism-1.3.6.ear"

              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)

             

      Caused by: java.lang.NoClassDefFoundError: Failed to link org/andromda/cartridges/jsf/taglib/ConvertDateTimeTag (Module "deployment.prism-1.3.6.ear.prism-web-1.3.6.war:main" from Service Module Loader): org/apache/myfaces/taglib/core/ConvertDateTimeTag

              at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

              at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

       

       

      The class ConvertDateTimeTag is in a jar file which is in WEB-INF/lib (within the war).    At a loss on why/where to start.   Looks like a class loading issue, but don't know where to configure...

       

      thanks

        • 1. Re: Service Module Loader: java.lang.NoClassDefFoundError: Failed to link
          Erhard Siegl Novice

          The reason for a NoClassDefFoundError can be a ClassNotFoundException, but there can be other reasons as well. Look for the first error in the log and their Caused by. You might increase the log-level of org.jboss.modules to TRACE, but chances are you get lost in the amount of data. When migrating vom JBoss5 its important to understand the Classloding of WildFly well. Study Class Loading in WildFly - WildFly 10 - Project Documentation Editor especially jboss-deployment-structure.xml

          • 2. Re: Service Module Loader: java.lang.NoClassDefFoundError: Failed to link
            Antoine Herzog Master

            Hi,

             

            I have the same problem.

            Did you find how to resolve this ?

             

            I think that may come from the way the War is packaged : may be add the libraries in the MANIFEST file, or something like this, to declare them, so JBoss can find it for the TLD declaration.

            The libraries for the java code are found.

            The library for the TLD declaration is not found.

             

            When I find a solution, I will post it.

            • 3. Re: Service Module Loader: java.lang.NoClassDefFoundError: Failed to link
              Antoine Herzog Master

              MANIFEST file,... or jboss-deployment-structure.xml... may be.

              • 4. Re: Service Module Loader: java.lang.NoClassDefFoundError: Failed to link
                Tomaz Cerar Master

                where are your myfaces classes/jars located? as it is complaining that it cannot find them.

                • 5. Re: Service Module Loader: java.lang.NoClassDefFoundError: Failed to link
                  Antoine Herzog Master

                  Ho,... my problem is the same, but with another jar for another taglib.

                   

                  It is an old taglib from Sass (the statistic software/server), for a web application made with jsp, and running on JBoss 5.

                   

                  For the time being, the jars are in the WEB-INF/lib folder of the war.

                  (no ear, only a War for the application).

                  There are several jars (from Sass and others), in the lib folder.

                  The jar that causes the problem is : sas.ads.servlet.jar

                   

                  The taglib is in META-INF/sasads.tld

                  With this file to there : META-INF/sasads.mtl

                  I have moved them in WEB-INF/lib folder, but the problem is still here.

                   

                  May be I will make some modules, for all these libs.... but before to start this task, I need to make sure it will work (and make the application work on the new JBoss as soon as possible).

                  That's why I kept the lib in the war, as it was done in the JBoss 5 packaging.

                  • 6. Re: Service Module Loader: java.lang.NoClassDefFoundError: Failed to link
                    Antoine Herzog Master

                    The error is :

                    java.lang.NoClassDefFoundError: Failed to link org/andromda/cartridges/jsf/taglib/ConvertDateTimeTag (Module "deployment.prism-1.3.6.ear.prism-web-1.3.6.war:main" from Service Module Loader)

                    It seems that it is not a problem of not finding the class, but to define it, with the link to other classes from the jar or java, etc...

                     

                    The jar is quite old (2011), and the Manifest says it was compiled with Java 1.5.

                    I have made several trial, and It seems that the compilation of the classes are not recognized (or usable) by Java 1.8 (the one running now the JBoss instance).

                     

                    It seems the lib is too old (and compiled with too old java version), to be used today.

                     

                    When I remove the jar from the lib (and from the server, no module nor nothing), ... the war deploys properly.

                     

                    For the application I have to migrate, I will remove the use of these very old tags,... and get rid of the lib.

                    The migration of the application goes through renovating/rewriting the pages that are too old to run in WildFly 10.

                     

                    ********************************************************************************************************************

                    For the JSF libs, in the question above : it might be a question of JSF1.2 or JSF 2.0 lib.

                    There is a nice explaination on how to do the configuration, to choose which version is used, in the Developer Guide of WildFly 10.

                    See Chapter :

                    "23.4.2 Step 2: Debug and resolve deployment errors and exceptions

                    First Issue: java.lang.ClassNotFoundException: javax.faces.FacesException"

                     

                    Hope it helps,

                    Antoine

                    Consultant JBoss, WildFly, J2EE, ExoPlatform.