REST API on JBoss 7
vlari Jul 11, 2011 9:58 PMHello, I'm trying to deploy the HornetQ REST API on jboss 7, following the instructions found
[here|http://docs.jboss.org/hornetq/2.2.2.Final/rest-interface-manual/html_single/index.html#d0e57]
Here is the content of my war file:
{code}
0 Mon Jul 11 18:40:20 PDT 2011 META-INF/
126 Mon Jul 11 18:40:18 PDT 2011 META-INF/MANIFEST.MF
0 Mon Jul 11 18:40:18 PDT 2011 WEB-INF/
0 Mon Jul 11 18:40:18 PDT 2011 WEB-INF/classes/
0 Mon Jul 11 18:40:18 PDT 2011 WEB-INF/lib/
110716 Thu Jul 07 17:17:26 PDT 2011 WEB-INF/lib/hornetq-rest-2.2.2.Final.jar
2257 Mon Jul 11 17:34:44 PDT 2011 WEB-INF/web.xml
{code}
(note that I upgraded hornetq-rest-2.2.0 (as indicated in the documentation but no longer available) to 2.2.2.Final.
Here is ny web.xml:
{code}
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<listener>
<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap</listener-class>
</listener>
<listener>
<listener-class>org.hornetq.rest.integration.RestMessagingBootstrapListener</listener-class>
</listener>
<filter>
<filter-name>Rest-Messaging</filter-name>
<filter-class>
org.jboss.resteasy.plugins.server.servlet.FilterDispatcher
</filter-class>
</filter>
<filter-mapping>
<filter-name>Rest-Messaging</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
{code}
I'm starting AS7 with the following command (to make sure hornet is deployed at boot-time):
{code}
./bin/standalone.sh -server-config standalone-preview.xml
{code}
Now, when I deployed this war I get the following error:
{code}
[...]18:32:26,365 INFO [org.hornetq.core.remoting.impl.netty.NettyAcceptor] (MSC service thread 1-4) Started Netty Acceptor version 3.2.3.Final-r${buildNumber} localhost:5445 for CORE protocol
18:32:26,371 INFO [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-4) Server is now live
18:32:26,372 INFO [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-4) HornetQ Server version 2.2.6.Final (HQ_2_2_6_FINAL_AS7, 121) [977a50d5-ac0e-11e0-a395-005056c00008] started
18:32:26,411 INFO [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-4) trying to deploy queue jms.queue.testQueue
18:32:26,530 INFO [org.hornetq.core.server.impl.HornetQServerImpl] (MSC service thread 1-1) trying to deploy queue jms.topic.testTopic
[...]
18:32:26,821 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) Starting deployment of "hq-test.war"
18:32:27,366 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/hq-test]] (MSC service thread 1-3) Exception sending context initialized event to listener instance of class org.hornetq.rest.integration.RestMessagingBootstrapListener: java.lang.NoClassDefFoundError: org/hornetq/api/core/client/ServerLocator
at org.hornetq.rest.integration.RestMessagingBootstrapListener.contextInitialized(RestMessagingBootstrapListener.java:28) [hornetq-rest-2.2.2.Final.jar:]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3368) [jbossweb-7.0.0.CR4.jar:7.0.0.CR1]
[...]
{code}
Okay, for some mysterious reason, the Bootstrap Listener does not find org.hornetq.api.core.client.ServerLocator, which is in $JBOSS_HOME/modules/org/hornetq/main/hornetq-core-2.2.6.Final.jar.
So, I add this jar to the archive:
{code}
0 Mon Jul 11 18:40:20 PDT 2011 META-INF/
126 Mon Jul 11 18:40:18 PDT 2011 META-INF/MANIFEST.MF
0 Mon Jul 11 18:40:18 PDT 2011 WEB-INF/
0 Mon Jul 11 18:40:18 PDT 2011 WEB-INF/classes/
0 Mon Jul 11 18:40:18 PDT 2011 WEB-INF/lib/
1377085 Mon Jul 11 18:40:08 PDT 2011 WEB-INF/lib/hornetq-core-2.2.6.Final.jar
110716 Thu Jul 07 17:17:26 PDT 2011 WEB-INF/lib/hornetq-rest-2.2.2.Final.jar
2257 Mon Jul 11 17:34:44 PDT 2011 WEB-INF/web.xml
{code}
But when I deploy this war, I get this error:
{code}
18:40:45,350 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) Starting deployment of "hq-test.war"
18:40:46,146 WARNING [org.hornetq.core.client.impl.ClientSessionFactoryImpl] (MSC service thread 1-4) Tried 1 times to connect. Now giving up on reconnecting it.
18:40:46,147 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/hq-test]] (MSC service thread 1-4) Exception sending context initialized event to listener instance of class org.hornetq.rest.integration.RestMessagingBootstrapListener: java.lang.RuntimeException: HornetQException[errorCode=2 message=Cannot connect to server(s). Tried with all available servers.]
at org.hornetq.rest.integration.RestMessagingBootstrapListener.contextInitialized(RestMessagingBootstrapListener.java:42) [hornetq-rest-2.2.2.Final.jar:]
at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3368) [jbossweb-7.0.0.CR4.jar:7.0.0.CR1]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3821) [jbossweb-7.0.0.CR4.jar:7.0.0.CR1]
at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.0.0.CR1.jar:7.0.0.CR1]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)
at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_24]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_24]
at java.lang.Thread.run(Thread.java:680) [:1.6.0_24]
Caused by: HornetQException[errorCode=2 message=Cannot connect to server(s). Tried with all available servers.]
at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:619) [hornetq-core-2.2.5.Final.jar:]
at org.hornetq.rest.MessageServiceManager.start(MessageServiceManager.java:154) [hornetq-rest-2.2.2.Final.jar:]
at org.hornetq.rest.integration.RestMessagingBootstrapListener.contextInitialized(RestMessagingBootstrapListener.java:36) [hornetq-rest-2.2.2.Final.jar:]
... 8 more
{code}
Any idea of what I'm doing wrong?
Is AS7 + HornetQ-REST documented somewhere?
Actually, I switched to AS7 because I was having the same kind of problems with AS 6, so updated instructions for AS 6 would do too.
Thanks,
VL.