0 Replies Latest reply on Oct 31, 2011 5:15 AM by Tommy Dzwigaj

    NoClassDefFoundError problem with setting ws-security configuration (Class loading problems)

    Tommy Dzwigaj Newbie

      Hi,

      I'm setting a ws-security configuration in a standard-jaxws-client-config.xml file. In a node jax-ws-config/client-config/post-handler-chains/javaee:handler-chain/javaee:handler/javaee:handler-class i'm setting my own class which is stored in a jar that is later container within an ear. If i deploy everything as exploded directories to my jboss-4.2.3.GA everything works fine, when i'm building en ear i'm getting a java.lang.NoClassDefFoundError for that class everytime the ws-security connection to the destination web-service is made. I'm guessing it's some sort of ClassLoader problem by no idea how to fix this.

       

      The weird thing is that it worked for some time, but then one of the developers modified our jboss in some way (he says it shouldn't affect web services connections)  due to moving from ejb2.0 to ejb3.0 in main jar (others including the one with ws-security configuration were already using ejb3.0) and this problem started and a problem with using org.apache.commons.digester.Digester also started. Everytime we set a our class like this digester.addObjectCreate( "someTag", OurClass.class ) we're getting a java.lang.ClassNotFoundException: No ClassLoaders found for: name of the class. I know that it can be fixed by digester.setClassLoader( Thread.currentThread().getContextClassLoader() ); but we didn't have this problem before.

       

      Anyd ideas guys? Plese help.

       

      Stack trace:

       

       

      Caused by: java.lang.NoClassDefFoundError: Could not initialize class my.package.MyClass
              at sun.reflect.GeneratedConstructorAccessor234.newInstance(Unknown Source)
              at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
              at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
              at java.lang.Class.newInstance0(Class.java:355)
              at java.lang.Class.newInstance(Class.java:308)
              at org.jboss.ws.core.jaxws.handler.HandlerResolverImpl.addHandler(HandlerResolverImpl.java:148)
              at org.jboss.ws.core.jaxws.handler.HandlerResolverImpl.initHandlerChain(HandlerResolverImpl.java:134)
              at org.jboss.ws.core.jaxws.client.ClientImpl.initBindingHandlerChain(ClientImpl.java:157)
              at org.jboss.ws.core.jaxws.client.ClientImpl.update(ClientImpl.java:180)
              at org.jboss.ws.metadata.umdm.EndpointMetaData$ConfigObservable.notifyObservers(EndpointMetaData.java:931)
              at org.jboss.ws.metadata.umdm.EndpointMetaData$ConfigObservable.doNotify(EndpointMetaData.java:897)
              at org.jboss.ws.metadata.umdm.EndpointMetaData.setConfigNameInternal(EndpointMetaData.java:806)
              at org.jboss.ws.metadata.umdm.EndpointMetaData.setConfigName(EndpointMetaData.java:789)
              at org.jboss.ws.core.jaxws.client.ClientImpl.setConfigName(ClientImpl.java:475)
              at org.jboss.ws.core.CommonClient.setConfigName(CommonClient.java:649)
              ... 109 more
      

       

       

      Regards

      Tomek