Jboss start exception due to apache CXF?

2019-09-15 03:23发布

问题:

1)

Not installing optional component org.apache.cxf.transport.http.Servlet3ContinuationProvider$Servlet3Continuation due to exception: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011054: Could not find default constructor for class org.apache.cxf.transport.http.Servlet3ContinuationProvider$Servlet3Continuation

2) Encountered invalid class name 'org.springframework.context.ApplicationContext,org.springframework.beans.BeansException' for service type 'org.apache.cxf.bus.factory' JBAS015893: Encountered invalid class name 'org.xmlpull.mxp1.MXParser,org.xmlpull.mxp1_serializer.MXSerializer' for service type 'org.xmlpull.v1.XmlPullParserFactory'

I am using Jboss EAP 6.0 and portlet project contains Apache cxf and spring configurations to build REST services. Could anyone shed some light on these exceptions, I googled and tried following but not successful.

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
<deployment>
<dependencies>
        <module name="org.jboss.modules"></module>
    </dependencies>
<exclusions>
        <module name="org.jboss.ws.cxf" />
        <module name="org.apache.cxf" />
        <module name="org.jboss.ws.rs" />    
          <module name="org.jboss.resteasy.resteasy-atom-provider"/>
          <module name="org.jboss.resteasy.resteasy-cdi"/>
          <module name="org.jboss.resteasy.resteasy-jaxrs"/>
          <module name="org.jboss.resteasy.resteasy-jaxb-provider"/>
          <module name="org.jboss.resteasy.resteasy-jackson-provider"/>
          <module name="org.jboss.resteasy.resteasy-jsapi"/>
          <module name="org.jboss.resteasy.resteasy-multipart-provider"/>
          <module name="org.jboss.resteasy.resteasy-yaml-provider"/>
          <module name="org.jboss.resteasy.resteasy-jettison-provider"/>
          <module name="org.hibernate" /> 
    </exclusions>

</deployment>

I tried following, too (:

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
   <deployment>
     <exclude-subsystems>
        <subsystem name="resteasy" />
         <subsystem name="webservices" /> 
      </exclude-subsystems>
        <exclusions>
            <module name="org.hibernate"></module>
             <module name="org.jboss.ws.rs" />
             <module name="org.apache.cxf" />             
              <module name="org.jboss.resteasy.resteasy-atom-provider"/>
              <module name="org.jboss.resteasy.resteasy-cdi"/>
              <module name="org.jboss.resteasy.resteasy-jaxrs"/>
              <module name="org.jboss.resteasy.resteasy-jaxb-provider"/>
              <module name="org.jboss.resteasy.resteasy-jackson-provider"/>
              <module name="org.jboss.resteasy.resteasy-jsapi"/>
              <module name="org.jboss.resteasy.resteasy-multipart-provider"/>
              <module name="org.jboss.resteasy.resteasy-yaml-provider"/>
              <module name="org.jboss.resteasy.resteasy-jettison-provider"/>
              <module name="org.jboss.ws.cxf" />
        </exclusions>
        <dependencies>
            <module name="com.oracle.ojdbc14"></module>
            <module name="com.liferay.portal"></module>
            <module name="org.jboss.ironjacamar.jdbcadapters"></module>
            <module name="org.picketbox"></module>
            <module name="org.jboss.modules"></module>
        </dependencies>
    </deployment>
</jboss-deployment-structure>

回答1:

Maybe it's too late to answer this question.

But by consideration of some others, including me minutes before may still need it, I'd like to share what I have done for the solution.

In short, it's still an issue about version conflicts as JBoss AS7 or EAP6.0 ships with different version of Apache CXF to build its webservice module.

To resolve this issue, we need to do two steps:

  1. To remove the webservice module in Jboass configuration file (say standalone.xml): 1). under session , remove

    <extension module="org.jboss.as.webservices"/>
    

    2). under session , remove whole webservice subsystem

    <subsystem xmlns="urn:jboss:domain:webservices:1.1">
    ...
    </subsystem>
    
  2. use the jboss-deployment-structure: Some xml snipit here is just for your reference:

    <deployment>
     <exclusions>
      <module name="org.apache.log4j"/>
      <module name="org.apache.commons.logging"/>
      <module name="org.slf4j" slot="main"/>
      <module name="org.dom4j" />
      <module name="org.hibernate" />
      <module name="org.hibernate.validator" />
      <module name="org.xmlpull" /> 
     </exclusions>
    </deployment>
    <sub-deployment name="myapp-1.0.0-SNAPSHOT.war">
     <exclusions>
       <module name="org.apache.cxf" />
       <module name="org.apache.neethi" />
       <module name="javax.wsdl4j.api" />
       <module name="org.apache.ws.security" />
       <module name="org.apache.ws.xmlschema" />                
     </exclusions>
    </sub-deployment>