ajax activemq tomcat 7

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

ajax activemq tomcat 7

cesarwbr
This post has NOT been accepted by the mailing list yet.
Hi,
I'm using:
tomcat 7.0.23
jdk1.6.0_29
fedora 16

dependencies in pom.xml:
<dependencies>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-core</artifactId>
            <version>5.5.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-web</artifactId>
            <version>5.5.0</version>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.15</version>
        </dependency>
    </dependencies>


the web.xml:
<?xml version="1.0" encoding="UTF-8"?>

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         version="3.0">
    <servlet>
        <servlet-name>AjaxServlet</servlet-name>
        <servlet-class>org.apache.activemq.web.AjaxServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
        <async-supported>true</async-supported>
    </servlet>

    <servlet>
        <servlet-name>MessageServlet</servlet-name>
        <servlet-class>org.apache.activemq.web.MessageServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
        <async-supported>true</async-supported>
    </servlet>

    <context-param>
        <param-name>org.apache.activemq.brokerURL</param-name>
        <param-value>tcp://127.0.0.1:61616</param-value>
    </context-param>

    <servlet-mapping>
        <servlet-name>AjaxServlet</servlet-name>
        <url-pattern>/amq/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>MessageServlet</servlet-name>
        <url-pattern>/message/*</url-pattern>
    </servlet-mapping>


    <filter>
        <filter-name>session</filter-name>
        <filter-class>org.apache.activemq.web.SessionFilter</filter-class>
        <async-supported>true</async-supported>
    </filter>
    <filter-mapping>
        <filter-name>session</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>


</web-app>


my test page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>Teste AMQ</title>
    <script type="text/javascript" src="../resources/js/jquery/jquery-1.7.min.js"></script>
    <script type="text/javascript" src="../resources/js/amq/amq_jquery_adapter.js"></script>
    <script type="text/javascript" src="../resources/js/amq/amq.js"></script>
    <script type="text/javascript" src="../resources/js/teste.js"></script>
</head>
<body>

</body>
</html>


the teste.js:
var amq;
$(document).ready(function(){
    amq = org.activemq.Amq;
    amq.init({
        uri: '../amq',
        logging: true,
        timeout: 20
    });
});

On glassfish3 it run ok. But in tomcat 7 I got this error:

java.lang.IllegalStateException: Not supported.
	at org.apache.catalina.connector.Request.startAsync(Request.java:1618)
	at org.apache.catalina.connector.Request.startAsync(Request.java:1611)
	at org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1024)
	at org.eclipse.jetty.continuation.Servlet3Continuation.suspend(Servlet3Continuation.java:184)
	at org.apache.activemq.web.MessageListenerServlet.doMessages(MessageListenerServlet.java:320)
	at org.apache.activemq.web.MessageListenerServlet.doGet(MessageListenerServlet.java:240)
	at org.apache.activemq.web.AjaxServlet.doGet(AjaxServlet.java:47)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.activemq.web.SessionFilter.doFilter(SessionFilter.java:45)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
	at org.wso2.carbon.server.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:154)
	at org.wso2.carbon.server.TomcatServer$1.invoke(TomcatServer.java:254)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
	at org.apache.coyote.http11.Http11NioProcessor.process(Http11NioProcessor.java:396)
	at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:356)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1534)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:662)

What is happening? Is ActiveMQ having plans to solve this issue?
Reply | Threaded
Open this post in threaded view
|

Re: ajax activemq tomcat 7

liny
I tried tomcat 7 before, same exception like you.
Now i am using tomcat 6.
Reply | Threaded
Open this post in threaded view
|

Re: ajax activemq tomcat 7

cesarwbr
This post has NOT been accepted by the mailing list yet.
I'm using tomcat in wso2 middleware, so I can't change the tomcat version.
Are Activemq team planning fix it?
Reply | Threaded
Open this post in threaded view
|

Re: ajax activemq tomcat 7

dma02
In reply to this post by liny
Hey Liny I've been searching the net all day trying to solve the same problem as yours. I tried tomcat 7.0.x I tried even using TomEE as suggested on the ActiveMQ site. I don't even know why ActiveMQ wrote a tutorial using Tomcat? It does not work with Tomcat.

I downloaded Jetty v8 and configured it with some help for some websites and then finally, the activemq ajax servlet works. My suggestion is to use Jetty, tomcat and TomEE is just a dead end.