Tomcat 6 deploy problem

181 views
Skip to first unread message

Michael Calderon

unread,
Oct 25, 2011, 2:10:30 PM10/25/11
to spray-user
I was doing some small tasks using spray deployed in Jetty, which
worked fine. But when moving it to Tomcat 6, using the Tomcat6
connector, the requests fails and I get this exception:

SEVERE: Servlet.service() for servlet CTServlet threw exception
java.lang.UnsupportedOperationException
at
org.apache.catalina.connector.CometEventImpl.setTimeout(CometEventImpl.java:
124)
at
cc.spray.connectors.Tomcat6ConnectorServlet.responder(Tomcat6ConnectorServlet.scala:
53)
at
cc.spray.connectors.Tomcat6ConnectorServlet.event(Tomcat6ConnectorServlet.scala:
36)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilterEvent(ApplicationFilterChain.java:
470)
at
org.apache.catalina.core.ApplicationFilterChain.doFilterEvent(ApplicationFilterChain.java:
363)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
231)
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:
298)
at
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:
861)
at org.apache.coyote.http11.Http11AprProtocol
$Http11ConnectionHandler.process(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:
1584)
at java.lang.Thread.run(Unknown Source)

Can't find a solution for this and I'm not sure if this is a Tomcat or
Spray problem with some sort of configuration I'm not including

Mathias

unread,
Oct 26, 2011, 3:40:17 AM10/26/11
to spray...@googlegroups.com
Michael,

judging from the Tomcat6 sources (setTimeout method in org.apache.catalina.connector.CometEventImpl, http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/java/org/apache/catalina/connector/CometEventImpl.java) it seems you haven't properly enabled async processing and/or request timeout setting in your Tomcat setup.
Can you check how to enable the "org.apache.tomcat.comet.timeout.support" attribute on all requests?

Cheers,
Mathias

---
mat...@spray.cc
http://www.spray.cc

Michael Calderon

unread,
Oct 26, 2011, 5:12:48 PM10/26/11
to spray-user
Mathias,

Thank you for the response. I already went through that road and
couldn't find anything like enabling the timeout.support,
I'm not sure if I'm missing some Jar or anything on the tomcat
configuration. My current server.xml file is:

<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="100000"
redirectPort="8443" />

Thank you


On Oct 26, 1:40 am, Mathias <math...@spray.cc> wrote:
> Michael,
>
> judging from the Tomcat6 sources (setTimeout method in org.apache.catalina.connector.CometEventImpl,http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/java/org/apache/...) it seems you haven't properly enabled async processing and/or request timeout setting in your Tomcat setup.
> Can you check how to enable the "org.apache.tomcat.comet.timeout.support" attribute on all requests?
>
> Cheers,
> Mathias
>
> ---
> math...@spray.cchttp://www.spray.cc

Mathias

unread,
Oct 26, 2011, 5:18:31 PM10/26/11
to spray...@googlegroups.com
What kind of HTTP connector are you using?
Have you seen the note on this page: http://tomcat.apache.org/tomcat-6.0-doc/aio.html ?

IMPORTANT NOTE: Usage of these features requires using the APR or NIO HTTP connectors.
The classic java.io HTTP connector and the AJP connectors do not support them.

Cheers,
Mathias

---
mat...@spray.cc
http://www.spray.cc

On 25.10.2011, at 20:10, Michael Calderon wrote:

Michael Calderon

unread,
Oct 27, 2011, 4:39:04 PM10/27/11
to spray-user
Thank you for the tip, I finally solved the problem, I was missing the
NIO HTTP connector,
in the tomcat server file.

Thank you,
Michael




