Hello,
I have been writing an application using the Restlet API (and a very
pleasant API I might add) and ran into a problem.
Initially I was using the 1.0 release and everything was working fine.
Eventually I found myself in the situation where I needed to either parse
the request body into a DOM multiple times. Once at the Filter level to
initially determine if authentication were required and again at a the
specific Resource level. Or parse the request body into a DOM once in the
Filter and store the DOM as part of the request attributes. Multiple
parsing of the DOM did not work in 1.0 for me, and there wasn't a facility
to set request attributes, so I upgraded to 1.1.
I am still investigating this on my own and just thought I would see if
someone else had run into this problem and already had an answer to it.
When I try and use my 1.1 Restlet with Tomcat, I am getting the following
stack trace:
SEVERE: Allocate exception for servlet IDS
java.lang.NullPointerException
at java.util.concurrent.CopyOnWriteArrayList.<init>(
CopyOnWriteArrayList.java:91)
at org.restlet.Connector.<init>(Connector.java:69)
at org.restlet.Client.<init>(Client.java:49)
at com.noelios.restlet.ext.servlet.ServletWarClient.<init>(
ServletWarClient.java:52)
at com.noelios.restlet.ext.servlet.ServerServlet.createApplication(
ServerServlet.java:215)
at com.noelios.restlet.ext.servlet.ServerServlet.getApplication(
ServerServlet.java:313)
at com.noelios.restlet.ext.servlet.ServerServlet.init(
ServerServlet.java:418)
at javax.servlet.GenericServlet.init(GenericServlet.java:211)
at org.apache.catalina.core.StandardWrapper.loadServlet(
StandardWrapper.java:1105)
at org.apache.catalina.core.StandardWrapper.allocate(
StandardWrapper.java:757)
at org.apache.catalina.core.StandardWrapperValve.invoke(
StandardWrapperValve.java:130)
at org.apache.catalina.core.StandardContextValve.invoke(
StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(
StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(
CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(
Http11Processor.java:869)
at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection
(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(
PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:619)
I was running Tomcat 5.5.20 with JDK 1.6.0. I also tried and encountered
the same problem using a Tomcat 6 version.
I tried having the Restlet get connected using both the Component and
Application classes.
-Eben