Quantcast

AjaxServlet on Tomcat

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

AjaxServlet on Tomcat

viji
Hi,

I am trying to deploy the AjaxServlet in tomcat (7.0.14). It seems like this is specifically written for jetty as the MessageListnerServlet is using jetty classes. Is there way to use this is tomcat?

I have done all the configs mentioned in the document, but when I add the jetty jar to the classpath getting the following exception.

<snip>

HTTP Status 500 -

<HR size="1" noshade="noshade"><p>type Exception report</p><p>message <u></u></p><p>description <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><p>exception <pre>java.lang.IllegalStateException: Not supported.
        org.apache.catalina.connector.Request.startAsync(Request.java:1618)
        org.apache.catalina.connector.Request.startAsync(Request.java:1611)
        org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1024)
        org.eclipse.jetty.continuation.Servlet3Continuation.suspend(Servlet3Continuation.java:184)
        org.apache.activemq.web.MessageListenerServlet.doMessages(MessageListenerServlet.java:321)
        org.apache.activemq.web.MessageListenerServlet.doGet(MessageListenerServlet.java:241)
        org.apache.activemq.web.AjaxServlet.doGet(AjaxServlet.java:47)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
        org.apache.activemq.web.SessionFilter.doFilter(SessionFilter.java:45)
</pre></p><p>note <u>The full stack trace of the root cause is available in the Apache Tomcat/7.0.14 logs.</u></p><HR size="1" noshade="noshade">

Apache Tomcat/7.0.14

</snip>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: AjaxServlet on Tomcat

dejanb
Yes, it depends on Jetty Continuations
http://wiki.eclipse.org/Jetty/Feature/Continuations

Regards
--
Dejan Bosanac - http://twitter.com/dejanb
-----------------
The experts in open source integration and messaging - http://fusesource.com
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Thu, Jun 16, 2011 at 10:03 AM, viji <[hidden email]> wrote:

> Hi,
>
> I am trying to deploy the AjaxServlet in tomcat (7.0.14). It seems like
> this
> is specifically written for jetty as the MessageListnerServlet is using
> jetty classes. Is there way to use this is tomcat?
>
> I have done all the configs mentioned in the document, but when I add the
> jetty jar to the classpath getting the following exception.
>
> <snip>
> HTTP Status 500 -
> <HR size="1" noshade="noshade"><p>type Exception report</p><p>message
> <u></u></p><p>description <u>The server encountered an internal error ()
> that prevented it from fulfilling this request.</u></p><p>exception
> <pre>java.lang.IllegalStateException: Not supported.
>        org.apache.catalina.connector.Request.startAsync(Request.java:1618)
>        org.apache.catalina.connector.Request.startAsync(Request.java:1611)
>
>
> org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1024)
>
>
> org.eclipse.jetty.continuation.Servlet3Continuation.suspend(Servlet3Continuation.java:184)
>
>
> org.apache.activemq.web.MessageListenerServlet.doMessages(MessageListenerServlet.java:321)
>
>
> org.apache.activemq.web.MessageListenerServlet.doGet(MessageListenerServlet.java:241)
>        org.apache.activemq.web.AjaxServlet.doGet(AjaxServlet.java:47)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
>        javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
>
>  org.apache.activemq.web.SessionFilter.doFilter(SessionFilter.java:45)
> </pre></p><p>note <u>The full stack trace of the root cause is available in
> the Apache Tomcat/7.0.14 logs.</u></p><HR size="1" noshade="noshade">
> Apache Tomcat/7.0.14
>
> </snip>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/AjaxServlet-on-Tomcat-tp3601798p3601798.html
> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: AjaxServlet on Tomcat

viji
Hi,

Can I use the same on any other servlet containers like glassfish or jboss
or geronimo? I think this feature is not matured in tomcat.

Thanks
Viji

On Thu, Jun 16, 2011 at 1:41 PM, Dejan Bosanac <[hidden email]> wrote:

