Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BusDeploymentAspect creates CXF DefaultBus using wrong class loader #2670

Closed
ppalaga opened this issue Oct 5, 2018 · 0 comments
Closed

BusDeploymentAspect creates CXF DefaultBus using wrong class loader #2670

ppalaga opened this issue Oct 5, 2018 · 0 comments
Assignees
Labels
Milestone

Comments

@ppalaga
Copy link
Collaborator

ppalaga commented Oct 5, 2018

org.jboss.wsf.stack.cxf.deployment.aspect.BusDeploymentAspect.start() [1] is probably triggered by some WS annotation. It sets a class loader of org.jboss.ws.jaxws-client which is then effective for all calls to org.apache.cxf.bus.extension.ExtensionManagerImpl.getBean[s]OfType() which in turn returns the jboss-ws implementation of HttpDestinationFactory intead of ours. This turns out to be a problem for CXF RS tests using https endpoints. A stack trace like this occurs:

jboss.deployment.unit."CXFRSBasicSecureProducerIntegrationTest.war".WeldStartService: Failed to start service
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1728)
	at org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1556)
	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.jboss.weld.exceptions.DeploymentException: Failed to create route route4: Route(route4)[[From[https://localhost:xxxxxx@0x2a0d0a9c]]] because of ServiceConstructionException
	at org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:38)
	at org.jboss.weld.bootstrap.events.AfterDeploymentValidationImpl.fire(AfterDeploymentValidationImpl.java:28)
	at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:499)
	at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:93)
	at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:98)
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1736)
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1698)
	... 6 more
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create route route4: Route(route4)[[From[https://localhost:xxxxxx@0x2a0d0a9c]]] because of ServiceConstructionException
	at org.apache.camel.impl.RouteService.warmUp(RouteService.java:147)
	at org.apache.camel.impl.DefaultCamelContext.doWarmUpRoutes(DefaultCamelContext.java:3949)
	at org.apache.camel.impl.DefaultCamelContext.safelyStartRouteServices(DefaultCamelContext.java:3856)
	at org.apache.camel.impl.DefaultCamelContext.doStartOrResumeRoutes(DefaultCamelContext.java:3642)
	at org.apache.camel.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:3494)
	at org.apache.camel.impl.DefaultCamelContext.access$000(DefaultCamelContext.java:209)
	at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3253)
	at org.apache.camel.impl.DefaultCamelContext$2.call(DefaultCamelContext.java:3249)
	at org.apache.camel.impl.DefaultCamelContext.doWithDefinedClassLoader(DefaultCamelContext.java:3272)
	at org.apache.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:3249)
	at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
	at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:3165)
	at org.apache.camel.impl.DefaultCamelContext$Proxy$_$$_WeldClientProxy.start(Unknown Source)
	at org.apache.camel.cdi.CdiCamelExtension.afterDeploymentValidation(CdiCamelExtension.java:425)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:95)
	at org.jboss.weld.injection.MethodInvocationStrategy$SpecialParamPlusBeanManagerStrategy.invoke(MethodInvocationStrategy.java:144)
	at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:330)
	at org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(ExtensionObserverMethodImpl.java:123)
	at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:308)
	at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:286)
	at javax.enterprise.inject.spi.ObserverMethod.notify(ObserverMethod.java:124)
	at org.jboss.weld.util.Observers.notify(Observers.java:166)
	at org.jboss.weld.event.ObserverNotifier.notifySyncObservers(ObserverNotifier.java:285)
	at org.jboss.weld.event.ObserverNotifier.notify(ObserverNotifier.java:273)
	at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:177)
	at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:171)
	at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:53)
	at org.jboss.weld.bootstrap.events.AbstractDeploymentContainerEvent.fire(AbstractDeploymentContainerEvent.java:35)
	... 12 more
Caused by: org.apache.cxf.service.factory.ServiceConstructionException
	at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:225)
	at org.apache.camel.component.cxf.jaxrs.CxfRsConsumer.createServer(CxfRsConsumer.java:62)
	at org.apache.camel.component.cxf.jaxrs.CxfRsConsumer.<init>(CxfRsConsumer.java:40)
	at org.apache.camel.component.cxf.jaxrs.CxfRsEndpoint.createConsumer(CxfRsEndpoint.java:191)
	at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:69)
	at org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:107)
	at org.apache.camel.impl.RouteService.doWarmUp(RouteService.java:172)
	at org.apache.camel.impl.RouteService.warmUp(RouteService.java:145)
	... 43 more
Caused by: java.lang.RuntimeException: java.io.IOException: Protocol mismatch for port 8443: engine's protocol is http, the url protocol is https
	at org.jboss.wsf.stack.cxf.addons.transports.undertow.UndertowServerDestination.finalizeConfig(UndertowServerDestination.java:83)
	at org.apache.cxf.transport.http.HTTPTransportFactory.getDestination(HTTPTransportFactory.java:288)
	at org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:84)
	at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:63)
	at org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:173)
	... 50 more
Caused by: java.io.IOException: Protocol mismatch for port 8443: engine's protocol is http, the url protocol is https
	at org.jboss.wsf.stack.cxf.addons.transports.undertow.UndertowServerEngineFactory.createHttpServerEngine(UndertowServerEngineFactory.java:119)
	at org.jboss.wsf.stack.cxf.addons.transports.undertow.UndertowServerDestination.finalizeConfig(UndertowServerDestination.java:79)
	... 54 more

CXFRSBasicSecureProducerIntegrationTest from #2661 demonstrates the issue, but only if it is run after e.g. CXFWSSecureProducerIntegrationTest

[1] https://github.com/jbossws/jbossws-cxf/blob/ab7866bfe647db4fa114f5eb28ec1217a2817a3d/modules/server/src/main/java/org/jboss/wsf/stack/cxf/deployment/aspect/BusDeploymentAspect.java#L57

@ppalaga ppalaga added the bug label Oct 5, 2018
@ppalaga ppalaga self-assigned this Oct 5, 2018
@jamesnetherton jamesnetherton added this to the 8.1.0 milestone Oct 5, 2018
ppalaga added a commit to ppalaga/wildfly-camel that referenced this issue Oct 8, 2018
ppalaga added a commit to ppalaga/wildfly-camel that referenced this issue Oct 16, 2018
ppalaga added a commit to ppalaga/wildfly-camel that referenced this issue Oct 18, 2018
ppalaga added a commit to ppalaga/wildfly-camel that referenced this issue Oct 19, 2018
ppalaga added a commit to ppalaga/wildfly-camel that referenced this issue Oct 19, 2018
ppalaga added a commit to ppalaga/wildfly-camel that referenced this issue Oct 19, 2018
tdiesler pushed a commit that referenced this issue Jan 8, 2019
tdiesler pushed a commit that referenced this issue Jan 8, 2019
tdiesler pushed a commit that referenced this issue Apr 15, 2020
tdiesler pushed a commit that referenced this issue Apr 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants