DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39663>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39663

           Summary: "JasperException: File [TLD Name] not found" with zero
                    length context path
           Product: Tomcat 5
           Version: 5.5.17
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: major
          Priority: P2
         Component: Jasper
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


This happens in Tomcat 5.5.17, but not in 5.0.28. It does not occur if the
context path is something other than "".

1. Add this new host block to the %TOMCAT_HOME%\conf\server.xml file. Note that
halflife is a hostname mapped to 127.0.0.1 in my hosts file.

<Host name="halflife" appBase="C:\bugtest"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">

    <Context docBase="C:\bugtest" path=""/>

</Host>

2. Create these directories:

C:\bugtest
C:\bugtest\testdir
C:\bugtest\WEB-INF

3. Add a file named index.jsp with this content to both the C:\bugtest and
C:\bugtest\testdir directories:

<%@ taglib uri="/WEB-INF/bugtest.tld" prefix="bean" %>

Bugtest

4. Create a file named bugtest.tld with this content in the C:\bugtest\WEB-INF
directory:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN"
"http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd";>
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>bean</shortname>
<uri></uri>
</taglib>

5. Create a minimal web.xml with this content in the C:\bugtest\WEB-INF 
directory:

<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee";
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";
    version="2.4">

  <display-name>Bug Test</display-name>
  <description>
     Bug Test
  </description>

</web-app>

6. Start Tomcat and go to http://halflife:8080/ in a browser. It should display
"Bugtest"

7. Go to http://halflife:8080/testdir/ in a browser. It should display this
exception:

org.apache.jasper.JasperException: File "/WEB-INF/bugtest.tld" not found
        
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
        
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

org.apache.jasper.JasperException: File "/WEB-INF/bugtest.tld" not found
        
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:50)
        
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
        
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:114)
        
org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:159)
        org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:423)
        org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492)
        org.apache.jasper.compiler.Parser.parseElements(Parser.java:1552)
        org.apache.jasper.compiler.Parser.parse(Parser.java:126)
        
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211)
        
org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
        org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:155)
        org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
        org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
        org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
        
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
        
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

It appears that TldLocationsCache.processWebDotXml() thinks the /testdir/
directory is a different context rather than a subdirectory of the default ""
context, so it is looking for /testdir/WEB-INF/bugtest.tld.

I cannot upgrade from Tomcat 5.0 to 5.5 on my development machine because of
this same problem on the application I normally work on.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to