2 Replies Latest reply on Jan 10, 2013 5:50 AM by jprats

    ClassNotFoundException (org.xml.sax.helpers.DefaultHandler) in a module

    Markus Straub Newbie

      Hi,

       

      I am trying to deploy a web application within JBoss AS, where a class in a custom-built library (let's call it mylib.jar) extends org.xml.sax.helpers.DefaultHandler.

      As long as mylib.jar is situated in /opt/jboss/standalone/deployments/mywebapp.war/WEB-INF/lib everything works fine.

       

      The problem starts when I want to use mylib.jar as a module, since several of my web applications should use it.

      I created a module by putting mylib.jar into /opt/jboss/modules/at/mylib/main. The module.xml looks like this:

      <?xml version="1.0" encoding="UTF-8"?>
      <module xmlns="urn:jboss:module:1.0" name="at.mylib">
          <resources>
             <resource-root path="mylib.jar"/>
             <!-- Insert resources here -->
          </resources>
      
          <dependencies>
          </dependencies>
      </module>
      

       

      Then I use the module by removing mylib.jar from WEB-INF and putting the line "Dependencies: at.mylib" into META-INF/MANIFEST.MF

      The module is found and loaded, but classloading of the class which extends DefaultHandler fails because DefaultHandler could not be loaded in the first place.

      I wonder how this can happen since it is part of Java6. My guess is that rt.jar (which contains DefaultHandler.class) is not loaded.

       

      However I have no good idea how I should fix this. It would be great if somebody could help me to find a solution. Stacktrace and System Specs are below.

       

      Thanks,

      Markus

       

       

       

      Stacktrace:

      11:37:14,628 WARN  [org.jboss.modules] (http--127.0.0.1-8080-1) Failed to define class at.trafficstate.provider.its.YTimeseriesReader in Module "at.mylib:main" from local module loader @340d1fa5 (roots: /opt/jboss-as-7.1.0.CR1b/modules): java.lang.LinkageError: Failed to link at/trafficstate/provider/its/YTimeseriesReader (Module "at.mylib:main" from local module loader @340d1fa5 (roots: /opt/jboss-as-7.1.0.CR1b/modules))
          at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)
          at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)
          at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)
          at org.jboss.modules.Module.loadModuleClass(Module.java:505)
          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)
          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
          at at.trafficstate.provider.its.XYZRegionRealTimeProvider.updateData(XYZRegionRealTimeProvider.java:147) [mylib.jar:1.0-b314  2012-Feb-07 11:35:49]
          at at.trafficstate.provider.its.XYZRegionRealTimeProvider.<init>(XYZRegionRealTimeProvider.java:50) [mylib.jar:1.0-b314  2012-Feb-07 11:35:49]
          at at.trafficstate.provider.factory.XYZRegionRealTimeProviderFactory.createProvider(XYZRegionRealTimeProviderFactory.java:9) [mylib.jar:1.0-b314  2012-Feb-07 11:35:49]
          at at.trafficstate.provider.factory.AbstractProviderFactory.createProvider(AbstractProviderFactory.java:22) [mylib.jar:1.0-b314  2012-Feb-07 11:35:49]
          at at.trafficstate.TrafficState.addProvider(TrafficState.java:142) [mylib.jar:1.0-b314  2012-Feb-07 11:35:49]
          at at.mylib.util.io.mylibContext.getTrafficStateManager(mylibContext.java:474) [mylib.jar:1.0-b314  2012-Feb-07 11:35:49]
          at at.mylib.weighter.edge.TravelTimeEdgeWeighter.<init>(TravelTimeEdgeWeighter.java:73) [mylib.jar:1.0-b314  2012-Feb-07 11:35:49]
          at at.mylib.weighter.edge.TravelTimeEdgeWeighter.createInstance(TravelTimeEdgeWeighter.java:219) [mylib.jar:1.0-b314  2012-Feb-07 11:35:49]
          at at.mylib.weighter.WeighterFactory.getEdgeWeighter(WeighterFactory.java:66) [mylib.jar:1.0-b314  2012-Feb-07 11:35:49]
          at at.mylib.routingservice.empora.RoutingManager.getRoute(RoutingManager.java:91) [classes:]
          at at.mylib.routingservice.empora.ws.EmporaRoutingService.getRoute(EmporaRoutingService.java:19) [classes:]
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_26]
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_26]
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_26]
          at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
          at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72) [jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
          at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
          at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:37) [jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
          at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:45)
          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
          at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
          at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
          at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53) [jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
          at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51) [jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
          at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228) [jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
          at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304) [jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
          at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190) [jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
          at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
          at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
          at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
          at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:57) [jboss-as-ejb3-7.1.0.CR1b.jar:7.1.0.CR1b]
          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
          at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
          at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.0.CR1b.jar:7.1.0.CR1b]
          at org.jboss.as.webservices.invocation.AbstractInvocationHandlerEJB.invoke(AbstractInvocationHandlerEJB.java:112)
          at org.jboss.wsf.stack.cxf.JBossWSInvoker._invokeInternal(JBossWSInvoker.java:169)
          at org.jboss.wsf.stack.cxf.JBossWSInvoker.invoke(JBossWSInvoker.java:117)
          at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [:1.6.0_26]
          at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [:1.6.0_26]
          at java.util.concurrent.FutureTask.run(FutureTask.java:138) [:1.6.0_26]
          at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
          at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:106)
          at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
          at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
          at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:206)
          at org.jboss.wsf.stack.cxf.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:91)
          at org.jboss.wsf.stack.cxf.transport.ServletHelper.callRequestHandler(ServletHelper.java:169)
          at org.jboss.wsf.stack.cxf.CXFServletExt.invoke(CXFServletExt.java:87)
          at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:184)
          at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:107)
          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 org.jboss.wsf.stack.cxf.CXFServletExt.service(CXFServletExt.java:135)
          at org.jboss.wsf.spi.deployment.WSFServlet.service(WSFServlet.java:140) [jbossws-spi-2.0.0.GA.jar:2.0.0.GA]
          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.7.Final.jar:]
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.7.Final.jar:]
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.7.Final.jar:]
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.7.Final.jar:]
          at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:151) [jboss-as-web-7.1.0.CR1b.jar:7.1.0.CR1b]
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.7.Final.jar:]
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.7.Final.jar:]
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.7.Final.jar:]
          at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362) [jbossweb-7.0.7.Final.jar:]
          at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897) [jbossweb-7.0.7.Final.jar:]
          at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626) [jbossweb-7.0.7.Final.jar:]
          at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2033) [jbossweb-7.0.7.Final.jar:]
          at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
      Caused by: java.lang.NoClassDefFoundError: org/xml/sax/helpers/DefaultHandler
          at java.lang.ClassLoader.defineClass1(Native Method) [:1.6.0_26]
          at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [:1.6.0_26]
          at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [:1.6.0_26]
          at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [:1.6.0_26]
          at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)
          at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)
          ... 86 more
      Caused by: java.lang.ClassNotFoundException: org.xml.sax.helpers.DefaultHandler from [Module "at.mylib:main" from local module loader @340d1fa5 (roots: /opt/jboss-as-7.1.0.CR1b/modules)]
          at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
          at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
          at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)
          at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
          at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
          ... 92 more
      

      OS: Ubuntu 11.04 (Natty) 64bit

      Linux msb 2.6.38-13-generic #53-Ubuntu SMP Mon Nov 28 19:33:45 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

       

      Java: java version "1.6.0_26"

      Java(TM) SE Runtime Environment (build 1.6.0_26-b03)

      Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

       

      JBoss: jboss-as-7.1.0.CR1b