You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Ariel Carrera (Jira)" <ji...@apache.org> on 2020/09/03 17:52:00 UTC

[jira] [Issue Comment Deleted] (CXF-7167) Generated wrapper classes overwrite each other

     [ https://issues.apache.org/jira/browse/CXF-7167?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ariel Carrera updated CXF-7167:
-------------------------------
    Comment: was deleted

(was: Same problem, Do you have any workaround?)

> Generated wrapper classes overwrite each other
> ----------------------------------------------
>
>                 Key: CXF-7167
>                 URL: https://issues.apache.org/jira/browse/CXF-7167
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 3.1.6
>         Environment: Wildfly 10.1.0, Windows
>            Reporter: Guttorm Vik
>            Priority: Major
>
> 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:
> {code}
> package com.ec.os.webservices.model.ejb.query;
> @WebService(name = "QueryServiceLundnorPrs", targetNamespace = "/com.ec.os.webservices/em/query", serviceName = "QueryServiceLundnorPrs")
> public class QueryServiceLundnorPrs extends QueryService {
>     @WebMethod
>     @WebResult(name="POB")
>     public VLundnorPrsPob[] getPob( @WebParam(name = "where") String where) {
>         return query(VLundnorPrsPob.class, "V_LUNDNOR_PRS_POB", where);
>     }
> }
> {code}
> and this:
> {code}
> package com.ec.os.webservices.model.ejb.query;
> @WebService(name = "QueryServiceLundnorOp", targetNamespace = "/com.ec.os.webservices/lundnorOp/query", serviceName = "QueryServiceLundnorOp", wsdlLocation= "/wsdl/QueryServiceLundnorOp.wsdl")
> public class QueryServiceLundnorOp extends QueryService {
>     @WebMethod
>     @WebResult(name="POB")
>     public VLundnorOpPob[] getPob( @WebParam(name = "where") String where) {
>         return query(VLundnorOpPob.class, "V_LUNDNOR_OP_POB", where);
>     }
> }
> {code}
> At runtime we got:
> {code}
> java.lang.IllegalArgumentException: java.lang.ClassCastException@55782624 
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.apache.cxf.databinding.AbstractWrapperHelper.createWrapperObject(AbstractWrapperHelper.java:114)
> at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:91)
> {code}
> 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 parameters.
> When running with an ear-directory in Eclipse:
> com.ec.os.webservices.model.ejb.query.jaxws_asm.GetPobResponse
> When running with a proper ear file:
> com.ec.os.webservices.model.ejb.query.jaxws.GetPobResponse
> 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
(v8.3.4#803005)