4 Replies Latest reply on Jul 26, 2012 3:38 AM by Ricardo Arguello

    problem with xerces on 7.0 AS

    chandrashekar bn Newbie

      Hi

       

      Our application has code to parse XML and we are using xerces for doing it. we are getting following error when we execute parser on Jboss AS 7.0.

       

      Caused by: java.lang.NoClassDefFoundError: com/sun/org/apache/xerces/internal/parsers/SAXParser

          at java.lang.ClassLoader.defineClass1(Native Method) [:1.7.0]

          at java.lang.ClassLoader.defineClass(ClassLoader.java:791) [:1.7.0]

          at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) [:1.7.0]

          at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:397)

          ... 38 more

       

      Can anyone suggest me why we are getting this error.. This function works good on Tomcat 5.5. we have included xerces jar in our application lib foulder and is avaliable in classpath.

        • 1. Re: problem with xerces on 7.0 AS
          jaikiran pai Master

          I would recommend that you upgrade to latest avaialble AS7 release, which is 7.1.1.Final. If you still run into this problem, then please post the entire exception stacktrace.

          • 2. Re: problem with xerces on 7.0 AS
            chandrashekar bn Newbie

            Thanks for responce jaikiran pai,

             

            I tryed using latest release 7.1.1 but i had problem deploying ear.  Link to that post

            Migrating from 7.0.1 to 7.1final, getting  java.lang.ClassNotFoundException

             

            But when we deploy our application on 7.0.1 we getting error only in xerces.

             

            Full stacktrace for above issue is

             

             

            09:17:47,282 WARN  [org.jboss.modules] (http--127.0.0.1-9090-5) Failed to define class nu.xom.JDK15XML1_0Parser in Module "deployment.vsmt7.0.ear.viniapp.war:main" from Service Module Loader: java.lang.LinkageError: Failed to link nu/xom/JDK15XML1_0Parser (Module "deployment.vsmt7.0.ear.viniapp.war:main" from Service Module Loader)

                at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:401)

                at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:261)

                at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:76)

                at org.jboss.modules.Module.loadModuleClass(Module.java:590)

                at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:183)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:333)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310)

                at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103)

                at java.lang.Class.forName0(Native Method) [:1.7.0]

                at java.lang.Class.forName(Class.java:186) [:1.7.0]

                at nu.xom.Builder.findParser(Builder.java:201) [xom-1.1.jar:]

                at nu.xom.Builder.<init>(Builder.java:138) [xom-1.1.jar:]

                at nu.xom.Builder.<init>(Builder.java:118) [xom-1.1.jar:]

                at net.sf.json.xml.XMLSerializer.read(XMLSerializer.java:309) [json-lib-2.3-jdk13.jar:]

                at com.vinisyndicate.struts.action.DisplaySearchAction.execute(DisplaySearchAction.java:123) [classes:]

                at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419) [struts.jar:]

                at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224) [struts.jar:]

                at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196) [struts.jar:]

                at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414) [struts.jar:]

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:734) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at com.vinisyndicate.servlets.ValidationFilter.doFilter(ValidationFilter.java:26) [classes:]

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]

                at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57) [jboss-as-web-7.0.2.Final.jar:7.0.2.Final]

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952) [jbossweb-7.0.1.Final.jar:7.0.2.Final]

                at java.lang.Thread.run(Thread.java:722) [:1.7.0]

            Caused by: java.lang.NoClassDefFoundError: com/sun/org/apache/xerces/internal/parsers/SAXParser

                at java.lang.ClassLoader.defineClass1(Native Method) [:1.7.0]

                at java.lang.ClassLoader.defineClass(ClassLoader.java:791) [:1.7.0]

                at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) [:1.7.0]

                at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:397)

                ... 38 more

            Caused by: java.lang.ClassNotFoundException: com.sun.org.apache.xerces.internal.parsers.SAXParser from [Module "deployment.vsmt7.0.ear.viniapp.war:main" from Service Module Loader]

                at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:191)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:361)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:333)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:333)

                at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:310)

                at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:103)

                ... 42 more

            • 3. Re: problem with xerces on 7.0 AS
              jaikiran pai Master

              Stick with 7.1.1.Final and let's discuss the deployment issue with that version in the other thread you pointed to.

              • 4. Re: problem with xerces on 7.0 AS
                Ricardo Arguello Newbie

                The anwser is here: https://community.jboss.org/message/717927

                 

                You have to add a <system> element to your jboss-deployment-structure.xml file.

                Note the xmlns attribute, it has to declare the 1.1 version of the schema:

                 

                 

                <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
                          <ear-subdeployments-isolated>false</ear-subdeployments-isolated>
                          <deployment>
                                    <exclusions>
                                              <module name="org.apache.log4j" />
                                    </exclusions>
                          </deployment>
                          <sub-deployment name="eservice.war">
                            <dependencies>
                                <system>
                                    <paths>
                                        <path name="com/sun/org/apache/xerces/internal/parsers"/>
                                    </paths>
                                </system>
                            </dependencies>

                          </sub-deployment>
                </jboss-deployment-structure>