NoClassDefFoundError

Latest response

Hi all,

I am trying to migrating my project from jboss eap 5 to eap 7 but faced with some errors.
As I wanted to use the libraries as defined in my project and not those provided by jboss like cxf and more, I tried to remove the following code in standalone.xml.

 <extension module="org.jboss.as.webservices"/>
  <subsystem xmlns="urn:jboss:domain:webservices:2.0">
            <wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>
            <endpoint-config name="Standard-Endpoint-Config"/>
            <endpoint-config name="Recording-Endpoint-Config">
                <pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
                    <handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
                </pre-handler-chain>
            </endpoint-config>
            <client-config name="Standard-Client-Config"/>
        </subsystem>

I also have tried to add the jboss-deployment-structure.xml as below:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
        <exclude-subsystems>
            <subsystem name="webservices" />
        </exclude-subsystems>
    </deployment>
</jboss-deployment-structure>

However, I was thrown with this error instead:

"{\"WFLYCTL0080: Failed services\" => {\"jboss.undertow.deployment.default-server.default-host./AFService\" => \"org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./AFService: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'apServiceClientInstance' defined in ServletContext resource [/WEB-INF/cxfbeans.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/jws/WebService
Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'apServiceClientInstance' defined in ServletContext resource [/WEB-INF/cxfbeans.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/jws/WebService
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'apServiceClientInstance' defined in ServletContext resource [/WEB-INF/cxfbeans.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: javax/jws/WebService
Caused by: java.lang.NoClassDefFoundError: javax/jws/WebService
Caused by: java.lang.ClassNotFoundException: javax.jws.WebService from [Module \\"deployment.AFService.war:main\\" from Service Module Loader]\"}}"

Would appreciate for any advise. Thanks in advanced!

Wendy Lau's picture

Responses

I found the solution. In case anyone is facing the same issue, what I did is to add in the javax.jws.api as module dependency in order for my war file to be deployed successfully.

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
    <deployment>
    <!-- Exclusions allow you to prevent the server from automatically adding some dependencies     -->
    <exclude-subsystems>  
      <subsystem name="webservices" />  
    </exclude-subsystems>  
  <dependencies>
      <module name="javax.jws.api" export="true"/>   
   </dependencies> 
    </deployment>
</jboss-deployment-structure>

Was this helpful?

We appreciate your feedback. Leave a comment if you would like to provide more detail.
It looks like we have some work to do. Leave a comment to let us know how we could improve.