This problem occur in newer version of servicemix(tested on 5.4 - cxf 3.0.2 and 5.3 - cxf 2.7.11) in older version 4.5.2 with cxf 2.6.8 everything works, webservices are created.
In our project we have a lot of different webservices generated by maven plugin wsdl2java in diffrent bundles. In servicemix 5.4 almost all webservices are down due to those errors, strange is that in previous servicemix 5.3 one of bundle is able to start without any modification in project.
In maven I tried use additional extraarg:
<extraarg>-autoNameResolution</extraarg>
<extraarg>-xjc-npa</extraarg>
But without any result
Stacktrace:
Unable to start blueprint container for bundle bundle-name1
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to initialize bean .camelBlueprint.factory.camelContext
at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:714)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:824)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[19:org.apache.aries.blueprint.core:1.4.1]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:230)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:145)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BlueprintContainerImpl.getComponentInstance(BlueprintContainerImpl.java:753)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.camel.blueprint.handler.CamelNamespaceHandler$CamelDependenciesFinder.process(CamelNamespaceHandler.java:863)[105:org.apache.camel.camel-blueprint:2.13.2]
at org.apache.aries.blueprint.container.BlueprintContainerImpl.processProcessors(BlueprintContainerImpl.java:528)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:361)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:269)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:276)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:245)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:235)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[14:org.apache.aries.util:1.1.0]
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[14:org.apache.aries.util:1.1.0]
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[14:org.apache.aries.util:1.1.0]
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[14:org.apache.aries.util:1.1.0]
at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)[14:org.apache.aries.util:1.1.0]
at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1127)[org.apache.felix.framework-4.4.1.jar:]
at org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:696)[org.apache.felix.framework-4.4.1.jar:]
at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:484)[org.apache.felix.framework-4.4.1.jar:]
at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4429)[org.apache.felix.framework-4.4.1.jar:]
at org.apache.felix.framework.Felix.startBundle(Felix.java:2100)[org.apache.felix.framework-4.4.1.jar:]
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1299)[org.apache.felix.framework-4.4.1.jar:]
at org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:304)[org.apache.felix.framework-4.4.1.jar:]
at java.lang.Thread.run(Thread.java:722)[:1.7.0_21]
Caused by: org.apache.camel.NoSuchBeanException: Cannot lookup: routeBuilder from registry: org.apache.camel.blueprint.BlueprintContainerRegistry@597012f0 with expected type: interface org.apache.camel.RoutesBuilder due: Error when instantiating bean ****CxfClient of class ***.***.***.***.***.***.***.***
at org.apache.camel.impl.CompositeRegistry.lookupByNameAndType(CompositeRegistry.java:62)
at org.apache.camel.impl.PropertyPlaceholderDelegateRegistry.lookupByNameAndType(PropertyPlaceholderDelegateRegistry.java:63)
at org.apache.camel.util.CamelContextHelper.lookup(CamelContextHelper.java:129)
at org.apache.camel.model.RouteBuilderDefinition.createRoutes(RouteBuilderDefinition.java:70)
at org.apache.camel.core.xml.AbstractCamelContextFactoryBean.installRoutes(AbstractCamelContextFactoryBean.java:750)
at org.apache.camel.core.xml.AbstractCamelContextFactoryBean.setupRoutes(AbstractCamelContextFactoryBean.java:311)
at org.apache.camel.blueprint.CamelContextFactoryBean.afterPropertiesSet(CamelContextFactoryBean.java:304)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_21]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_21]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_21]
at java.lang.reflect.Method.invoke(Method.java:601)[:1.7.0_21]
at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:297)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:958)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:712)[19:org.apache.aries.blueprint.core:1.4.1]
... 30 more
Caused by: org.osgi.service.blueprint.container.ComponentDefinitionException: Error when instantiating bean ****CxfClient of class ***.***.***.***.***.***.***.***
at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:300)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:806)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[19:org.apache.aries.blueprint.core:1.4.1]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:268)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:806)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[19:org.apache.aries.blueprint.core:1.4.1]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:62)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:106)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:933)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:907)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:888)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:820)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:787)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[19:org.apache.aries.blueprint.core:1.4.1]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)[:1.7.0_21]
at java.util.concurrent.FutureTask.run(FutureTask.java:166)[:1.7.0_21]
at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:245)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:230)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:145)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BlueprintContainerImpl.getComponentInstance(BlueprintContainerImpl.java:753)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.camel.blueprint.BlueprintContainerRegistry.lookupByNameAndType(BlueprintContainerRegistry.java:54)
at org.apache.camel.impl.CompositeRegistry.lookupByNameAndType(CompositeRegistry.java:56)
... 43 more
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:341)
at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:490)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:704)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:550)
at org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:265)
at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:215)
at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)
at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91)
at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:157)
at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.7.0_21]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)[:1.7.0_21]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_21]
at java.lang.reflect.Method.invoke(Method.java:601)[:1.7.0_21]
at org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:297)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:958)[19:org.apache.aries.blueprint.core:1.4.1]
at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:298)[19:org.apache.aries.blueprint.core:1.4.1]
... 75 more
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "{http://***.***.***.***/***/***/***}objectFactory". Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
at ***.***.***.***.***.***.***.ObjectFactory
this problem is related to the following location:
at 1***.1***.1***.1***.1***.1***.1***.ObjectFactory
Two classes have the same XML type name "{http://***.***.***.***/***/***/***}objectFactory". Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
at ***.***.***.***.***.***.***.ObjectFactory
this problem is related to the following location:
at 1***.1***.1***.1***.1***.ObjectFactory
at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:472)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:302)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1140)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:154)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:121)
at sun.reflect.GeneratedMethodAccessor70.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.7.0_21]
at java.lang.reflect.Method.invoke(Method.java:601)[:1.7.0_21]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:222)[:2.4.0]
at javax.xml.bind.ContextFinder.find(ContextFinder.java:396)[:2.4.0]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:656)[:2.4.0]
at org.apache.cxf.common.jaxb.JAXBContextCache$2.run(JAXBContextCache.java:345)
at org.apache.cxf.common.jaxb.JAXBContextCache$2.run(JAXBContextCache.java:343)
at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_21]
at org.apache.cxf.common.jaxb.JAXBContextCache.createContext(JAXBContextCache.java:343)
at org.apache.cxf.common.jaxb.JAXBContextCache.getCachedContextAndSchemas(JAXBContextCache.java:244)
at org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContextAndSchemas(JAXBDataBinding.java:484)
at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:339)
... 92 more
EDIT
I tried to downgrade cxf to 2.6.8 but i get the same errors so, I suppose the problem is somewhere else maybe in org.apache.aries.blueprint.core.
EDIT 2
I also tried to create one big bundle with all generated classes but problem is the same
In case you generate your ws-client code via the cxf-codegen-plugin
, you could separate the package names of your ws-client bundles/parts with a specific configuration. I achieved something similar in one of my projects like so:
...
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${basedir}/src/main/gen</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/MyWSEndpoint1.wsdl</wsdl>
<extraargs>
<extraarg>-client</extraarg>
<!--
<extraarg>-validate</extraarg>
-->
<extraarg>-p</extraarg>
<extraarg>com.acme.ws.jaxb.ns1</extraarg>
<extraarg>-wsdlLocation</extraarg>
<extraarg></extraarg>
</extraargs>
</wsdlOption>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/MyWSEndpoint2.wsdl</wsdl>
<extraargs>
<extraarg>-client</extraarg>
<!--
<extraarg>-validate</extraarg>
-->
<extraarg>-p</extraarg>
<extraarg>com.acme.ws.jaxb.ns2</extraarg>
<extraarg>-wsdlLocation</extraarg>
<extraarg></extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
...
Thus, "individual" packages for each ws-client specific {http://***.***.***.***/***/***/***}objectFactory
should be generated which might help to avoid conflicts during the code generation phase. Thereby, at runtime, no NameSpace-related issues should be blocking you.
Keep in mind that com.acme.ws.jaxb.ns1
and com.acme.ws.jaxb.ns2
are only suggestions and that you could use whatever seems valid for your project there.
See also Apache CXF - WSDL to Java
-p [ wsdl-namespace= ] PackageName
Specifies zero, or more, package names to use for the generated code. Optionally > specifies the WSDL namespace to package name mapping.
Comments welcome.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With