> Yes, it depends on Jetty Continuations
> http://wiki.eclipse.org/Jetty/Feature/Continuations
>
> Regards
> --
> Dejan Bosanac - http://twitter.com/dejanb
> -----------------
> The experts in open source integration and messaging -
> http://fusesource.com
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
>
>
> On Thu, Jun 16, 2011 at 10:03 AM, viji <[hidden email]> wrote:
>
> > Hi,
> >
> > I am trying to deploy the AjaxServlet in tomcat (7.0.14). It seems like
> > this
> > is specifically written for jetty as the MessageListnerServlet is using
> > jetty classes. Is there way to use this is tomcat?
> >
> > I have done all the configs mentioned in the document, but when I add the
> > jetty jar to the classpath getting the following exception.
> >
> > <snip>
> > HTTP Status 500 -
> > <HR size="1" noshade="noshade"><p>type Exception report</p><p>message
> > <u></u></p><p>description <u>The server encountered an internal error ()
> > that prevented it from fulfilling this request.</u></p><p>exception
> > <pre>java.lang.IllegalStateException: Not supported.
> >
>  org.apache.catalina.connector.Request.startAsync(Request.java:1618)
> >
>  org.apache.catalina.connector.Request.startAsync(Request.java:1611)
> >
> >
> >
> org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1024)
> >
> >
> >
> org.eclipse.jetty.continuation.Servlet3Continuation.suspend(Servlet3Continuation.java:184)
> >
> >
> >
> org.apache.activemq.web.MessageListenerServlet.doMessages(MessageListenerServlet.java:321)
> >
> >
> >
> org.apache.activemq.web.MessageListenerServlet.doGet(MessageListenerServlet.java:241)
> >        org.apache.activemq.web.AjaxServlet.doGet(AjaxServlet.java:47)
> >        javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
> >        javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
> >
> >  org.apache.activemq.web.SessionFilter.doFilter(SessionFilter.java:45)
> > </pre></p><p>note <u>The full stack trace of the root cause is available
> in
> > the Apache Tomcat/7.0.14 logs.</u></p><HR size="1" noshade="noshade">
> > Apache Tomcat/7.0.14
> >
> > </snip>
> >
> > --
> > View this message in context:
> >
> http://activemq.2283324.n4.nabble.com/AjaxServlet-on-Tomcat-tp3601798p3601798.html
> > Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
> >
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: AjaxServlet on Tomcat

dejanb
Guess so if they use Jetty for web server. Never tried it though.

Regards
--
Dejan Bosanac - http://twitter.com/dejanb
-----------------
The experts in open source integration and messaging - http://fusesource.com
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Thu, Jun 16, 2011 at 12:33 PM, Viji V Nair <[hidden email]>wrote:

> Hi,
>
> Can I use the same on any other servlet containers like glassfish or jboss
> or geronimo? I think this feature is not matured in tomcat.
>
> Thanks
> Viji
>
> On Thu, Jun 16, 2011 at 1:41 PM, Dejan Bosanac <[hidden email]>
> wrote:
>
> > Yes, it depends on Jetty Continuations
> > http://wiki.eclipse.org/Jetty/Feature/Continuations
> >
> > Regards
> > --
> > Dejan Bosanac - http://twitter.com/dejanb
> > -----------------
> > The experts in open source integration and messaging -
> > http://fusesource.com
> > ActiveMQ in Action - http://www.manning.com/snyder/
> > Blog - http://www.nighttale.net
> >
> >
> > On Thu, Jun 16, 2011 at 10:03 AM, viji <[hidden email]> wrote:
> >
> > > Hi,
> > >
> > > I am trying to deploy the AjaxServlet in tomcat (7.0.14). It seems like
> > > this
> > > is specifically written for jetty as the MessageListnerServlet is using
> > > jetty classes. Is there way to use this is tomcat?
> > >
> > > I have done all the configs mentioned in the document, but when I add
> the
> > > jetty jar to the classpath getting the following exception.
> > >
> > > <snip>
> > > HTTP Status 500 -
> > > <HR size="1" noshade="noshade"><p>type Exception report</p><p>message
> > > <u></u></p><p>description <u>The server encountered an internal error
> ()
> > > that prevented it from fulfilling this request.</u></p><p>exception
> > > <pre>java.lang.IllegalStateException: Not supported.
> > >
> >  org.apache.catalina.connector.Request.startAsync(Request.java:1618)
> > >
> >  org.apache.catalina.connector.Request.startAsync(Request.java:1611)
> > >
> > >
> > >
> >
> org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1024)
> > >
> > >
> > >
> >
> org.eclipse.jetty.continuation.Servlet3Continuation.suspend(Servlet3Continuation.java:184)
> > >
> > >
> > >
> >
> org.apache.activemq.web.MessageListenerServlet.doMessages(MessageListenerServlet.java:321)
> > >
> > >
> > >
> >
> org.apache.activemq.web.MessageListenerServlet.doGet(MessageListenerServlet.java:241)
> > >        org.apache.activemq.web.AjaxServlet.doGet(AjaxServlet.java:47)
> > >        javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
> > >        javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
> > >
> > >  org.apache.activemq.web.SessionFilter.doFilter(SessionFilter.java:45)
> > > </pre></p><p>note <u>The full stack trace of the root cause is
> available
> > in
> > > the Apache Tomcat/7.0.14 logs.</u></p><HR size="1" noshade="noshade">
> > > Apache Tomcat/7.0.14
> > >
> > > </snip>
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://activemq.2283324.n4.nabble.com/AjaxServlet-on-Tomcat-tp3601798p3601798.html
> > > Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: AjaxServlet on Tomcat

viji
I am giving a try on geronimo (2.2) which uses jetty as the servlet engine.
I am not sure whether it will be successful because as far as i know
Continuation is introduced in Servlet 3.0 and geronimo is on 2.5.

Thanks
Viji


On Thu, Jun 16, 2011 at 6:51 PM, Dejan Bosanac <[hidden email]> wrote:

> Guess so if they use Jetty for web server. Never tried it though.
>
> Regards
> --
> Dejan Bosanac - http://twitter.com/dejanb
> -----------------
> The experts in open source integration and messaging -
> http://fusesource.com
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
>
>
> On Thu, Jun 16, 2011 at 12:33 PM, Viji V Nair <[hidden email]
> >wrote:
>
> > Hi,
> >
> > Can I use the same on any other servlet containers like glassfish or
> jboss
> > or geronimo? I think this feature is not matured in tomcat.
> >
> > Thanks
> > Viji
> >
> > On Thu, Jun 16, 2011 at 1:41 PM, Dejan Bosanac <[hidden email]>
> > wrote:
> >
> > > Yes, it depends on Jetty Continuations
> > > http://wiki.eclipse.org/Jetty/Feature/Continuations
> > >
> > > Regards
> > > --
> > > Dejan Bosanac - http://twitter.com/dejanb
> > > -----------------
> > > The experts in open source integration and messaging -
> > > http://fusesource.com
> > > ActiveMQ in Action - http://www.manning.com/snyder/
> > > Blog - http://www.nighttale.net
> > >
> > >
> > > On Thu, Jun 16, 2011 at 10:03 AM, viji <[hidden email]> wrote:
> > >
> > > > Hi,
> > > >
> > > > I am trying to deploy the AjaxServlet in tomcat (7.0.14). It seems
> like
> > > > this
> > > > is specifically written for jetty as the MessageListnerServlet is
> using
> > > > jetty classes. Is there way to use this is tomcat?
> > > >
> > > > I have done all the configs mentioned in the document, but when I add
> > the
> > > > jetty jar to the classpath getting the following exception.
> > > >
> > > > <snip>
> > > > HTTP Status 500 -
> > > > <HR size="1" noshade="noshade"><p>type Exception report</p><p>message
> > > > <u></u></p><p>description <u>The server encountered an internal error
> > ()
> > > > that prevented it from fulfilling this request.</u></p><p>exception
> > > > <pre>java.lang.IllegalStateException: Not supported.
> > > >
> > >  org.apache.catalina.connector.Request.startAsync(Request.java:1618)
> > > >
> > >  org.apache.catalina.connector.Request.startAsync(Request.java:1611)
> > > >
> > > >
> > > >
> > >
> >
> org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1024)
> > > >
> > > >
> > > >
> > >
> >
> org.eclipse.jetty.continuation.Servlet3Continuation.suspend(Servlet3Continuation.java:184)
> > > >
> > > >
> > > >
> > >
> >
> org.apache.activemq.web.MessageListenerServlet.doMessages(MessageListenerServlet.java:321)
> > > >
> > > >
> > > >
> > >
> >
> org.apache.activemq.web.MessageListenerServlet.doGet(MessageListenerServlet.java:241)
> > > >        org.apache.activemq.web.AjaxServlet.doGet(AjaxServlet.java:47)
> > > >        javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
> > > >        javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
> > > >
> > > >
>  org.apache.activemq.web.SessionFilter.doFilter(SessionFilter.java:45)
> > > > </pre></p><p>note <u>The full stack trace of the root cause is
> > available
> > > in
> > > > the Apache Tomcat/7.0.14 logs.</u></p><HR size="1" noshade="noshade">
> > > > Apache Tomcat/7.0.14
> > > >
> > > > </snip>
> > > >
> > > > --
> > > > View this message in context:
> > > >
> > >
> >
> http://activemq.2283324.n4.nabble.com/AjaxServlet-on-Tomcat-tp3601798p3601798.html
> > > > Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
> > > >
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: AjaxServlet on Tomcat

dejanb
This is Jetty 7.x feature, so as long as it's there, you should be fine.

Let us know how it went.

Regards
--
Dejan Bosanac - http://twitter.com/dejanb
-----------------
The experts in open source integration and messaging - http://fusesource.com
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net


On Thu, Jun 16, 2011 at 3:33 PM, Viji V Nair <[hidden email]> wrote:

> I am giving a try on geronimo (2.2) which uses jetty as the servlet engine.
> I am not sure whether it will be successful because as far as i know
> Continuation is introduced in Servlet 3.0 and geronimo is on 2.5.
>
> Thanks
> Viji
>
>
> On Thu, Jun 16, 2011 at 6:51 PM, Dejan Bosanac <[hidden email]>
> wrote:
>
> > Guess so if they use Jetty for web server. Never tried it though.
> >
> > Regards
> > --
> > Dejan Bosanac - http://twitter.com/dejanb
> > -----------------
> > The experts in open source integration and messaging -
> > http://fusesource.com
> > ActiveMQ in Action - http://www.manning.com/snyder/
> > Blog - http://www.nighttale.net
> >
> >
> > On Thu, Jun 16, 2011 at 12:33 PM, Viji V Nair <[hidden email]
> > >wrote:
> >
> > > Hi,
> > >
> > > Can I use the same on any other servlet containers like glassfish or
> > jboss
> > > or geronimo? I think this feature is not matured in tomcat.
> > >
> > > Thanks
> > > Viji
> > >
> > > On Thu, Jun 16, 2011 at 1:41 PM, Dejan Bosanac <[hidden email]>
> > > wrote:
> > >
> > > > Yes, it depends on Jetty Continuations
> > > > http://wiki.eclipse.org/Jetty/Feature/Continuations
> > > >
> > > > Regards
> > > > --
> > > > Dejan Bosanac - http://twitter.com/dejanb
> > > > -----------------
> > > > The experts in open source integration and messaging -
> > > > http://fusesource.com
> > > > ActiveMQ in Action - http://www.manning.com/snyder/
> > > > Blog - http://www.nighttale.net
> > > >
> > > >
> > > > On Thu, Jun 16, 2011 at 10:03 AM, viji <[hidden email]>
> wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I am trying to deploy the AjaxServlet in tomcat (7.0.14). It seems
> > like
> > > > > this
> > > > > is specifically written for jetty as the MessageListnerServlet is
> > using
> > > > > jetty classes. Is there way to use this is tomcat?
> > > > >
> > > > > I have done all the configs mentioned in the document, but when I
> add
> > > the
> > > > > jetty jar to the classpath getting the following exception.
> > > > >
> > > > > <snip>
> > > > > HTTP Status 500 -
> > > > > <HR size="1" noshade="noshade"><p>type Exception
> report</p><p>message
> > > > > <u></u></p><p>description <u>The server encountered an internal
> error
> > > ()
> > > > > that prevented it from fulfilling this request.</u></p><p>exception
> > > > > <pre>java.lang.IllegalStateException: Not supported.
> > > > >
> > > >  org.apache.catalina.connector.Request.startAsync(Request.java:1618)
> > > > >
> > > >  org.apache.catalina.connector.Request.startAsync(Request.java:1611)
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1024)
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> org.eclipse.jetty.continuation.Servlet3Continuation.suspend(Servlet3Continuation.java:184)
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.web.MessageListenerServlet.doMessages(MessageListenerServlet.java:321)
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> org.apache.activemq.web.MessageListenerServlet.doGet(MessageListenerServlet.java:241)
> > > > >
>  org.apache.activemq.web.AjaxServlet.doGet(AjaxServlet.java:47)
> > > > >        javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
> > > > >        javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
> > > > >
> > > > >
> >  org.apache.activemq.web.SessionFilter.doFilter(SessionFilter.java:45)
> > > > > </pre></p><p>note <u>The full stack trace of the root cause is
> > > available
> > > > in
> > > > > the Apache Tomcat/7.0.14 logs.</u></p><HR size="1"
> noshade="noshade">
> > > > > Apache Tomcat/7.0.14
> > > > >
> > > > > </snip>
> > > > >
> > > > > --
> > > > > View this message in context:
> > > > >
> > > >
> > >
> >
> http://activemq.2283324.n4.nabble.com/AjaxServlet-on-Tomcat-tp3601798p3601798.html
> > > > > Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
> > > > >
> > > >
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: AjaxServlet on Tomcat

ccheatham
This post has NOT been accepted by the mailing list yet.
In reply to this post by dejanb
I am guessing that the AJAXServlet is simply not going to be something that's gonna work in Tomcat without some custom rewrite.  From what I can see there is a coupling with Jetty.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: AjaxServlet on Tomcat

jaskaran
This post has NOT been accepted by the mailing list yet.
HI,

I Am getting the same issue on Tomcat.

Is there any way to fix this issue so i can get the Ajax Servlet to work on Tomcat.

I am using ActiveMQ 5.5.

Thanks
Jaskaran
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: AjaxServlet on Tomcat

viji
Hi,

This wont work with tomcat as it is using the jetty continuation feature. You can try the jetty servlet container with JBOSS/GlassFish/Geronimo

You can try modify the code using the "AIO" feature of tomcat.

Thanks
Viji

On Mon, Jul 18, 2011 at 3:11 PM, jaskaran [via ActiveMQ] <[hidden email]> wrote:
HI,

I Am getting the same issue on Tomcat.

Is there any way to fix this issue so i can get the Ajax Servlet to work on Tomcat.

I am using ActiveMQ 5.5.

Thanks
Jaskaran



If you reply to this email, your message will be added to the discussion below:
http://activemq.2283324.n4.nabble.com/AjaxServlet-on-Tomcat-tp3601798p3674874.html
To unsubscribe from AjaxServlet on Tomcat, click here.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: AjaxServlet on Tomcat

