5 Replies Latest reply on Jul 10, 2012 12:25 PM by raydecampo

    java.lang.NoSuchFieldError: fStringPool

    ohmygod

      In JBoss 7.1.1.Final, my code uses org.apache.xerces.readers.DefaultEntityHandler class which is included in jar xerces1.4.4.jar, but when I added this jar in my ear\lib directory, another error reported:

       

       

      java.lang.NoSuchFieldError: fStringPool
      

       

      but I checked and found the class StringPool.class does exit at xerces1.4.4\org\apache\xerces\utils.

       

      So I am confused what the problem is. Could anybody help me?

        • 1. Re: java.lang.NoSuchFieldError: fStringPool
          jaikiran

          Please post the entire exception stacktrace and also the output of:

           

          jar -tf yourear.ear

          • 2. Re: java.lang.NoSuchFieldError: fStringPool
            ohmygod

            Hi Jaikiran,

             

            Here is the entir message for the problem:

             

            17:47:01,569 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/demo].[ControlServlet]] (http-127.0.0.1-127.0.0.1-8080-2) Servlet.service() for servlet ControlServlet threw exception: java.lang.NoSuchFieldError: fStringPool
             at com.demo.extractor.xml.MyDOMParser.<init>(MyDOMParser.java:41) [demo.jar:]
             at com.demo.XmlFileHandler.extract(XmlFileHandler.java:112) [demo.jar:]
             at com.demo.servlet.ControlServlet.doPost(ControlServlet.java:709) [classes:]
             at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [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.13.Final.jar:]
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
             at com.demo.util.HibernateFilter.doFilter(HibernateFilter.java:68) [demo.jar:]
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
             at com.demo.util.EncodingFilter.doFilter(EncodingFilter.java:44) [demo.jar:]
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
             at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
             at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
             at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
             at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
             at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
             at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
             at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_07]
            
            

             

            My ear is not a jar file but a folder structure which includes following folders/file:

             

            -demo-web.war (folder)

            -lib (folder, jars put here)

            -META-INF (folder, jboss-deployment-structure.xml put here)

            -demo.jar (the jar file which includes all my project's classes including the MDB classes)

             

            And here is the content of jboss-deployment-structure.xml by the way.

             

            <jboss-deployment-structure>
            <ear-subdeployments-isolated>true</ear-subdeployments-isolated>
              <deployment>
                  <dependencies>
                   <module name="com.sun.xml.bind" export="true"/>
                   <module name="javax.wsdl4j.api" export="true"/>
                   <module name="org.apache.commons.pool" export="true"/>
                      <module name="org.apache.xalan" export="true"/>
                <module name="org.apache.xerces" export="true"/>
                <module name="org.dom4j" export="true"/>
                <module name="org.hibernate" export="true"/>
                <module name="org.hibernate.envers" export="true"/>
                <module name="org.javassist" export="true"/>
                <module name="org.jboss.as.web" export="true"/>
                <module name="org.jdom" export="true"/>
                    </dependencies>
              </deployment>
            </jboss-deployment-structure>
            
            

             

            Since there are too many class files in demo.jar, do you think you need to see all of them by the jar output? If yes, I will attach them in a txt file for you. Thanks for your effort.

            • 3. Re: java.lang.NoSuchFieldError: fStringPool
              ohmygod

              What I am confused is why the error reported is not ClassNotFound error but just the field not found error.

              • 4. Re: java.lang.NoSuchFieldError: fStringPool
                sfcoy

                xerces 1.4.4 is positively archaic (c2003) and it's use in any post Java 5 implementation is likely to cause problems.

                 

                Xerces was one of the bases for the standardisation of XML parsing that was delivered in Java 5. You should consider migrating the code that depends upon it to the APIs present in Java 6/7 today.

                1 of 1 people found this helpful
                • 5. Re: java.lang.NoSuchFieldError: fStringPool
                  raydecampo

                  It looks to me like you are including xerces 1.4.4 in your EAR but also asking JBoss to use the xerces packaged with it (2.9.1) in your jboss-deployment-structure.xml.  So the wrong version of the class is being used which explains why it is a field not found error and not a class not found error.