cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guttorm Vik (JIRA)" <>
Subject [jira] [Created] (CXF-7167) Generated wrapper classes overwrite each other
Date Tue, 06 Dec 2016 18:51:58 GMT
Guttorm Vik created CXF-7167:

             Summary: Generated wrapper classes overwrite each other
                 Key: CXF-7167
             Project: CXF
          Issue Type: Bug
          Components: Core
    Affects Versions: 3.1.6
         Environment: Wildfly 10.1.0, Windows
            Reporter: Guttorm Vik

We have a package with two @WebService classes.
They have a @WebMethod with the same name, but with a different return type.

For each method cxf generates a wrapper class at runtime that has package = the shared package
for our web service classes, and class name = the @WebMethod

The result is that the generated class for both these has the same name!
The generated classes have the same method, but with different parameter.

When this is used we will get a Classcast exception at runtime for one of them. 

Some more details:

The classes look like this:

@WebService(name = "QueryServiceLundnorPrs", targetNamespace = "/",
serviceName = "QueryServiceLundnorPrs")
public class QueryServiceLundnorPrs extends QueryService {

    public VLundnorPrsPob[] getPob( @WebParam(name = "where") String where) {
        return query(VLundnorPrsPob.class, "V_LUNDNOR_PRS_POB", where);


and this:

@WebService(name = "QueryServiceLundnorOp", targetNamespace = "/",
serviceName = "QueryServiceLundnorOp", wsdlLocation= "/wsdl/QueryServiceLundnorOp.wsdl")
public class QueryServiceLundnorOp extends QueryService {

    public VLundnorOpPob[] getPob( @WebParam(name = "where") String where) {
        return query(VLundnorOpPob.class, "V_LUNDNOR_OP_POB", where);


At runtime we got:
java.lang.IllegalArgumentException: java.lang.ClassCastException@55782624 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.apache.cxf.databinding.AbstractWrapperHelper.createWrapperObject(
at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(

I modified the AbstractWrapperHelper.createWrapperObject in cxf-core-3.1.6.jar in WildFly
to output the name and class of the object that was called with generics, and same for its

When running with an ear-directory in Eclipse:

When running with a proper ear file:

The first part is the common package. The last part is the @WebMethod, I assume, but there
is nothing to indicate the @WebService class.

The result is that for two different @WebService classes a wrapper class with the same name
is generated, and this gives classcast exceptions.

We have fixed our problem by moving each web service class to its own package.

This message was sent by Atlassian JIRA

View raw message