Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
None
-
None
-
Unknown
-
Patch
Description
Background: we use CXF 3.3.9 via apache camel 2.25
Our internal system provides single WSDL file every release which contains roughly 30 interfaces and produces about 3.2K classes. When using regular JAXBDatabinding implementation we found that it rescans the classes every time we attempt to create one of those interfaces endpoint when we use new instances of JAXBDatabinding. When we reuse an existing instance of JAXBDatabinding, there's a check in it that prevents expanding the class list in existing context:
// context is already set, don't redo it if (context != null) { return; }
and as a result, it crashes with the following error
org.apache.camel.RuntimeCamelException: org.apache.cxf.service.factory.ServiceConstructionException: Service class se.foo.schemas.bar.webservices.wsdl.BenefitInterface method getBenefit part {http://schemas.foo.se/bar/WebServices/wsdl}request cannot be mapped to schema. Check for use of a JAX-WS-specific type without the JAX-WS service factory bean. at org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1826) at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:136) at org.apache.camel.spring.SpringCamelContext.onApplicationEvent(SpringCamelContext.java:174) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:398) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:355) at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:882) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:163) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549) at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) at se.internal.integration.bar.configuration.IntegrationBarApplication.main(IntegrationBarApplication.java:22) 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.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) Caused by: org.apache.cxf.service.factory.ServiceConstructionException: Service class se.foo.schemas.bar.webservices.wsdl.BenefitInterface method getBenefit part {http://schemas.foo.se/bar/WebServices/wsdl}request cannot be mapped to schema. Check for use of a JAX-WS-specific type without the JAX-WS service factory bean. at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.createBareMessage(ReflectionServiceFactoryBean.java:1266) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:479) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:693) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:529) at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:262) at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199) at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:103) at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91) at org.apache.camel.component.cxf.CxfEndpoint.createClient(CxfEndpoint.java:649) at org.apache.camel.component.cxf.CxfProducer.doStart(CxfProducer.java:84) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:72) at org.apache.camel.impl.SynchronousDelegateProducer.start(SynchronousDelegateProducer.java:66) at org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:75) at org.apache.camel.impl.DeferServiceStartupListener.onCamelContextStarted(DeferServiceStartupListener.java:49) at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3868) at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3647) at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3488) at org.apache.camel.impl.DefaultCamelContext$4.call(DefaultCamelContext.java:3247) at org.apache.camel.impl.DefaultCamelContext$4.call(DefaultCamelContext.java:3243) at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3266) at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3243) at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:72) at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3159) at org.apache.camel.spring.SpringCamelContext.start(SpringCamelContext.java:133) ... 21 common frames omitted
I've attached the changes patch that would be made to existing JAXBDatabinding class to support the expanding internal cache. I'm sure that the cachedjaxbdatabinding breaks some existing concerns.
Looking through existing tests that refer to JAXBDatabinding class it seems I would have to duplicate quite a few of them. Is there a TCK that could be used for JAXBDatabinding implementations instead?
Attachments
Attachments
Issue Links
- links to