3 Replies Latest reply on Apr 20, 2017 11:12 AM by andey

    Failed to deploy smcfs.ear in JBoss AS

    rahughos652

      Hi

       

      I am using jboss AS for development. The ear file (smcfs.ear) failed to deploy at JBoss throwing error. The ear file deployed at JBoss path

      <Root>\JBoss\jboss-as-7.1.1.Final\standalone\deployments . All jars/resource files available under smcfs.ear but seems it fail to load. logs attached.

       

      JBoss AS : jboss-as-7.1.1.Final

      error :

      Failed to define class com.yantra.yfc.dom.YFCElement in Module "deployment.smcfs.ear.platform_afc.jar:main" from Service Module Loader: java.lang.LinkageError: Failed to link com/yantra/yfc/dom/YFCElement (Module "deployment.smcfs.ear.platform_afc.jar:main" from Service Module Loader)

        at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396) [jboss-modules.jar:1.1.1.GA]

        at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243) [jboss-modules.jar:1.1.1.GA]

        at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73) [jboss-modules.jar:1.1.1.GA]

        at org.jboss.modules.Module.loadModuleClass(Module.java:517) [jboss-modules.jar:1.1.1.GA]

        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182) [jboss-modules.jar:1.1.1.GA]

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(Concu

        • 1. Re: Failed to deploy smcfs.ear in JBoss AS
          andey

          The Linkage error occurs when the same class is loaded from two different locations, sounds like a classloader hierarchy problem or you can say  when included a library twice.  For example:

           

          LinkageError is what you'll get in a classic case where you have a class C loaded by more than one classloader and those classes are being used together in the same code (compared, cast, etc). It doesn't matter if it is the same Class name or even if it's loaded from the identical jar - a Class from one classloader is always treated as a different Class if loaded from another classloader

          • 2. Re: Failed to deploy smcfs.ear in JBoss AS
            rahughos652

            Hi Anup,

             

            Thanks for reply. How to avoid linkage issue. Is it possible to activate only one classloader instead of multiple. Please advice.

             

            best regards

            Rahul Ghosh

            • 3. Re: Failed to deploy smcfs.ear in JBoss AS
              andey

              Hi Rahul,

               

              By default the web application class loader works different from the Java2 delegation model: when a web application's needs a class first it will look in the local repositories (that is the classes and libraries in the wEB-INF/classes or WEB-INF/libs directories) instead of delegating. So, the configuration you're proposing will work without any problem.

              But since both wars will contain the same class, have you considered packaging this class in a jar and place it in the jboss instance lib directory? This way you wouldn't need to include it in all the web applications you deploy in the instance.

              Take a look at : JBoss Web - Class Loader HOW-TO http://docs.jboss.org/jbossweb/2.1.x/class-loader-howto.html 

              Also you can refer: Class Loading in AS7 - JBoss AS 7.1 - Project Documentation Editor