You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Thomas Butz <tb...@optitool.de.INVALID> on 2019/01/02 11:46:00 UTC

Re: ActiveMQ websocket transport in TomEE 7

The standalone proxy is the only possible option ATM.

https://github.com/apache/activemq/blob/activemq-5.14.x/activemq-http/src/main/java/org/apache/activemq/transport/ws/jetty9/WSServlet.java#L41

Activemq relies on the full jetty stack including its websocket implementation.


----- Ursprüngliche Mail -----
Von: "Roberto Cortez" <ra...@yahoo.com.INVALID>
An: users@tomee.apache.org
Gesendet: Donnerstag, 27. Dezember 2018 17:09:05
Betreff: Re: ActiveMQ websocket transport in TomEE 7

Hi Thomas,

Yes, using a standalone server is an option.

I think that if you manage to just include the Jetty libs without their websocket implementation it should work too. Try adding just the core and then add as you need if something is missing.

Cheers,
Roberto

> On 27 Dec 2018, at 15:57, Thomas Butz <tb...@optitool.de.INVALID> wrote:
> 
>> I’m wondering if the jetty-all jar is shipping with the websocket libraries and is causing confusion loading the libs.
> 
> Seems to be the case because jetty-all jar includes the org.eclipse.jetty.websocket package which looks like a full JSR356 implementation.
> 
> I think that using a standalone activemq server as a proxy is my only remaining option.
> 
> ----- Ursprüngliche Mail -----
> Von: "Roberto Cortez" <ra...@yahoo.com.INVALID>
> An: users@tomee.apache.org
> Gesendet: Montag, 24. Dezember 2018 13:29:25
> Betreff: Re: ActiveMQ websocket transport in TomEE 7
> 
> Hi Thomas,
> 
> I think that ActiveMQ only supposes Websockets using Jetty, so you are going to need the Jetty jar.
> 
> TomEE already has support for JSR-356 (from Tomcat). I’m wondering if the jetty-all jar is shipping with the websocket libraries and is causing confusion loading the libs. Can you confirm if you are adding any websocket stuff? You shouldn’t need it.
> 
> Cheers,
> Roberto
> 
>> On 24 Dec 2018, at 09:25, Thomas Butz <tb...@optitool.de.INVALID> wrote:
>> 
>> activemq-http
>> activemq-spring
>> activemq-stomp
>> activemq-mqtt
>> commons-net
>> geronimo-j2ee-management_1.1_spec
>> geronimo-jms_1.1_spec
>> geronimo-jta_1.0.1B_spec
>> hawtbuf
>> hawtdispatch
>> hawtdispatch-transport
>> httpclient
>> jetty-all
>> spring-aop
>> spring-beans
>> spring-context
>> spring-core
>> spring-expressions
>> spring-jms
>> spring-messaging
>> spring-tx
>> spring-web
>> xbean-spring
>> xstream
>> 
>> I sticked to the same activemq version(5.14.5) which is shipped with TomEE 7.0.4 and added activemq-http with its dependencies.
>> 
>> 
>> The problem seems to be the jetty-all dependency. Without it I get the following exception:
>> 
>> 2018-12-24 08:57:50,042 [main] ERROR org.apache.activemq.broker.BrokerService - Failed to start Apache ActiveMQ ([localhost, ID:BART-2295-1545638269800-0:1], java.io.IOException: Transport Connector could not be registered in JMX: java.lang.NoClassDefFoundError: org/eclipse/jetty/server/HandlerContainer)
>> 2018-12-24 08:57:50,337 [main] FATAL OpenEJB.startup.service - Failed to start ActiveMQ
>> java.lang.Exception: ActiveMQFactory.createBroker.InvocationTargetException
>> 	at org.apache.openejb.resource.activemq.ActiveMQFactory.createBroker(ActiveMQFactory.java:128) ~[?:?]
>> 	at org.apache.openejb.resource.activemq.ActiveMQResourceAdapter.createInternalBroker(ActiveMQResourceAdapter.java:160) ~[?:?]
>> 	at org.apache.openejb.resource.activemq.ActiveMQResourceAdapter.start(ActiveMQResourceAdapter.java:150) ~[?:?]
>> 	at org.apache.openejb.assembler.classic.Assembler.doCreateResource(Assembler.java:3153) ~[?:?]
>> 	at org.apache.openejb.assembler.classic.Assembler.createResource(Assembler.java:2907) ~[?:?]
>> 	at org.apache.openejb.assembler.classic.Assembler.buildContainerSystem(Assembler.java:578) ~[?:?]
>> 	at org.apache.openejb.assembler.classic.Assembler.build(Assembler.java:487) ~[?:?]
>> 	at org.apache.openejb.OpenEJB$Instance.<init>(OpenEJB.java:150) ~[?:?]
>> 	at org.apache.openejb.OpenEJB.init(OpenEJB.java:307) ~[?:?]
>> 	at org.apache.tomee.catalina.TomcatLoader.initialize(TomcatLoader.java:247) ~[?:?]
>> 	at org.apache.tomee.catalina.ServerListener.lifecycleEvent(ServerListener.java:168) ~[?:?]
>> 	at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:94) ~[?:?]
>> 	at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:395) ~[?:?]
>> 	at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:108) ~[?:?]
>> 	at org.apache.catalina.startup.Catalina.load(Catalina.java:607) ~[?:?]
>> 	at org.apache.catalina.startup.Catalina.load(Catalina.java:630) ~[?:?]
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_162]
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_162]
>> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_162]
>> 	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_162]
>> 	at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:311) ~[bootstrap.jar:8.5.20]
>> 	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:494) ~[bootstrap.jar:8.5.20]
>> Caused by: java.lang.reflect.InvocationTargetException
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_162]
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_162]
>> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_162]
>> 	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_162]
>> 	at org.apache.openejb.resource.activemq.ActiveMQFactory.createBroker(ActiveMQFactory.java:122) ~[?:?]
>> 	... 21 more
>> Caused by: java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
>> 	at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:171) ~[?:?]
>> 	at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1090) ~[?:?]
>> 	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:487) ~[?:?]
>> 	at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64) ~[?:?]
>> 	at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52) ~[?:?]
>> 	at org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFactory.java:104) ~[?:?]
>> 	at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:104) ~[?:?]
>> 	at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:67) ~[?:?]
>> 	at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71) ~[?:?]
>> 	at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54) ~[?:?]
>> 	at org.apache.openejb.resource.activemq.ActiveMQ5Factory.createBroker(ActiveMQ5Factory.java:99) ~[?:?]
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_162]
>> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_162]
>> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_162]
>> 	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_162]
>> 	at org.apache.openejb.resource.activemq.ActiveMQFactory.createBroker(ActiveMQFactory.java:122) ~[?:?]
>> 	... 21 more
>> 
>> And if i add the jar file to the lib folder the aforementioned error occurs.
>> 
>> ----- Ursprüngliche Mail -----
>> Von: "Roberto Cortez" <ra...@yahoo.com.INVALID>
>> An: users@tomee.apache.org
>> Gesendet: Freitag, 21. Dezember 2018 23:48:39
>> Betreff: Re: ActiveMQ websocket transport in TomEE 7
>> 
>> Hi Thomas,
>> 
>> Can you please detail what dependencies did you add?
>> 
>> Cheers,
>> Roberto
>> 
>>> On 20 Dec 2018, at 16:31, Thomas Butz <tb...@optitool.de.INVALID> wrote:
>>> 
>>> I'm currently trying to setup the ActiveMQ websocket transport for our applicationserver (TomEE 7.0.4)
>>> So far i've added all needed dependencies but jettys ServletContainerInitializer annotations seem to cause problems:
>>> 
>>> 2018-12-20 16:14:30,664 [localhost-startStop-1] ERROR org.apache.catalina.core.StandardContext - Error during ServletContainerInitializer processing
>>> javax.servlet.ServletException: Not running on Jetty, JSR-356 support unavailable
>>>      at org.eclipse.jetty.websocket.jsr356.server.deploy.WebSocketServerContainerInitializer.onStartup(WebSocketServerContainerInitializer.java:146) ~[?:?]
>>>      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5196) ~[?:?]
>>>      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ~[?:?]
>>>      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1419) ~[?:?]
>>>      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409) ~[?:?]
>>>      at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_162]
>>>      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_162]
>>>      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_162]
>>>      at java.lang.Thread.run(Thread.java:748) [?:1.8.0_162]
>>> 
>>> The ultimate goal would be to have an ActiveMQ transport which i'm able to put behind a reverse proxy which will deal with SSL.
>>> I know it's possible to handle SSL directly with ActiveMQ but the reverse proxy gives me more flexiblity(LetsEncrypt support etc).
>>> 
>>> Thanks in advance :) 
>> 
>> 
>> -- 
>> Mit freundlichen Grüßen / Best regards
>> 
>> 
>> Thomas Butz
>> 
>> _______________________________
>> 
>> OPTITOOL GmbH
>> *optimize your business*
>> Im Gewerbepark D 85
>> D - 93059 Regensburg
>> 
>> Phone: +49-941-59578-37
>> Fax: +49-941-59578-7
>> E-Mail: thomas.butz@optitool.de
>> URL: https://www.optitool.de/
>> Facebook: https://www.facebook.com/OPTITOOL-GmbH-111850488857966/
>> Twitter: https://twitter.com/Optitool
>> _______________________________
>> 
>> Sitz der Gesellschaft: Regensburg
>> Geschäftsführer: Dr. Josef Rackl
>> Registergericht Regensburg: HR B 9544
>> 
>> 
>> 
>> The contents of this e-mail (and any attachments):
>> 1. are confidential, may be legally privileged and are intended for the addressee only. If you are not the addressee, do not use, forward or copy them in any way, please tell the sender and delete from your system immediately;
>> 2. come from its author and may not necessarily reflect the opinions of OPTITOOL GmbH or any other group company; and
>> 3. are believed to be free of any virus or defect which may affect your system, but no liability is accepted by OPTITOOL GmbH or any other group company in respect of any loss or damage arising from such virus defect.
>> 
>> We may monitor e-mails sent to OPTITOOL GmbH or any group company.
> 
> 
> -- 
> Mit freundlichen Grüßen / Best regards
> 
> 
> Thomas Butz
> 
> _______________________________
> 
> OPTITOOL GmbH
> *optimize your business*
> Im Gewerbepark D 85
> D - 93059 Regensburg
> 
> Phone: +49-941-59578-37
> Fax: +49-941-59578-7
> E-Mail: thomas.butz@optitool.de
> URL: https://www.optitool.de/
> Facebook: https://www.facebook.com/OPTITOOL-GmbH-111850488857966/
> Twitter: https://twitter.com/Optitool
> _______________________________
> 
> Sitz der Gesellschaft: Regensburg
> Geschäftsführer: Dr. Josef Rackl
> Registergericht Regensburg: HR B 9544
> 
> 
> 
> The contents of this e-mail (and any attachments):
> 1. are confidential, may be legally privileged and are intended for the addressee only. If you are not the addressee, do not use, forward or copy them in any way, please tell the sender and delete from your system immediately;
> 2. come from its author and may not necessarily reflect the opinions of OPTITOOL GmbH or any other group company; and
> 3. are believed to be free of any virus or defect which may affect your system, but no liability is accepted by OPTITOOL GmbH or any other group company in respect of any loss or damage arising from such virus defect.
> 
> We may monitor e-mails sent to OPTITOOL GmbH or any group company.


-- 
Mit freundlichen Grüßen / Best regards


Thomas Butz

_______________________________

OPTITOOL GmbH
*optimize your business*
Im Gewerbepark D 85
D - 93059 Regensburg

Phone: +49-941-59578-37
Fax: +49-941-59578-7
E-Mail: thomas.butz@optitool.de
URL: https://www.optitool.de/
Facebook: https://www.facebook.com/OPTITOOL-GmbH-111850488857966/
Twitter: https://twitter.com/Optitool
_______________________________

Sitz der Gesellschaft: Regensburg
Geschäftsführer: Dr. Josef Rackl
Registergericht Regensburg: HR B 9544

 

The contents of this e-mail (and any attachments):
1. are confidential, may be legally privileged and are intended for the addressee only. If you are not the addressee, do not use, forward or copy them in any way, please tell the sender and delete from your system immediately;
2. come from its author and may not necessarily reflect the opinions of OPTITOOL GmbH or any other group company; and
3. are believed to be free of any virus or defect which may affect your system, but no liability is accepted by OPTITOOL GmbH or any other group company in respect of any loss or damage arising from such virus defect.

We may monitor e-mails sent to OPTITOOL GmbH or any group company.