Bug 56481

Summary: Cannot differentiate between the package name and class name in tomcat 8.0.5
Product: Tomcat 8 Reporter: Hariprasad Manchi <hariprasad007>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: critical    
Priority: P2    
Version: 8.0.5   
Target Milestone: ----   
Hardware: PC   
OS: All   
Attachments: Sample application demonstrating the issue with case insensitivity.
(customapp.war) Sample application demonstrating the issue with case insensitivity.

Description Hariprasad Manchi 2014-05-02 11:15:53 UTC
Created attachment 31586 [details]
Sample application demonstrating the issue with case insensitivity.

In my web application I have a package com.mycomp. This package has another package named actions and also a class named Actions.class.

Tomcat 8.0.5 is unable to differentiate between the class Actions.class and the package actions. This is resulted in the below exception:

org.apache.jasper.JasperException: Unable to compile class for JSP: 

An error occurred at line: [14] in the generated java file: [C:\apache-tomcat-8.0.5\work\Catalina\localhost\customapp\org\apache\jsp\index_jsp.java]
The import com.mycomp.actions cannot be resolved

Stacktrace:
	org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
	org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:199)
	org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:475)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:380)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:355)
	org.apache.jasper.compiler.Compiler.compile(Compiler.java:342)
	org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:564)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

Perhaps there is no case sensitive comparision with this version that is causing the issue. However, I tried deploying this webapp in tomcat 8.0.3, it worked fine without throwing an exception.

I have attached a sample war file with the demonstration.
Comment 1 Konstantin Kolinko 2014-05-02 14:25:21 UTC

*** This bug has been marked as a duplicate of bug 47323 ***
Comment 2 Hariprasad Manchi 2014-05-05 08:52:05 UTC
Why there is a change in behavior in tomcat 8.0.3 and tomcat 8.0.5 version?
Why does it work in 8.0.3 but not in 8.0.5 under the same OS? Can you please confirm the actual root cause for this?

Thanks,
Hariprasad
Comment 3 Konstantin Kolinko 2014-05-05 23:38:03 UTC
Comment on attachment 31586 [details]
Sample application demonstrating the issue with case insensitivity.

Your sample application is a Rar archive instead of a Zip one.
Comment 4 Konstantin Kolinko 2014-05-05 23:41:23 UTC
Created attachment 31595 [details]
(customapp.war) Sample application demonstrating the issue with case insensitivity.

Re-uploading the sample application. Repacked as a zip file.

I confirm that the issue is reproducible with the current 8.0.x trunk.
Comment 5 Mark Thomas 2014-05-07 17:25:40 UTC
While the root cause of this is the case insensitivity of URLClassLoader, this was exposed by a change to the way addURLs() was handled. I have implemented an alternative fix to that problem that avoids this issue. The fix will be in 8.0.6 onwards.
Comment 6 Hariprasad Manchi 2014-05-15 12:54:11 UTC
Thanks for addressing this issue. I tested it successfully; it's been resolved now.

Regards,
Hariprasad