How to supply SSLContext to undertow websocket
by levk
I'm writing an application I'm packaging as a war using maven that needs
to make client side websocket connection via SSL. I saw
http://lists.jboss.org/pipermail/undertow-dev/2016-March.txt and I'm
trying to follow door number two, that is to implement
io.undertow.websockets.jsr.WebsocketClientSslProvider and make the
appropriate addition to META-INF/services. Undertow finds my class just
fine but is unable to load it.
I add dependency on the undertow-websockets-jsr scoped provided since I
hope it is provided by the container:
<dependency>
<groupId>io.undertow</groupId>
<artifactId>undertow-websockets-jsr</artifactId>
<version>1.2.9.Final</version>
<scope>provided</scope>
</dependency>
This yields in the following exception:
Caused by: java.lang.NoClassDefFoundError: org/xnio/ssl/XnioSsl
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
at java.lang.Class.getConstructor0(Class.java:3075)
at java.lang.Class.newInstance(Class.java:412)
at
java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
... 14 more
Caused by: java.lang.ClassNotFoundException: org.xnio.ssl.XnioSsl from
[Module "deployment.turborabbit.war:main" from Service Module Loader]
at
org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at
org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at
org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
... 19 more
I don't think I should be adding any runtime jars to my project, but for
the sake of argument I tried adding the xnio jar containing XnioSsl as
follows:
<dependency>
<groupId>org.jboss.xnio</groupId>
<artifactId>xnio-api</artifactId>
<version>3.3.1.Final</version>
</dependency>
Which now yields this exception:
Caused by: java.lang.LinkageError: loader constraint violation: loader
(instance of org/jboss/modules/ModuleClassLoader) previously initiated
loading for a different type with name "org/xnio/XnioWorker"
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetPublicMethods(Class.java:2902)
at java.lang.Class.privateGetPublicMethods(Class.java:2911)
at java.lang.Class.getMethods(Class.java:1615)
at org.jboss.resteasy.cdi.Utils.isJaxrsAnnotatedClass(Utils.java:39)
at org.jboss.resteasy.cdi.Utils.isJaxrsResource(Utils.java:63)
at org.jboss.resteasy.cdi.Utils.isJaxrsComponent(Utils.java:85)
at
org.jboss.resteasy.cdi.ResteasyCdiExtension.observeInjectionTarget(ResteasyCdiExtension.java:170)
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:497)
at
org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:88)
... 26 more
at
org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:44)
at
org.jboss.weld.bootstrap.events.AbstractProcessInjectionTarget.fire(AbstractProcessInjectionTarget.java:33)
at
org.jboss.weld.bootstrap.events.ContainerLifecycleEvents.fireProcessInjectionTarget(ContainerLifecycleEvents.java:249)
at
org.jboss.weld.bootstrap.AbstractBeanDeployer.fireBeanEvents(AbstractBeanDeployer.java:135)
at
org.jboss.weld.bootstrap.AbstractBeanDeployer.fireBeanEvents(AbstractBeanDeployer.java:125)
at org.jboss.weld.bootstrap.BeanDeployer.deploy(BeanDeployer.java:325)
at
org.jboss.weld.bootstrap.BeanDeployment.deployBeans(BeanDeployment.java:267)
at
org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:415)
at
org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:83)
at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:95)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at
org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
... 3 more
I'd like to configure SSL this way, how do I make this happen?
Thanks in advance.
8 years, 9 months