On Oct 26, 3:18 pm, Mathias <math...@spray.cc> wrote:
> What kind of HTTP connector are you using?
> Have you seen the note on this page:http://tomcat.apache.org/tomcat-6.0-doc/aio.html?
>
>         IMPORTANT NOTE: Usage of these features requires using the APR or NIO HTTP connectors.
>         The classic java.io HTTP connector and the AJP connectors do not support them.
>
> Cheers,
> Mathias
>
> ---
> math...@spray.cchttp://www.spray.cc
>
> On 25.10.2011, at 20:10, Michael Calderon wrote:
>
>
>
>
>
>
>
> > I was doing some small tasks using spray deployed in Jetty, which
> > worked fine. But when moving it to Tomcat 6, using the Tomcat6
> > connector, the requests fails and I get this exception:
>
> > SEVERE: Servlet.service() for servlet CTServlet threw exception
> > java.lang.UnsupportedOperationException
> >    at
> > org.apache.catalina.connector.CometEventImpl.setTimeout(CometEventImpl.java :
> > 124)
> >    at
> > cc.spray.connectors.Tomcat6ConnectorServlet.responder(Tomcat6ConnectorServl et.scala:
> > 53)
> >    at
> > cc.spray.connectors.Tomcat6ConnectorServlet.event(Tomcat6ConnectorServlet.s cala:
> > 36)
> >    at
> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilterEvent(Appli cationFilterChain.java:
> > 470)
> >    at
> > org.apache.catalina.core.ApplicationFilterChain.doFilterEvent(ApplicationFi lterChain.java:
> > 363)
> >    at
> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.j ava:
> > 231)
> >    at
> > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.j ava:

Michael Calderon

unread,
Oct 27, 2011, 8:17:42 PM10/27/11
to spray-user
Mathias,

Found another issue when deploying on Tomcat 6.

I have my product running under http://localhost:8080/app-name/service

So, for using tomcat I read I had to set the root-path, which I set
as:

root-path = "/app-name/" and so, when I try to access to service
with
the path /service/path1 ... I get a 404 error even though I had the
path
specified as:

path("service/path1")

And if I puth a catch-all path, it is being executed, so it means the
service
should read the path but is not. Am I missing something else to set?

Thank you


On Oct 27, 2:39 pm, Michael Calderon <mcalde...@richcoastit.com>
wrote:

Mathias

unread,
Oct 28, 2011, 5:35:46 AM10/28/11
to spray...@googlegroups.com
Michael,

when you set

> root-path = "/app-name/"

a request to "http://yourhost/app-name/service"
will be seen by your route structure as a request to "/service".
So you'll have to use a `path("service")` directive to match requests to "http://yourhost/app-name/service".

HTH and cheers,
Mathias

---
mat...@spray.cc
http://www.spray.cc

Michael Calderon

unread,
Oct 28, 2011, 10:46:06 AM10/28/11
to spray-user
Mathias,

Yes, I tried setting the path like that, but when doing the request, I
get the 404 error, and if I set the code like this:

path("service") {
get {
_.complete("test correct")
}
}~
get {
_.complete("failed")
}

I always get the 'failed' response instead of getting the response for
'service'

Thank you


On Oct 28, 3:35 am, Mathias <math...@spray.cc> wrote:
> Michael,
>
> when you set
>
> > root-path = "/app-name/"
>
> a request to "http://yourhost/app-name/service"
> will be seen by your route structure as a request to "/service".
> So you'll have to use a `path("service")` directive to match requests to "http://yourhost/app-name/service".
>
> HTH and cheers,
> Mathias
>
> ---
> math...@spray.cchttp://www.spray.cc
>
> On 28.10.2011, at 02:17, Michael Calderon wrote:
>
>
>
>
>
>
>
> > Mathias,
>
> > Found another issue when deploying on Tomcat 6.
>
> > I have my product running underhttp://localhost:8080/app-name/service

Mathias

unread,
Oct 28, 2011, 10:51:15 AM10/28/11
to spray...@googlegroups.com
Michael,

I suggest you set the log level for "cc.spray.RootService" to DEBUG and also
change your

_.complete("failed")

to

ctx => ctx.complete("Request path: " + ctx.request.path)

and look at the returned request path.

Cheers,
Mathias

---
mat...@spray.cc
http://www.spray.cc

Michael Calderon

unread,
Oct 28, 2011, 5:07:10 PM10/28/11
to spray-user
Mathias,

The request were correct all the times. The problem was a combination
of web.xml and
akka.conf that needed to be set accordingly to the app service path.

Thank you very much for your help

On Oct 28, 8:51 am, Mathias <math...@spray.cc> wrote:
> Michael,
>
> I suggest you set the log level for "cc.spray.RootService" to DEBUG and also
> change your
>
>         _.complete("failed")
>
> to
>
>         ctx => ctx.complete("Request path: " + ctx.request.path)
>
> and look at the returned request path.
>
> Cheers,
> Mathias
>
> ---
Reply all
Reply to author
Forward
0 new messages