On Thursday, March 01, 2012 7:41:51 PM Stevo Slavić wrote: > Hello cxf users, > > Same pom with same cxf-codegen-plugin configuration - for yet undetermined > reason, maven on command line produces jax-ws 2.1 compliant code, while m2e > in eclipse produces jax-ws 2.2 compliant code. Eclipse then complains on > m2e generated code, since generated services have those jax-ws 2.2 > constructors with features varargs, while those are not supported in jax-ws > 2.1 which eclipse classloader seems to find first from Java 6 runtime. > > Any tips how to check why does cxf 2.3.1 generate jax-ws 2.2 compliant code > in one case and jax-ws 2.1 compliant code in the other?
It's basically a matter of which JAX-WS API jar it finds. I assume you are using Java6 which has the jax-ws 2.1 api built in so when run from the command line, it's finding that and thus generating 2.1 compliant code. From eclipse, the classpath eclipse is setting up may be setting it differently and finding the 2.2 version and thus 2.2 compliant code is generated. > Even if I make it consistent to generate jax-ws 2.2 compliant code always, > how to make eclipse/m2e compile it. You would have to "endorse" the jars. I think you would have to go the preferences installed JRE's panel and modify the JRE flags to have it add the proper endorsed flag. Not really sure though. Alternatively, add the 2.2 api jar to your jre/lib/endorsed dir would likely do it (for command line as well). > Target application server has jax-ws 2.2 libs. > > To make eclipse happy I think my best shot would be to to configure > cxf-codegen-plugin to generate jax-ws 2.1 compliant code consistently. For > that I've configured two extraargs, "-fe" and "jaxws21". Build then fails > with following error: That flag was added long after CXF 2.3.1. Likely need a newer version of CXF. Dan > "Failed to execute goal org.apache.cxf:cxf-codegen-plugin:2.3.1:wsdl2java > (generate-sources-proxy) on project foo-bar: Could not find jaxws21 > frontend within classpath" > > Which dependency do I have to add for this to pass? Should I add it to > cxf-codegen-plugin dependencies only or to the project dependencies too? > > Is it better to use newer version of cxf-codegen-plugin and configure it to > generate jaxws21 compatible code or use older one that generates by default > jaxws21 compliant code? > > If I can see well by dependencies in cxf-parent pom, > cxf-codegen-plugin:2.2.12 should be newest one that by default generates > jaxws21 compliant code. > I've tried downgrading cxf-codegen-plugin to that 2.2.12 version - same > jaxws 2.2 compliant code gets generated in eclipse/m2e. > > Environment: > - Maven 3.0.3 > - m2e 1.0.100 > - cxf-codegen-plugin 2.3.1 > - java 1.6 update 30 > - eclipse ide 3.7 SR2 > > Kind regards, > Stevo. > > > > P. S. > Just upgraded to cxf-codegen-plugin 2.3.9, and configured "-fe" and > "jaxws21" extraargs and jax-ws 2.1 compliant code got generated. -- Daniel Kulp [email protected] - http://dankulp.com/blog Talend Community Coder - http://coders.talend.com