ccheatham
In reply to this post by jaskaran
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: AjaxServlet on Tomcat

liny
This post has NOT been accepted by the mailing list yet.
In reply to this post by viji
Hi,

I have same problem with AJAXMQServlet and Tomcat 7.0.22 HERE.
But same web application works with Tomcat 6.0.20 and 6.0.33.
When trying Tomcat 7.0.22, I though maybe I should use Jetty 8 which is support Servlet 3.0, like Tomcat 7, but still has same problem - "java.lang.IllegalStateException: Not supported".
So I downloaded Tomcat 6.0.33 and tried again with same web application and Jetty 8 jars, and amazing! It works!

Does anyone successful use AjaxMQServlet under Tomcat 7?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: AjaxServlet on Tomcat

WhYtBridge
This post has NOT been accepted by the mailing list yet.
This post was updated on .
In reply to this post by viji
I am having a similar problem.

I'm using eclipse with Tomcat 6 and ActiveMQ 5.4.3

Following the instructions on http://activemq.apache.org/ajax.html my web.xml looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>ActiveMQTest</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
 
  <servlet>
  <servlet-name>AjaxServlet</servlet-name>
  <servlet-class>org.apache.activemq.web.AjaxServlet</servlet-class>
  </servlet>
 
  <servlet-mapping>
  <servlet-name>AjaxServlet</servlet-name>
  <url-pattern>/amq/*</url-pattern>
  </servlet-mapping>

  <servlet>
  <servlet-name>MessageServlet</servlet-name>
  <servlet-class>org.apache.activemq.web.MessageServlet</servlet-class>
  </servlet>
 
  <servlet-mapping>
  <servlet-name>MessageServlet</servlet-name>
  <url-pattern>/message/*</url-pattern>
  </servlet-mapping>
 
  <context-param>
  <param-name>org.apache.activemq.brokerURL</param-name>
  <param-value>http://localhost</param-value>
  </context-param>
</web-app>

I have a very simple index.html file that has the following:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/amq_prototype_adapter.js"></script>
<script type="text/javascript" src="js/amq.js"></script>
<script type="text/javascript">
var amq;

document.observe("dom:loaded", function(){
	amq = org.activemq.Amq;
	
	amq.init({uri: 'amq', logging:true, timeout:20});
	
	var myHandler = {
			rcvMessage : function(message){
				alert("received " + message);
			}
	};
	
	amq.addListener("test", "topic://GOOGLEEARTHTEST", myHandler.rcvMessage);
});
</script>
</head>
<body>
<h1>ActiveMQ test</h1>
</body>
</html>

In the WebContent/WEB-INF/lib folder I added the following libraries: (I got the libraries from ActiceMQ download):

activemq-all-5.4.3.jar
activemq-web-5.4.3.jar
camel-core-2.4.0.jar
commons-codec-2.4.0.jar
commons-httpclient-3.1.jar
jetty-all-server-7.1.6.v20100715.jar

Executing this in Tomcat 6 gives me the following error:

SEVERE: Servlet.service() for servlet AjaxServlet threw exception
java.lang.IllegalStateException: !(Jetty || Servlet 3.0 || ContinuationFilter)
        at org.eclipse.jetty.continuation.ContinuationSupport.getContinuation(ContinuationSupport.java:145)
        at org.apache.activemq.web.MessageListenerServlet.doMessages(MessageListenerServlet.java:301)
        at org.apache.activemq.web.MessageListenerServlet.doGet(MessageListenerServlet.java:247)
        at org.apache.activemq.web.AjaxServlet.doGet(AjaxServlet.java:47)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
        at java.lang.Thread.run(Unknown Source)

From what I can figure from this, it means that I either don't have Jetty, don't use servlet 3.0 or don't have the continuationfilter.

Since tomcat 6 doesn't support servlet 3.0 I tried the same setup in tomcat 7, but then I get the aforementioned 'not supported' exception

SEVERE: Servlet.service() for servlet [AjaxServlet] in context with path [/Tomcat7Test] threw exception
java.lang.IllegalStateException: Not supported.
        at org.apache.catalina.connector.Request.startAsync(Request.java:1663)
        at org.apache.catalina.connector.Request.startAsync(Request.java:1656)
        at org.apache.catalina.connector.RequestFacade.startAsync(RequestFacade.java:1022)
        at org.eclipse.jetty.continuation.Servlet3Continuation.suspend(Servlet3Continuation.java:184)
        at org.apache.activemq.web.MessageListenerServlet.doMessages(MessageListenerServlet.java:318)
        at org.apache.activemq.web.MessageListenerServlet.doGet(MessageListenerServlet.java:247)
        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:305)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

Does anyone have any idea what I might be doing wrong?

Thanks in advance

WhYtBridge
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: AjaxServlet on Tomcat

hexaplus
Hi I've been using AjaxServelt on tomcat for the last five years or so, I'm currently using Tomcat 7.0.26 and active mq 5.5.1.
Works well with the exception of one problem I'll be posting in a minute (problems shutting down).

My web.xml for my web app has:

  <context-param>
    <param-name>org.apache.activemq.brokerURL</param-name>
    <param-value>vm://localhost</param-value>
  </context-param>
....
  <servlet>
      <servlet-name>AjaxServlet</servlet-name>
      <servlet-class>org.apache.activemq.web.AjaxServlet</servlet-class>
      <init-param>
         <param-name>maximumReadTimeout</param-name>
         <param-value>120000</param-value>
      </init-param>
     <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>
  </servlet>

...
  <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>

In my myWebApp/WEB-INF/lib directory i have:
 activemq-all-5.5.1.jar
 activemq-web-5.5.1.jar
 camel-core-2.7.0.jar
 jetty-all-server-7.1.6.v20100715.jar
 log4j-1.2.14.jar
 slf4j-log4j12-1.5.11.jar
Sorry I don't have more of the details on why or how (its been a life time since I implemented it).
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: AjaxServlet on Tomcat

dejanb
It's be a great blog post to summarize all this ;)

Regards
--
Dejan Bosanac
Senior Software Engineer | FuseSource Corp.
[hidden email] | fusesource.com
skype: dejan.bosanac | twitter: @dejanb
blog: http://www.nighttale.net
ActiveMQ in Action: http://www.manning.com/snyder/


On Tue, Aug 14, 2012 at 8:58 PM, hexaplus <[hidden email]> wrote:

> Hi I've been using AjaxServelt on tomcat for the last five years or so, I'm
> currently using Tomcat 7.0.26 and active mq 5.5.1.
> Works well with the exception of one problem I'll be posting in a minute
> (problems shutting down).
>
> My web.xml for my web app has:
>
>   <context-param>
>     <param-name>org.apache.activemq.brokerURL</param-name>
>     <param-value>vm://localhost</param-value>
>   </context-param>
> ....
>   <servlet>
>       <servlet-name>AjaxServlet</servlet-name>
>       <servlet-class>org.apache.activemq.web.AjaxServlet</servlet-class>
>       <init-param>
>          <param-name>maximumReadTimeout</param-name>
>          <param-value>120000</param-value>
>       </init-param>
>      <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>
>   </servlet>
>
> ...
>   <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>
>
> In my myWebApp/WEB-INF/lib directory i have:
>  activemq-all-5.5.1.jar
>  activemq-web-5.5.1.jar
>  camel-core-2.7.0.jar
>  jetty-all-server-7.1.6.v20100715.jar
>  log4j-1.2.14.jar
>  slf4j-log4j12-1.5.11.jar
> Sorry I don't have more of the details on why or how (its been a life time
> since I implemented it).
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/AjaxServlet-on-Tomcat-tp3601798p4655123.html
> Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
Loading...