You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by David Wall <d....@computer.org> on 2004/02/09 01:36:30 UTC
Startup exception using security manager on TC 5.0.18
When I startup Tomcat 5.0.18 with a security manager, I get the following
exception. It talks about persisted sessions, something I didn't even
realize existed. No doubt there's a permissions problem if it cannot read
where the sessions are stored.
Is there a way to make sure sessions are not persisted? In general, we
wouldn't want that unless we were doing some sort of clustering or the like.
Or is this problem something else?
David
Feb 8, 2004 4:30:05 PM org.apache.catalina.session.StandardManager doLoad
SEVERE: IOException while loading persisted sessions: java.io.EOFException
java.io.EOFException
at
java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2
165)
at
java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.j
ava:2631)
at
java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:734)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:253)
at
org.apache.catalina.util.CustomObjectInputStream.<init>(CustomObjectInputStr
eam.java:104)
at
org.apache.catalina.session.StandardManager.doLoad(StandardManager.java:431)
at
org.apache.catalina.session.StandardManager$PrivilegedDoLoad.run(StandardMan
ager.java:123)
at java.security.AccessController.doPrivileged(Native Method)
at
org.apache.catalina.session.StandardManager.load(StandardManager.java:377)
at
org.apache.catalina.session.StandardManager.start(StandardManager.java:703)
at
org.apache.catalina.core.ContainerBase.setManager(ContainerBase.java:542)
at
org.apache.catalina.startup.ContextConfig.managerConfig(ContextConfig.java:3
49)
at
org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:654)
at
org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:
253)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
t.java:166)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4224)
at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:8
66)
at
org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java:164)
at
org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.
java:186)
at java.security.AccessController.doPrivileged(Native Method)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:848)
at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:638)
at
org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.j
ava:320)
at
org.apache.catalina.core.StandardHost.install(StandardHost.java:875)
at
org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:727
)
at
org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:477)
at
org.apache.catalina.startup.HostConfig.start(HostConfig.java:1008)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:394)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSuppor
t.java:166)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1133)
at
org.apache.catalina.core.StandardHost.start(StandardHost.java:832)
at
org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1125)
at
org.apache.catalina.core.StandardEngine.start(StandardEngine.java:518)
at
org.apache.catalina.core.StandardService.start(StandardService.java:519)
at
org.apache.catalina.core.StandardServer.start(StandardServer.java:2345)
at org.apache.catalina.startup.Catalina.start(Catalina.java:598)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:297)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:398)
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Stealing the Writer (Was: Re: Configuring a Default Servlet)
Posted by Stefan Görling <st...@pricerunner.com>.
Dear Tim,
Thanks!, Filters works great to solve this problem. Here's another
stupid thing I want to do. I want to measure the performance, by
wrapping every request buy another filter (or similiar):
public void doFilter(ServletRequest request, ServletResponse, response,
FilterChain chain) throws IOException, ServletException {
ServletOutputStream out=response.getOutputStream();
out.println("<!-- request started -->")
chain.doFilter(request,response);
out.println("<!-- This is the end of the request, it took foo
seconds-->");
}
The page is delivered properly, but the debug output is not returned. If
i remove chain.doFitlter, the text is printed properly. Anyone who has
an idea on how to "Steal" a working writer to add some debug data at the
end (start is not really necessary)?
/Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Configuring a Default Servlet
Posted by Tim Funk <fu...@joedog.org>.
Use filters. They only get applied on the incoming request. In the filter -
you can place the logic to perform the extra logic you need or not.
-Tim
Stefan Görling wrote:
> Dear Tim and others,
>
> Thank you for the reference. And now for the little twist which I forgot
> to mention:
> Before we introduced the default servlet we had urls with normal .jsp:s.
> We want to run those through the custom dispatcher as well in order to
> redirect to the proper url
>
> For example:
> A request to: /Foo.jsp -> Permanent redirect to /foo/bar
> A request to: /foo/bar --> Internal forward to www/Foo.jsp
> A request to /Bar.jsp -->Internal forward to www/Bar.jsp
>
> The problem is to say that all requests, including .jsp-files in the
> root should be handled by the Servlet, but _not_ .jsp-files residing in
> /www/
>
> The following won't work: (neither with /www nor with /www/*)
> <servlet-mapping>
> <servlet-name>jsp</servlet-name>
> <url-pattern>/www*</url-pattern>
> </servlet-mapping>
>
> <servlet-mapping>
> <servlet-name>custom</servlet-name>
> <url-pattern>/</url-pattern>
> </servlet-mapping>
>
> As the getRequestDispatcher("/www/Foo.jsp").forward(request,response),
> creates a loop.
>
> So:
>
> Is it possible to:
> a) configure web.xml in a proper way
> b) get a JSP-dispatcher, like
> getJSPRequestDispatcher("/www/Foo.jsp").forward(request,response)
> (tomcat specific typecasting is ok).
> c) Rewrite the incoming RequestURI in a proper way?
> I've written code for :
> 1. in apache using mod_rewrite to change all url:s so that they begin
> with /custom/foo/bar,
> 2. In the Servlet, wrap the request by extending the
> HttpServletRequestWrapper and overriding getRequestURI() so that
> /custom is removed.
>
> This however gave a problem when trying to do a response.redirect to a
> relative URL, as tomcat used an internal representation of the Request
> object to retrieve the path information when converting the relative
> path to an aboslute one, hence giving back a /custom/foo/bar url. I can
> wrap the HttpServletResponse too to fix the redirect object, but I have
> no idea when the same problem will appear somewhere else.
>
> Best Regards,
>
> Stefan Görling
>
>> The defualt servlet is mapped by the following:
>>
>> SRV.11.2 Specification of Mappings
>> "A string containing only the ’/’ character indicates the "default"
>> servlet of the application. In this case the servlet path is the
>> request URI minus the context path and the path info is null."
>>
>> So you really want:
>> <url-pattern>/</url-pattern>
>>
>> Also that same section states the /* has higher precendence than
>> *.extension
>>
>> -Tim
>>
>> Stefan Görling wrote:
>>
>>> Hi,
>>>
>>> I want to have all incomming request forwarded to a default servlet.
>>> Depending on the URL the request is forwarded to a JSP-page (too
>>> dynamic to use apache mod_rewrite).
>>>
>>> The problem is that if I define the servlet as:
>>> <servlet-mapping>
>>> <servlet-name>custom</servlet-name>
>>> <url-pattern>/*</url-pattern>
>>> </servlet-mapping>
>>>
>>> It will work, but when I do
>>> getDispatcher("MyPage.jsp").forward(request,response), it will
>>> forward to the servlet in a recursive way.
>>>
>>> Is there any way to get a hold of a JSP-dispatcher when forwarding a
>>> request in order to do this?
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Configuring a Default Servlet
Posted by Stefan Görling <st...@pricerunner.com>.
Dear Tim and others,
Thank you for the reference. And now for the little twist which I forgot
to mention:
Before we introduced the default servlet we had urls with normal .jsp:s.
We want to run those through the custom dispatcher as well in order to
redirect to the proper url
For example:
A request to: /Foo.jsp -> Permanent redirect to /foo/bar
A request to: /foo/bar --> Internal forward to www/Foo.jsp
A request to /Bar.jsp -->Internal forward to www/Bar.jsp
The problem is to say that all requests, including .jsp-files in the
root should be handled by the Servlet, but _not_ .jsp-files residing in
/www/
The following won't work: (neither with /www nor with /www/*)
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>/www*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>custom</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
As the getRequestDispatcher("/www/Foo.jsp").forward(request,response),
creates a loop.
So:
Is it possible to:
a) configure web.xml in a proper way
b) get a JSP-dispatcher, like
getJSPRequestDispatcher("/www/Foo.jsp").forward(request,response)
(tomcat specific typecasting is ok).
c) Rewrite the incoming RequestURI in a proper way?
I've written code for :
1. in apache using mod_rewrite to change all url:s so that they begin
with /custom/foo/bar,
2. In the Servlet, wrap the request by extending the
HttpServletRequestWrapper and overriding getRequestURI() so that
/custom is removed.
This however gave a problem when trying to do a response.redirect to a
relative URL, as tomcat used an internal representation of the Request
object to retrieve the path information when converting the relative
path to an aboslute one, hence giving back a /custom/foo/bar url. I can
wrap the HttpServletResponse too to fix the redirect object, but I have
no idea when the same problem will appear somewhere else.
Best Regards,
Stefan Görling
> The defualt servlet is mapped by the following:
>
> SRV.11.2 Specification of Mappings
> "A string containing only the ’/’ character indicates the "default"
> servlet of the application. In this case the servlet path is the
> request URI minus the context path and the path info is null."
>
> So you really want:
> <url-pattern>/</url-pattern>
>
> Also that same section states the /* has higher precendence than
> *.extension
>
> -Tim
>
> Stefan Görling wrote:
>
>> Hi,
>>
>> I want to have all incomming request forwarded to a default servlet.
>> Depending on the URL the request is forwarded to a JSP-page (too
>> dynamic to use apache mod_rewrite).
>>
>> The problem is that if I define the servlet as:
>> <servlet-mapping>
>> <servlet-name>custom</servlet-name>
>> <url-pattern>/*</url-pattern>
>> </servlet-mapping>
>>
>> It will work, but when I do
>> getDispatcher("MyPage.jsp").forward(request,response), it will
>> forward to the servlet in a recursive way.
>>
>> Is there any way to get a hold of a JSP-dispatcher when forwarding a
>> request in order to do this?
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Re: Configuring a Default Servlet
Posted by Tim Funk <fu...@joedog.org>.
The defualt servlet is mapped by the following:
SRV.11.2 Specification of Mappings
"A string containing only the ’/’ character indicates the "default" servlet
of the application. In this case the servlet path is the request URI minus
the context path and the path info is null."
So you really want:
<url-pattern>/</url-pattern>
Also that same section states the /* has higher precendence than *.extension
-Tim
Stefan Görling wrote:
> Hi,
>
> I want to have all incomming request forwarded to a default servlet.
> Depending on the URL the request is forwarded to a JSP-page (too dynamic
> to use apache mod_rewrite).
>
> The problem is that if I define the servlet as:
> <servlet-mapping>
> <servlet-name>custom</servlet-name>
> <url-pattern>/*</url-pattern>
> </servlet-mapping>
>
> It will work, but when I do
> getDispatcher("MyPage.jsp").forward(request,response), it will forward
> to the servlet in a recursive way.
>
> Is there any way to get a hold of a JSP-dispatcher when forwarding a
> request in order to do this?
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
Configuring a Default Servlet
Posted by Stefan Görling <st...@pricerunner.com>.
Hi,
I want to have all incomming request forwarded to a default servlet.
Depending on the URL the request is forwarded to a JSP-page (too dynamic
to use apache mod_rewrite).
The problem is that if I define the servlet as:
<servlet-mapping>
<servlet-name>custom</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
It will work, but when I do
getDispatcher("MyPage.jsp").forward(request,response), it will forward
to the servlet in a recursive way.
Is there any way to get a hold of a JSP-dispatcher when forwarding a
request in order to do this?
Best Regards,
Stefan Görling
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org