eclipse-ee4j / metro-jax-ws

metro-jax-ws
https://eclipse-ee4j.github.io/metro-jax-ws/
BSD 3-Clause "New" or "Revised" License
72 stars 40 forks source link

jaxws-maven-plugin 3.0.0 incompatible with jaxb2-basics #279

Open RomainPruvostMHH opened 3 years ago

RomainPruvostMHH commented 3 years ago

Hi,

In your example here https://eclipse-ee4j.github.io/metro-jax-ws/jaxws-maven-plugin/examples/using-jaxb-plugins.html, you suggest to use the library org.jvnet.jaxb2_commons:jaxb2-basics to enable xjc-plugins. But it doesn't work because jaxb2-basics is using the ol Jaxb implementation (javax.xml.bind.*). I tested your example and I got this error :

[INFO] --- jaxws-maven-plugin:3.0.0:wsimport (default) @ client ---
[INFO] Processing: file:/C:/client-ws-soap/src/main/resources/wsdl/sample.wsdl
[INFO] jaxws:wsimport args: [-keep, -s, 'C:\client-ws-soap\target\generated-sources\wsimport', -d, 'C:\client-ws-soap\target\classes', -encoding, UTF-8, -Xnocompile, -p, com.client, -wsdllocation, /wsdl/sample.wsdl, -B-XtoString, -b, 'C:\client-ws-soap\src\main\resources\binding\binding-score-decision.xml', "file:/C:/client-ws-soap/src/main/resources/wsdl/sample.wsdl"]
analyse du WSDL...

Exception in thread "main" java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.jvnet.jax_ws_commons.jaxws.Invoker.main(Invoker.java:74)
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
    at org.jvnet.jaxb2_commons.plugin.inheritance.InheritancePlugin.getCustomizationElementNames(InheritancePlugin.java:40)
    at org.jvnet.jaxb2_commons.plugin.AbstractPlugin.getCustomizationURIs(AbstractPlugin.java:98)
    at com.sun.tools.xjc.reader.AbstractExtensionBindingChecker.<init>(AbstractExtensionBindingChecker.java:71)
    at com.sun.tools.xjc.reader.ExtensionBindingChecker.<init>(ExtensionBindingChecker.java:51)
    at com.sun.tools.xjc.ModelLoader$XMLSchemaParser.parse(ModelLoader.java:205)
    at com.sun.xml.xsom.impl.parser.NGCCRuntimeEx.parseEntity(NGCCRuntimeEx.java:351)
    at com.sun.xml.xsom.impl.parser.ParserContext.parse(ParserContext.java:98)
    at com.sun.xml.xsom.impl.parser.ParserContext.<init>(ParserContext.java:74)
    at com.sun.xml.xsom.parser.XSOMParser.<init>(XSOMParser.java:83)
    at com.sun.tools.xjc.ModelLoader.createXSOMParser(ModelLoader.java:378)
    at com.sun.tools.xjc.ModelLoader.createXSOMParser(ModelLoader.java:386)
    at com.sun.tools.xjc.ModelLoader.createXSOM(ModelLoader.java:468)
    at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:239)
    at com.sun.tools.xjc.api.impl.s2j.SchemaCompilerImpl.bind(SchemaCompilerImpl.java:65)
    at com.sun.tools.ws.processor.modeler.wsdl.JAXBModelBuilder.bind(JAXBModelBuilder.java:112)
    at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildJAXBModel(WSDLModeler.java:2268)
    at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.internalBuildModel(WSDLModeler.java:168)
    at com.sun.tools.ws.processor.modeler.wsdl.WSDLModeler.buildModel(WSDLModeler.java:111)
    at com.sun.tools.ws.wscompile.WsimportTool.buildWsdlModel(WsimportTool.java:414)
    at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:175)
    at com.sun.tools.ws.wscompile.WsimportTool.run(WsimportTool.java:153)
    ... 5 more
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
    at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)

Did you know a solution to generate the toString method without the library org.jvnet.jaxb2_commons:jaxb2-basics ?

kind regards, Romain

baromojm commented 1 year ago

Hi: I'm now facing the same issue. Did you ever find a solution? Thanks,

laurentschoelens commented 10 months ago

Hello, by searching some info about the jaxws-maven-plugin, found this issue.
You can now use the latest version of jaxb2-basics which is now part of the jaxb-tools repository (former repository of only the maven-jaxb2-plugin)

You can follow the migration guide on how to get the latest version and new groupId/artifactId associated with former versions.

Feel free to contact us if needed 😉