JBOSS EAP 6.3 and CXF java.lang.ClassCastException: org.apache.cxf.jaxws.context.WrappedMessageContext

Latest response

Hello all,

I am having an issue with getting the wrapped message context from inside my cxf webservice. I inject the WebServiceContext as a resource to my service but when I try and cast it to a WrappedMessagecontext I get the following error:

java.lang.ClassCastException: org.apache.cxf.jaxws.context.WrappedMessageContext cannot be cast to org.apache.cxf.jaxws.context.WrappedMessageContext

My deployment structure is and EAR that has 2 WARs inside of it.

My jboss-deployment-structure has the following modules:

"org.springframework.spring" export="true"
"org.apache.cxf" export="true"
"javax.xml.ws.api" export="true"
"org.jboss.osgi.framework" export="true"

And my wars both contain:

cdi-api-1.0-SP4.jar
commons-codec-1.7.jar
commons-io-2.2.jar
cxf-bundle-2.7.6.jar
cxf-rt-transports-http-2.7.11.redhat-3.jar
javax.inject-1.jar
jboss-logging-3.1.3.GA.jar
neethi-3.0.2.jar
stax2-api-3.1.3.jar
wsdl4j-1.6.3.jar
xmlschema-core-2.0.3.jar

Thank You

Jason Clarke's picture

Responses

Hi Jason,

Please refer to this solution.
https://access.redhat.com/solutions/803623

Takayuki

Hi Jason,

Please let us know if the above solution helped resolve the issue for you.

Jason-

This article might provide more specific advice. It is written for RESTEasy but I believe the same advice applies to use of CXF:

https://access.redhat.com/solutions/395293

Regards,

Scott

Hi,

I have a similar problem in JBoss 6.4, but the above solution didnt work for me. I tried removing all the cxf dependent jars. I am getting exception java.lang.ClassCastException: org.apache.cxf.jaxws.context.WrappedMessageContext cannot be cast to javax.xml.ws.handler.soap.SOAPMessageContext. Could some one please help me to resolve this.

Hello,

Don't package the CXF files with the application, if you are using maven, make sure you mark the CXF library as provided:

<dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>3.1.11</version>
        <type>jar</type>
        <scope>provided</scope>
    </dependency>

Also, specify your JBoss module dependency in the maven file:

<plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-ejb-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <ejbVersion>3.1</ejbVersion>
                <archive>
                    <manifestEntries>
                        <Dependencies>org.apache.cxf.impl</Dependencies>
                    </manifestEntries>
                </archive>
            </configuration>
        </plugin>

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.