Discussion:
[jboss-user] [JBoss Web Services] - ClassCastException using CXF 2.7.0 JAX-RS Client in JBoss AS7
Vinoj Mathew
2013-04-05 22:17:49 UTC
Permalink
Vinoj Mathew [https://community.jboss.org/people/mathewvino] created the discussion

"ClassCastException using CXF 2.7.0 JAX-RS Client in JBoss AS7"

To view the discussion, visit: https://community.jboss.org/message/806803#806803

--------------------------------------------------------------
I have trouble with CXF 2.7.0 in a JBoss AS7 environment. There is a classpath conflict with the RESTEasy Response class:
Caused by: java.lang.ClassCastException: org.jboss.resteasy.core.ServerResponse cannot be cast to org.apache.cxf.jaxrs.impl.ResponseImpl at org.apache.cxf.jaxrs.client.WebClient.handleResponse(WebClient.java:975) ...



Google around and added the following configuration in jboss_deployement_structure.xml file. But no luck I am using jboss7.1.1 as my application server. Any thoughts on this. Thanks for the help

<sub-deployment name="tfnmgr.war">
            <exclusions>
             <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-jettison-provider"/>
                              <module name="org.jboss.resteasy.resteasy-yaml-provider"/>
                              <module name="org.jboss.as.webservices.*"/>
            <module name="org.jboss.ws.*" />
                              <module name="org.jboss.resteasy.resteasy-jsapi"/>
            <module name="org.jboss.resteasy.resteasy-multipart-provider"/>
            <module name="org.jboss.resteasy.async-http-servlet-30"/>
                    </exclusions>
          </sub-deployment>
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/806803#806803]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
Viral Gohel
2013-04-06 05:36:27 UTC
Permalink
Viral Gohel [https://community.jboss.org/people/vrlgohel] created the discussion

"Re: ClassCastException using CXF 2.7.0 JAX-RS Client in JBoss AS7"

To view the discussion, visit: https://community.jboss.org/message/806815#806815

--------------------------------------------------------------
You need to disable the same like this,

<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
  <deployment>
    <exclude-subsystems>
      <subsystem name="jaxrs" />
      <subsystem name="webservices" />
    </exclude-subsystems>
  </deployment>
</jboss-deployment-structure>
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/806815#806815]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
Vinoj Mathew
2013-04-08 17:48:45 UTC
Permalink
Vinoj Mathew [https://community.jboss.org/people/mathewvino] created the discussion

"Re: ClassCastException using CXF 2.7.0 JAX-RS Client in JBoss AS7"

To view the discussion, visit: https://community.jboss.org/message/807036#807036

--------------------------------------------------------------
Thanks Viral for the quick response. I tried with this but the problem is I am using JBOSS7.1.1 and i am getting like the following error
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[2,1]
Message: Unexpected element '{urn:jboss:deployment-structure:1.2}jboss-deployment-structure'.

Is it something like I need to upgrade my jboss to the latest version.

Thanks for the help
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/807036#807036]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
Viral Gohel
2013-04-09 03:57:37 UTC
Permalink
Viral Gohel [https://community.jboss.org/people/vrlgohel] created the discussion

"Re: ClassCastException using CXF 2.7.0 JAX-RS Client in JBoss AS7"

To view the discussion, visit: https://community.jboss.org/message/807108#807108

--------------------------------------------------------------
Hi Vinod,

This depends on the namespaces configured in module.xml for jax-rs and cxf.
For example, in $JBOSS_HOME/modules/org/apache/cxf/main/module.xml, the xmlns points to  'urn:jboss:module:1.1', then you would need to have the same in your jboss-deployment-structure.xml.

Like this, <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">.



Can you please try this out and let me know the results ?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/807108#807108]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
Vinoj Mathew
2013-04-11 23:01:59 UTC
Permalink
Vinoj Mathew [https://community.jboss.org/people/mathewvino] created the discussion

"Re: ClassCastException using CXF 2.7.0 JAX-RS Client in JBoss AS7"

To view the discussion, visit: https://community.jboss.org/message/807896#807896

--------------------------------------------------------------
Thanks Viral,

I think I tried  and I am getting the following error .The error says <exclude-subsystems> is not supported in 7.1.1

15:59:00,388 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.deployment.unit."tfn-ear-1.4.0-SNAPSHOT.ear".STRUCTURE: org.jboss.msc.service.StartExce
ption in service jboss.deployment.unit."tfn-ear-1.4.0-SNAPSHOT.ear".STRUCTURE: Failed to process phase STRUCTURE of deployment "tfn-ear-1.4.0-SNAPSHOT.ear"
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_02]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_02]
        at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_02]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Error loading jboss-structure.xml from C:\jboss-as-7.1.1.Final\standalone\tmp\vfs\tempdcc7875d15f8c489\content-fe7468c559dc
5ef\contents\META-INF\jboss-deployment-structure.xml
        at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.parse(DeploymentStructureDescriptorParser.java:277) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.parse(DeploymentStructureDescriptorParser.java:249) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.as.server.deployment.module.descriptor.DeploymentStructureDescriptorParser.deploy(DeploymentStructureDescriptorParser.java:134) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
        at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
        ... 5 more
Caused by: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[7,9]
Message: Unexpected content of type 'element start' named '{urn:jboss:deployment-structure:1.1}exclude-subsystems'
        at org.jboss.as.server.deployment.module.descriptor.JBossDeploymentStructureParser11.unexpectedContent(JBossDeploymentStructureParser11.java:1098) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/807896#807896]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
Viral Gohel
2013-04-17 06:47:17 UTC
Permalink
Viral Gohel [https://community.jboss.org/people/vrlgohel] created the discussion

"Re: ClassCastException using CXF 2.7.0 JAX-RS Client in JBoss AS7"

To view the discussion, visit: https://community.jboss.org/message/808719#808719

--------------------------------------------------------------
Are you get that exception when the application is deployed or invoking it ?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/808719#808719]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
Juan Malpica
2013-05-05 23:10:32 UTC
Permalink
Juan Malpica [https://community.jboss.org/people/jmalpica] created the discussion

"Re: ClassCastException using CXF 2.7.0 JAX-RS Client in JBoss AS7"

To view the discussion, visit: https://community.jboss.org/message/816096#816096

--------------------------------------------------------------
Hi all,

I am facing the same problem and I am really stuck with that. Did you finally get a solution?

Thank you.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/816096#816096]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
chaohui sun
2013-05-07 09:44:48 UTC
Permalink
chaohui sun [https://community.jboss.org/people/chaohuis] created the discussion

"Re: ClassCastException using CXF 2.7.0 JAX-RS Client in JBoss AS7"

To view the discussion, visit: https://community.jboss.org/message/816454#816454

--------------------------------------------------------------
jboss-eap-6.1.0.Beta&jboss-as-7.1.1.Final.

just one solution,not recommend.

1.comment
<!--
        <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>-->
and
<!--
        <extension module="org.jboss.as.jaxrs"/>-->

in standalone.xml
---
*2.comment*
*<!--*
*        <module name="javax.ws.rs.api" export="true"  services="export"/>-->*

in $JBOSS_HOME/modules/system/layers/base/javaee/api/main/module.xml
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/816454#816454]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
Juan Malpica
2013-05-08 08:51:01 UTC
Permalink
Juan Malpica [https://community.jboss.org/people/jmalpica] created the discussion

"Re: ClassCastException using CXF 2.7.0 JAX-RS Client in JBoss AS7"

To view the discussion, visit: https://community.jboss.org/message/816680#816680

--------------------------------------------------------------
Hi chaohui sun,

that works fine for me!!!!!!!

Thank you very much for your help. 
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/816680#816680]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
Stéphane Jeandeaux
2013-06-16 18:14:27 UTC
Permalink
Stéphane Jeandeaux [https://community.jboss.org/people/stephane_jeandeaux] created the discussion

"Re: ClassCastException using CXF 2.7.0 JAX-RS Client in JBoss AS7"

To view the discussion, visit: https://community.jboss.org/message/823356#823356

--------------------------------------------------------------
Hi Mathew,

I have a war and use cxf 2.7.5 and Jboss 7.1.1.Final. That works with *jboss-deployment-structure.xml* in my web-inf :

<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
          <deployment>
                    <exclusions>
                              <!-- Exclude Version cxf of JBOSS -->
                              <module name="org.apache.cxf" />
                              <!-- Exclude JAVA EE of JBOSS (javax.ws..) => Add dependency javax.annotation -->
                              <module name="javaee.api" />


                              <!-- Exclude RestEasy conflict (javax.ws.rs.ext.RunDelegate) -->
                              <module name="org.jboss.resteasy.resteasy-atom-provider" />
                              <module name="org.jboss.resteasy.resteasy-cdi" />
                              <module name="org.jboss.resteasy.resteasy-jackson-provider" />
                              <module name="org.jboss.resteasy.resteasy-jaxb-provider" />
                              <module name="org.jboss.resteasy.resteasy-jaxrs" />
                              <module name="org.jboss.resteasy.resteasy-jettison-provider" />
                              <module name="org.jboss.resteasy.resteasy-jsapi" />
                              <module name="org.jboss.resteasy.resteasy-multipart-provider" />
                              <module name="org.jboss.resteasy.resteasy-yaml-provider" />

                    </exclusions>

                    <dependencies>
                              <!-- Add javax.annotation.Ressource -->
                              <module name="javax.annotation.api" />
                    </dependencies>
          </deployment>
</jboss-deployment-structure>
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/823356#823356]

Start a new discussion in JBoss Web Services at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]
Loading...