Alexander Kosarev created CXF-7932:
--------------------------------------
Summary: JaxWsDynamicClientFactory in Spring Boot fat JAR with
JDK11 leads to JAXBException ... doesnt contain ObjectFactory.class or
jaxb.index
Key: CXF-7932
URL: https://issues.apache.org/jira/browse/CXF-7932
Project: CXF
Issue Type: Bug
Components: JAX-WS Runtime, JAXB Databinding
Affects Versions: 3.2.7
Environment: OpenJDK 11
Reporter: Alexander Kosarev
Attachments: sandbox-springboot-cxf-ws.zip
I have a project based on Spring Boot and packaged as a fat JAR. When I try to
run the application with Java 11, JaxWsDynamicClientFactory.createClient(...)
leads to an error like 'javax.xml.bind.JAXBException: "..." doesnt contain
ObjectFactory.class or jaxb.index'.
{code:java}
Caused by: java.lang.IllegalStateException: Unable to create JAXBContext for
generated packages: "net.gcomputer.webservices" doesnt contain
ObjectFactory.class or jaxb.index
at
org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:417)
~[cxf-rt-frontend-simple-3.2.7.jar!/:3.2.7]
at
org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:244)
~[cxf-rt-frontend-simple-3.2.7.jar!/:3.2.7]
at
org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:237)
~[cxf-rt-frontend-simple-3.2.7.jar!/:3.2.7]
at
org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:192)
~[cxf-rt-frontend-simple-3.2.7.jar!/:3.2.7]
at
name.alexkosarev.sandbox.SandboxSpringbootCxfWsApplication.lambda$commandLineRunner$0(SandboxSpringbootCxfWsApplication.java:33)
[classes!/:1.0.0]
at
org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:813)
[spring-boot-2.1.1.RELEASE.jar!/:2.1.1.RELEASE]
... 13 common frames omitted
Caused by: javax.xml.bind.JAXBException: "net.gcomputer.webservices" doesnt
contain ObjectFactory.class or jaxb.index
at
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:284)
~[jaxb-runtime-2.3.0.jar!/:2.3.0]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method) ~[na:na]
at
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
~[na:na]
at
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:217)
~[jaxb-api-2.3.1.jar!/:2.3.0]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:175)
~[jaxb-api-2.3.1.jar!/:2.3.0]
at javax.xml.bind.ContextFinder.find(ContextFinder.java:353)
~[jaxb-api-2.3.1.jar!/:2.3.0]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:508)
~[jaxb-api-2.3.1.jar!/:2.3.0]
at
org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:413)
~[cxf-rt-frontend-simple-3.2.7.jar!/:3.2.7]
... 18 common frames omitted
{code}
Startup command looks like:
{code:java}
java -jar application.jar
{code}
Problem doesn't appear if I use 'exploded' (unzipped) JAR instead of fat.
Startup command looks like:
{code:java}
java -classpath "/path/to/BOOT-INF/classes:/path/to/BOOT-INF/lib/*"
my.main.ClassName{code}
Problem also doesn't appear if I run the application with Java 8 (with both
jars).
[~snicoll] suggested to post it here, because "it might be related to the way
the resources is located".
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)