tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jamie Marconi <jamie.marc...@deepcanyon.com>
Subject Symbolic links in webapp
Date Mon, 05 Jun 2000 15:43:35 GMT
I have the 6/4 nightly build of tomcat setup on Redhat Linux 6.1 with IBM
JDK 1.1.8. I'm having some trouble using symbolic links in my ROOT webapps
dir.  These are examples of some of my links:

$TOMCAT_HOME/webapps/ROOT/img -> /home/jmarconi/prj/htdocs/img
$TOMCAT_HOME/webapps/ROOT/jsp -> /home/jmarconi/prj/htdocs/jsp
$TOMCAT_HOME/webapps/ROOT/index.jsp -> /home/jmarconi/prj/htdocs/index.jsp

When I request http://localhost:8080/index.jsp I get an empty response in
the browser.

The jasper.log reports this for the request:

<JASPER_LOG> Mon Jun 05 08:23:27 PDT 2000 JspEngine -->
/index.jsp</JASPER_LOG> 
<JASPER_LOG> Mon Jun 05 08:23:27 PDT 2000             ServletPath:
/index.jsp</JASPER_LOG> 
<JASPER_LOG> Mon Jun 05 08:23:27 PDT 2000                PathInfo:
null</JASPER_LOG> 
<JASPER_LOG> Mon Jun 05 08:23:27 PDT 2000                RealPath:
null</JASPER_LOG> 
<JASPER_LOG> Mon Jun 05 08:23:27 PDT 2000              RequestURI:
/index.jsp</JASPER_LOG> 
<JASPER_LOG> Mon Jun 05 08:23:27 PDT 2000             QueryString:
null</JASPER_LOG> 
<JASPER_LOG> Mon Jun 05 08:23:27 PDT 2000          Request Params:
</JASPER_LOG> 
<JASPER_LOG> Mon Jun 05 08:23:27 PDT 2000 Classpath according to the Servlet
Engine is: ...

There is an exception reported in the tomcat.log:

Ctx(  ) Error in jsp service() : 
 java.lang.NullPointerException: 
         at
org.apache.jasper.compiler.JspCompiler.computeClassFileData_normal(JspCompil
er.java:346)
         at
org.apache.jasper.compiler.JspCompiler.computeClassFileData(JspCompiler.java
:323)
         at
org.apache.jasper.compiler.JspCompiler.<init>(JspCompiler.java:99)
         at
org.apache.jasper.JspEngineContext.createCompiler(JspEngineContext.java:312)
         at
org.apache.jasper.runtime.JspServlet.loadJSP(JspServlet.java:410)
         at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
rvlet.java:149)
         at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
va:161)
         at
org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:261)
         at
org.apache.jasper.runtime.JspServlet.service(JspServlet.java:369)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:541)
         at
org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatcherImpl
.java:184)
         at
org.apache.tomcat.servlets.DefaultServlet.doGet(DefaultServlet.java:189)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:541)
         at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:623)
         at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:193)
         at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:383)
         at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:454)
         at java.lang.Thread.run(Thread.java)    

The problem seems to be that getRealPath is returning null for the symbolic
link.  I've looked at the code some and there seems to be some security to
ensure that the real path is within the Context of the web app.  So I
removed my symbolic links and copied the files in place and I get the
expected behavior.  

I was using symbolic links successfully with the Tomcat 3.1 release. What
maybe interesting is that in that release the getRealPath call for the
/index.jsp request was returning /home/jmarconi/prj/htdocs/index.jsp not the
path of the file in $TOMCAT_HOME.

So is it going to be possible to use symbolic links with future releases?

Jamie Marconi

Mime
View raw message