Hi Aled, jakarta.xml.bind-api bundle installed as dependency from cxf-specs feature. In case step-by step setup its not activated:
> feature:repo-add cxf 3.3.4 > feature:install http cxf-jaxws > package:exports | grep javax.xml.bind.annotation javax.xml.bind.annotation.adapters | 2.2.8 | 0 | org.apache.felix.framework javax.xml.bind.annotation | 2.2.8 | 0 | org.apache.felix.framework To avoid package version range javax.xml.bind.annotation;version="[2.3,3)" build your bunlde specifying 'javax.xml.bind.annotation' as Import-Package (without version range). In this case package from 'org.apache.felix.framework' bundle should be used. On 12/5/19, Aled Sage <[email protected]> wrote: > Hi all, > > I'm a committer on the Apache Brooklyn [1] and the winrm4j [2] projects. > > We're upgrading Apache Brooklyn to Karaf 4.2.7 for the next release, and > have hit a big problem trying to upgrade CXF to 3.3.2 (from 3.2.8). > > We'd appreciate some help and advice for how to fix or work around this. > > There is a lot more details (including of the error investigation) in > this Apache Brooklyn email thread: [3]. > > We're now getting an IllegalAnnotationsException, with the underlying > error: > > Two classes have the same XML type name > "{http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd}objectFactory". Use > @XmlType.name and @XmlType.namespace to assign different names to them. > > It works when run outside of Karaf. > > Comparing the OSGi bundles and package exports/imports, I'm guessing the > underlying problem is that javax.xml.bind.annotation.XMLRegistry is now > coming from two places: > > package:exports | grep javax.xml.bind.annotation > javax.xml.bind.annotation.adapters │ 2.2.8 │ 0 │ > org.apache.felix.framework > javax.xml.bind.annotation.adapters │ 2.3.2 │ 108 │ > jakarta.xml.bind-api > javax.xml.bind.annotation │ 2.2.8 │ 0 │ > org.apache.felix.framework > javax.xml.bind.annotation │ 2.3.2 │ 108 │ > jakarta.xml.bind-api > > The jakarta.xml.bind-api bundle wasn't in our Karaf distro before - only > since we upgrade CXF (it comes from the feature cxf-specs, version 3.3.2). > > The winrm4j-client OSGi bundle is also being upgraded to use CXF 3.3.2 - > its package import is from jakarta.xml.bind-api. > > --- > > The stack trace is: > > 2019-12-03T11:44:16,468 wmhGA3U2-[ut059oi7tk,ltajipcuun] WARN 103 > i.c.w.c.WinRmClient [ager-Ak6FHXbO-32] Error creating WinRm service with > mbean strategy (trying other strategies): > org.apache.cxf.service.factory.ServiceConstructionException > org.apache.cxf.service.factory.ServiceConstructionException: null > at > org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:355) > ~[!/:3.3.2] > at > org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86) > > ~[!/:3.3.2] > at > org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromWSDL(ReflectionServiceFactoryBean.java:426) > > ~[!/:3.3.2] > at > org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:528) > > ~[!/:3.3.2] > at > org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:263) > > ~[!/:3.3.2] > at > org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199) > > ~[?:?] > at > org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:103) > > ~[!/:3.3.2] > at > org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91) > > ~[!/:3.3.2] > at > org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:159) > > ~[!/:3.3.2] > at > org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142) > > ~[?:?] > at > org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:95) > > ~[!/:3.3.2] > at > io.cloudsoft.winrm4j.client.WinRmFactory.doCreateServiceWithBean(WinRmFactory.java:97) > > ~[!/:?] > <snip> > Caused by: > com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 2 > counts of IllegalAnnotationExceptions > at > com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:91) > > ~[?:1.8.0_201] > at > com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:445) > > ~[?:1.8.0_201] > at > com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:277) > > ~[?:1.8.0_201] > at > com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:124) > > ~[?:1.8.0_201] > at > com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1123) > > ~[?:1.8.0_201] > at > com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:147) > > ~[?:1.8.0_201] > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > ~[?:1.8.0_201] > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > > ~[?:1.8.0_201] > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > > ~[?:1.8.0_201] > at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_201] > at > javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:222) > ~[?:1.8.0_201] > at javax.xml.bind.ContextFinder.find(ContextFinder.java:396) > ~[?:1.8.0_201] > at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:641) > ~[?:1.8.0_201] > at > org.apache.cxf.common.jaxb.JAXBContextCache.createContext(JAXBContextCache.java:357) > > ~[!/:3.3.2] > at > org.apache.cxf.common.jaxb.JAXBContextCache.getCachedContextAndSchemas(JAXBContextCache.java:246) > > ~[!/:3.3.2] > at > org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContextAndSchemas(JAXBDataBinding.java:498) > > ~[!/:3.3.2] > at > org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:353) > ~[!/:3.3.2] > ... 43 more > > Aled > > [1] > https://lists.apache.org/thread.html/ead4351d187f7d7e7c257cb47f2490b3139d0de8d6fe15c43beea4d3%40%3Cdev.brooklyn.apache.org%3E > > [2] https://github.com/cloudsoft/winrm4j/ > > [3] FIXME mailing list link > >
