7 Replies Latest reply on Jan 14, 2009 4:34 AM by thanz

    Find class from amother EAR

    thanz

      Hello

      We are trying to upgrade from JBoss 4.0.5 GA to 5.0.0 GA.

      We have 3 EAR's and our problem is now that one EAR needs to find
      a class in another EAR.

      But we get the error : java.lang.NoClassDefFoundError

      We searched a lot and found the option "useJBossWebLoader" in
      war-deployers-jboss-beans.xml and thought this would solve the problem.

      But it doesnt.

      Anyone has a hint how we can find a class from one EAR in another ?

        • 1. Re: Find class from amother EAR
          jaikiran

          More details please. Please post the entire exception stacktrace and also let us know where that class is located (which jar which ear). Have you configured classloader isolation for the EARs through jboss-app.xml?

          While posting logs or xml content or code, please remember to wrap it in a code block by using the Code button in the message editor window. Please use the Preview button to ensure that your post is correctly formatted.


          P.S: For JBossAS5 we have a dedicated forum here http://www.jboss.com/index.html?module=bb&op=viewforum&f=287

          • 2. Re: Find class from amother EAR
            thanz

            Thx for the fast answer.

            The full error :

            type Exception report
            
            message
            
            description The server encountered an internal error () that prevented it from fulfilling this request.
            
            exception
            
            javax.servlet.ServletException: Servlet execution threw an exception
             at.gv.brz.findok_intranet_internet.web.filter.Acronyms.doFilter(Acronyms.java:126)
             at.gv.brz.findok_intranet_internet.web.filter.PerformanceMeasurement.doFilter(PerformanceMeasurement.java:29)
             at.gv.brz.findok_intranet_internet.web.filter.InputParameterFilter.doFilter(InputParameterFilter.java:79)
             org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            
            root cause
            
            java.lang.NoClassDefFoundError: at/gv/brz/findok/businesslogik/FindokControllerLocalProxy
             at.gv.brz.findok_intranet_internet.web.WebStaticHelpers.getFindokController(WebStaticHelpers.java:49)
             at.gv.brz.findok_intranet_internet.web.FreeSearchAction.execute(FreeSearchAction.java:60)
             org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
             org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
             org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
             org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
             javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
             javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
             at.gv.brz.findok_intranet_internet.web.filter.Acronyms.doFilter(Acronyms.java:126)
             at.gv.brz.findok_intranet_internet.web.filter.PerformanceMeasurement.doFilter(PerformanceMeasurement.java:29)
             at.gv.brz.findok_intranet_internet.web.filter.InputParameterFilter.doFilter(InputParameterFilter.java:79)
             org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            
            root cause
            
            java.lang.ClassNotFoundException: at.gv.brz.findok.businesslogik.FindokControllerLocalProxy from BaseClassLoader@122c960{VFSClassLoaderPolicy@d2e636{name=vfszip:/D:/ENTWICKLUNG/dv-java/jboss-5.0.0.GA/server/default/deploy/FINDOK_Internet.ear/FINDOK_Internet_Web.war domain=ClassLoaderDomain@f50903{name=vfszip:/D:/ENTWICKLUNG/dv-java/jboss-5.0.0.GA/server/default/deploy/FINDOK_Internet.ear/FINDOK_Internet_Web.war parentPolicy=AFTER_BUT_JAVA_BEFORE parent=BaseClassLoader@15927e2{vfszip:/D:/ENTWICKLUNG/dv-java/jboss-5.0.0.GA/server/default/deploy/FINDOK_Internet.ear}} roots=[ZipEntryHandler@532261[path=FINDOK_Internet.ear/FINDOK_Internet_Web.war/WEB-INF/classes context=file:/D:/ENTWICKLUNG/dv-java/jboss-5.0.0.GA/server/default/deploy/ real=file:/D:/ENTWICKLUNG/dv-java/jboss-5.0.0.GA/server/default/deploy/FINDOK_Internet.ear/FINDOK_Internet_Web.war/WEB-INF/classes], DelegatingHandler@20240385[path=FINDOK_Internet.ear/FINDOK_Internet_Web.war/WEB-INF/lib/commons-fileupload.jar context=file:/D:/ENTWICKLUNG/dv-java/jboss-5.0.0.GA/server/default/deploy/ real=file:/D:/ENTWICKLUNG/dv-java/jboss-5.0.0.GA/server/default/deploy/FINDOK_Internet.ear/FINDOK_Internet_Web.war/WEB-INF/lib/commons-fileupload.jar], ZipEntryHandler@5323701[path=FINDOK_Internet.ear/FINDOK_Internet_Web.war/WEB-INF context=file:/D:/ENTWICKLUNG/dv-java/jboss-5.0.0.GA/server/default/deploy/ real=file:/D:/ENTWICKLUNG/dv-java/jboss-5.0.0.GA/server/default/deploy/FINDOK_Internet.ear/FINDOK_Internet_Web.war/WEB-INF]] delegates=null exported=[, lib..svn, lib..svn.prop-base, at.gv.brz.findok_intranet_internet.web.adminTool, at.gv.brz.findok_intranet_internet.web.filter, at.gv.brz.findok_intranet_internet.util.messagetree, com.fredck.FCKeditor.tags, com.fredck.FCKeditor.uploader, .svn.prop-base, com.fredck.FCKeditor, lib..svn.text-base, at.gv.brz.findok_intranet_internet.util.filesize, at.gv.brz.findok_intranet_internet.util.searchedFor, .svn.text-base, at.gv.brz.findok_intranet_internet.web.taglib, at.gv.brz.findok_intranet_internet.web.adminTool.deleteneuzugaenge, at.gv.brz.findok_intranet_internet.util, at.gv.brz.findok_intranet_internet.web.startup, com.fredck.FCKeditor.connector, at.gv.brz.findok_intranet_internet.web, org.apache.commons.fileupload, at.gv.brz.findok_intranet_internet.web.mymessageresource, at.gv.brz.findok_intranet_internet.web.support, META-INF, lib, .svn, at.gv.brz.findok_intranet_internet.web.portalneuz] <IMPORT-ALL>NON_EMPTY}}
             org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:385)
             java.lang.ClassLoader.loadClass(Unknown Source)
             java.lang.ClassLoader.loadClassInternal(Unknown Source)
             at.gv.brz.findok_intranet_internet.web.WebStaticHelpers.getFindokController(WebStaticHelpers.java:49)
             at.gv.brz.findok_intranet_internet.web.FreeSearchAction.execute(FreeSearchAction.java:60)
             org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
             org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
             org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
             org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
             javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
             javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
             at.gv.brz.findok_intranet_internet.web.filter.Acronyms.doFilter(Acronyms.java:126)
             at.gv.brz.findok_intranet_internet.web.filter.PerformanceMeasurement.doFilter(PerformanceMeasurement.java:29)
             at.gv.brz.findok_intranet_internet.web.filter.InputParameterFilter.doFilter(InputParameterFilter.java:79)
             org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            


            With "jboss-app.xml" you mean this ?

            <bean name="EARClassLoaderDeployer" class="org.jboss.deployment.EarClassLoaderDeployer">
             <!-- A flag indicating if ear deployments should have their own scoped
             class loader to isolate their classes from other deployments.
             -->
             <property name="isolated">false</property>
             </bean>
            


            Because i cant find any "jboss-app.xml" in jboss-folder.

            Its hard to descripe our EAR's.
            We have 3, and in one EAR there is a class which needs to create a class
            which is in a jar in another EAR. In Jboss 4.0.5 everything worked, now
            it seems that classes cant be found over EAR's, just inside each EAR.

            • 3. Re: Find class from amother EAR
              jaikiran

              Looking at the classpath dump, i don't see the second ear (what's the name of the ear, by the way) being added to the classpath.

              With "jboss-app.xml" you mean this ?



              <bean name="EARClassLoaderDeployer" class="org.jboss.deployment.EarClassLoaderDeployer">
               <!-- A flag indicating if ear deployments should have their own scoped
               class loader to isolate their classes from other deployments.
               -->
               <property name="isolated">false</property>
               </bean>
              




              No. An optional jboss-app.xml can be packaged by EAR applications in the META-INF folder. Usually, that file is used for classloader scoping. If you are not using it in the application, that's OK (atleast in this scenario).

              The bean definition that you posted has disabled isolated classloader for each EAR, so you should have been able to access the class from the other EAR (atleast in JBoss-4.x).

              In JBoss-5.0, i do know that there have been classloader related configuration changes and the recommended way to modify it is through jboss-structure.xml (if i am not wrong). But since, i haven't yet used the jboss-structure.xml for trying out any application, i am not much aware about how you can get this scenario working.

              I would recommend that you open a new thread in the JBossAS5 forum http://www.jboss.com/index.html?module=bb&op=viewforum&f=287, with all these details.


              • 4. Re: Find class from amother EAR
                alesj

                 

                "jaikiran" wrote:

                In JBoss-5.0, i do know that there have been classloader related configuration changes and the recommended way to modify it is through jboss-structure.xml (if i am not wrong). But since, i haven't yet used the jboss-structure.xml for trying out any application, i am not much aware about how you can get this scenario working.

                It's jboss-classloading.xml not jboss-structure.xml. ;-)

                Read more about it here:
                - https://www.jboss.org/community/docs/DOC-13178

                • 5. Re: Find class from amother EAR
                  jaikiran

                   

                  "alesj" wrote:

                  It's jboss-classloading.xml not jboss-structure.xml. ;-)

                  Read more about it here:
                  - https://www.jboss.org/community/docs/DOC-13178


                  My bad :-)

                  I was thinking more on the lines of adding a "classpath" through jboss-structure.xml http://www.jboss.org/file-access/default/members/jbossmc/freezone/docs/2.0.x/userGuide/ch21s04.html, but i now realize that the classpath "path" is relative to (and nested within) the EAR.

                  • 6. Re: Find class from amother EAR

                    If you can't show the configuration files then we can determine the configuration
                    if you show the relevent log snippets, e.g.

                    The following shows the config from the console-mgr.sar deployment

                    $ grep -ri "Created BaseClassLoader" server.log | grep console-mgr.sar
                    2009-01-12 13:11:48,358 DEBUG [org.jboss.classloader.spi.base.BaseClassLoader] (main) Created BaseClassLoader@11ad78c{vfsfile:/home/ejort/jboss-head/build/output/jboss-6.0.0.Alpha1/server/all/deploy/management/console-mgr.sar/} with policy VFSClassLoaderPolicy@13d4497{name=vfsfile:/home/ejort/jboss-head/build/output/jboss-6.0.0.Alpha1/server/all/deploy/management/console-mgr.sar/ domain=null roots=[MemoryContextHandler@23214077[path= context=vfsmemory://ax406o-wxl0vu-fpv3gism-1-fpv3h3ts-s real=vfsmemory://ax406o-wxl0vu-fpv3gism-1-fpv3h3ts-s], FileHandler@21625374[path=management/console-mgr.sar context=file:/home/ejort/jboss-head/build/output/jboss-6.0.0.Alpha1/server/all/deploy/ real=file:/home/ejort/jboss-head/build/output/jboss-6.0.0.Alpha1/server/all/deploy/management/console-mgr.sar/], DelegatingHandler@29624277[path=management/console-mgr.sar/console-mgr-classes.jar context=file:/home/ejort/jboss-head/build/output/jboss-6.0.0.Alpha1/server/all/deploy/ real=file:/home/ejort/jboss-head/build/output/jboss-6.0.0.Alpha1/server/all/deploy/management/console-mgr.sar/console-mgr-classes.jar], DelegatingHandler@14562017[path=management/console-mgr.sar/jcommon.jar context=file:/home/ejort/jboss-head/build/output/jboss-6.0.0.Alpha1/server/all/deploy/ real=file:/home/ejort/jboss-head/build/output/jboss-6.0.0.Alpha1/server/all/deploy/management/console-mgr.sar/jcommon.jar], DelegatingHandler@31354872[path=management/console-mgr.sar/jfreechart.jar context=file:/home/ejort/jboss-head/build/output/jboss-6.0.0.Alpha1/server/all/deploy/ real=file:/home/ejort/jboss-head/build/output/jboss-6.0.0.Alpha1/server/all/deploy/management/console-mgr.sar/jfreechart.jar]] delegates=null exported=[org.jfree.data.time, org.jboss.console.manager.interfaces, META-INF.maven.jfree.jcommon, org.jfree.chart.plot, org.jfree.chart.needle, org.jfree.data.xy, org.jfree.text, org.jfree.data.contour, org.jfree.chart.annotations, org.jfree.ui.about.resources, org.jfree.chart.urls, org.jfree.chart.demo, org.jfree.ui.about, org.jboss.console.navtree, META-INF, org.jboss.console.plugins.helpers.jmx, META-INF.maven.jfree.jfreechart, org.jfree.ui.action, org.jfree.chart.entity, org.jfree.chart.editor, org.jfree, org.jfree.layout, org.jfree.ui.tabbedui, org.jfree.base, org.jfree.ui, org.jfree.chart.axis, org.jfree.chart.resources, org.jfree.util, org.jboss.console.plugins.monitor, org.jboss.console.remote, com.keypoint, org.jboss.console.plugins.helpers.servlet, org.jfree.chart, org.jfree.data.io, org.jfree.chart.renderer, org.jfree.chart.renderer.xy, org.jfree.chart.servlet, org.jfree.data.resources, org.jfree.threads, org.jfree.chart.event, org.jfree.data.jdbc, org.jfree.data.function, org.jfree.date, org.jfree.chart.labels, org.jfree.data.category, org.jfree.base.config, org.jfree.resources, org.jfree.chart.renderer.category, org.jfree.io, org.jboss.console.plugins, org.jboss.console.plugins.helpers, org.jboss.console.util, org.jfree.data.xml, org.jfree.data.general, org.jfree.data.statistics, org.jboss.console.manager.interfaces.impl, org.jfree.base.log, org.jfree.chart.block, org.jfree.chart.imagemap, org.jfree.base.modules, org.jfree.data.gantt, org.jfree.chart.title, org.jboss.console.manager, org.jfree.chart.encoders, org.jfree.data] <IMPORT-ALL>NON_EMPTY}
                    2009-01-12 13:11:48,385 DEBUG [org.jboss.classloader.spi.base.BaseClassLoader] (main) Created BaseClassLoader@ebd7c4{vfsfile:/home/ejort/jboss-head/build/output/jboss-6.0.0.Alpha1/server/all/deploy/management/console-mgr.sar/web-console.war/} with policy VFSClassLoaderPolicy@1a295be{name=vfsfile:/home/ejort/jboss-head/build/output/jboss-6.0.0.Alpha1/server/all/deploy/management/console-mgr.sar/web-console.war/ domain=null roots=[FileHandler@18160626[path=management/console-mgr.sar/web-console.war/WEB-INF/classes context=file:/home/ejort/jboss-head/build/output/jboss-6.0.0.Alpha1/server/all/deploy/ real=file:/home/ejort/jboss-head/build/output/jboss-6.0.0.Alpha1/server/all/deploy/management/console-mgr.sar/web-console.war/WEB-INF/classes/], FileHandler@14529690[path=management/console-mgr.sar/web-console.war/WEB-INF context=file:/home/ejort/jboss-head/build/output/jboss-6.0.0.Alpha1/server/all/deploy/ real=file:/home/ejort/jboss-head/build/output/jboss-6.0.0.Alpha1/server/all/deploy/management/console-mgr.sar/web-console.war/WEB-INF/]] delegates=null exported=[tlds, ] <IMPORT-ALL>NON_EMPTY}
                    


                    Failing that enable TRACE logging for org.jboss.classloader in conf/jboss-log4j.xml
                    which will show exacly what it is doing when it is trying to load the class.

                    • 7. Re: Find class from amother EAR
                      thanz

                       

                      "alesj" wrote:
                      "jaikiran" wrote:

                      In JBoss-5.0, i do know that there have been classloader related configuration changes and the recommended way to modify it is through jboss-structure.xml (if i am not wrong). But since, i haven't yet used the jboss-structure.xml for trying out any application, i am not much aware about how you can get this scenario working.

                      It's jboss-classloading.xml not jboss-structure.xml. ;-)

                      Read more about it here:
                      - https://www.jboss.org/community/docs/DOC-13178



                      Where do i have to put the jboss-classloading.xml ?
                      And the module-name should be the jar where the class is in which should be found from the other class ?