-
1. Re: ServletContext.getRealPath() does not work in JBOSS 3.2/
richardchandler Apr 29, 2003 5:31 PM (in response to jodybrownell1)I have the same problem.
If we're both doing something wrong, or if you find a work around please let me know.
(I'm using jboss-3.2.0_tomcat-4.1.24 also) -
2. Re: ServletContext.getRealPath() does not work in JBOSS 3.2/
kbutler Jul 14, 2003 5:44 PM (in response to jodybrownell1)I had the same problem on 3.2.1/Tomcat 4.1.24, and didn't find a solution or explanation.
Also I couldn't get the WAR to auto-unpack (the unpackWARs directive). My workaround has been Jetty, although I would prefer Tomcat. -
3. Re: ServletContext.getRealPath() does not work in JBOSS 3.2/
tsangcn Jul 24, 2003 10:58 PM (in response to jodybrownell1)I have asked this question about a year ago since JBoss 3.0.2.
http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t= no reply.
Since that time, I use JBoss with Jetty.
It seems that the problem is not solved for a year.
Or no one aware of this? -
4. Re: ServletContext.getRealPath() does not work in JBOSS 3.2/
buhl Nov 17, 2003 1:37 PM (in response to jodybrownell1)I found the following in the servlet-2_3-fcs-docs for ServletContext.getRealPath():
"This method returns null if the servlet container cannot translate the virtual path to a real path for any reason (such as when the content is being made available from a .war archive)."
So if Tomcat accesses the resource that you pass as
argument to getRealPath() through a .war, getRealPath() will return null.
You have 3 alternatives now:
1. You unpack the .war file manually with jar xf and delete it afterwards.
2. In the Tomcat's config file `server.xml' you change the Host directive's argument from unpackWARs="false" to unpackWARs="true"
3. To get the resource regardless of it is in a .war or not use getResourceAsStream.