You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2006/03/24 09:50:58 UTC

DO NOT REPLY [Bug 39093] New: - Tomcat messes up when a class has the same name as a package

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=39093>.
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=39093

           Summary: Tomcat messes up when a class has the same name as a
                    package
           Product: Tomcat 5
           Version: 5.5.16
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: major
          Priority: P2
         Component: Servlet & JSP API
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: paul@2hv.nl


I've found something that appears to be a bug in TC 5.5.16 . After a small 
check, it however, also occured in TC 5.5.15, so it might even be older.
Tomcat 4.0.6 (using JDK 1.4), however, did *not* have this problem.

I've got the following class/package structure:

1: nl.hhv.merlin.gui.editor.EditButtons
2: nl.hhv.merlin.gui.Editor
3: nl.hhv.merlin.gui.editor2.EditButtons

Note that packagename of the first class is equal to the fully qualified
name of the second class (except for caps/nocaps). This should be no problem
right?!? At least it never was until now.

Now I have a JSP that simply does:

<%
  nl.hhv.merlin.gui.editor.EditButtons buttons = null;
%>

Eclipse has no problems with this JSP, and happily accepts it, why shouldn't
it? Looks fine to me to :-) But Tomcat 5.5.16 gives me the following error:

  Generated servlet error:
  nl.hhv.merlin.gui.editor cannot be resolved to a type

When I change my JSP to:

<%
  nl.hhv.merlin.gui.editor2.EditButtons buttons = null;
%>

Tomcat compiles the JSP without any problems. Note that the 2nd EditButtons
class is an EXACT copy of the first.

I've tried to reproduce the same issue with different class and package-names, 
but then it seems to work!?!?

Anyway, I've attached a small ZIP which can be unpacked into the TC webapps 
dir, to try this out yourselves. It also contains the Java sources. Check out 
the remarks in index.jsp for more weirdness :-)

The provided class files have been compiled using Eclipse 3.1.2 (so not the JDK 
compiler). I'm running TC on Java 1.5.0_06.

Kind regards,
Paul Hamer

-- 
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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 39093] - Tomcat messes up when a class has the same name as a package

Posted by bu...@apache.org.
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=39093>.
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=39093


markt@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME




------- Additional Comments From markt@apache.org  2006-03-24 22:58 -------
Thanks for the test case. It makes looking at bugs like this so much quicker.

My environment:
Windows Home SP2 + all patches
Java 1.5.0_04
Tomcat 5.5.HEAD and 5.5.15

I can't reproduce this. I confirmed the suspect code was present in the JSP by
reviewing the source code generated in the work directory. The JSP was compilied
with the Eclipse 3.1.2 compilier.

This looks like a problem with your environment.

-- 
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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 39093] - Tomcat messes up when a class has the same name as a package

Posted by bu...@apache.org.
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=39093>.
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=39093


paul@2hv.nl changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #17966|0                           |1
        is obsolete|                            |




------- Additional Comments From paul@2hv.nl  2006-05-31 13:09 -------
Created an attachment (id=18378)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=18378&action=view)
New test-it-yourself TC webapp

Goes with my reply above

-- 
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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 39093] - Tomcat messes up when a class has the same name as a package

Posted by bu...@apache.org.
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=39093>.
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=39093


markt@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID




------- Additional Comments From markt@apache.org  2006-09-01 02:28 -------
If you mess with the classpath like this you are asking for trouble and are on
your own. See http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html
for an explanation of why it isn't as simple as justing adding stuff to your
classpath.

Also, be aware that the Tomcat startup scripts may over-write your classpath anyway.

-- 
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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 39093] - Tomcat messes up when a class has the same name as a package

Posted by bu...@apache.org.
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=39093>.
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=39093





------- Additional Comments From paul@2hv.nl  2006-03-24 08:53 -------
Created an attachment (id=17966)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=17966&action=view)
TC webapp to test this yourselves


-- 
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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 39093] - Tomcat messes up when a class has the same name as a package

Posted by bu...@apache.org.
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=39093>.
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=39093


paul@2hv.nl changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #18378|0                           |1
        is obsolete|                            |




------- Additional Comments From paul@2hv.nl  2006-05-31 13:16 -------
Created an attachment (id=18379)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=18379&action=view)
sorry, previous zip did not contain the sources


-- 
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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 39093] - Tomcat messes up when a class has the same name as a package

Posted by bu...@apache.org.
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=39093>.
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=39093


paul@2hv.nl changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |
            Version|5.5.16                      |5.5.17




------- Additional Comments From paul@2hv.nl  2006-05-31 13:08 -------
I've finally been able to narrow down this problem. It appears that it occurs 
ONLY when the classes are in the Java classpath, and NOT (as in most cases) in 
the WEB-INF/classes directory. I'll attach a new ZIP in a minute.

Meanwhile, I've also migrated to Tomcat 5.5.17, but the problem remains.

Just unpack the zip (mytest2.zip) into your tomcat/webapps directory. The 
index.jsp will now compile fine, just to prove it actually works :-)

Now, here we go:
- Stop Tomcat
- Rename the mytest/WEB-INF/classes dir to mytest/WEB-INF/klasses .
  This will prevent Tomcat from picking it up.
- Now add the mytest/WEB-INF/klasses dir to the Java classpath. My new 
classpath then is:
  C:\Program Files\Tomcat5.5\bin\bootstrap.jar;C:\Program Files\Tomcat5.5
\webapps\mytest\WEB-INF\klasses
- Restart Tomcat
- Make sure you "touch" index.jsp to force re-compilation.
- Visit index.jsp

et voila... there you have it:

> gui.editor cannot be resolved to a type

When I then (keep Tomcat running) delete the WEB-INF/klasses/gui/Editor.class 
file, and re-visit the index.jsp, it suddenly compiles!

Go figure :-)

My environment:
Windows XP Pro SP2 + all patches
Java 1.5.0_04
Tomcat 5.5.16 + 5.5.17

Hope this helps to finally locate this bug. Would help me a lot. I've already 
got many applications out in the field using these classes, so renaming them is 
not really an option :-(

Thanx!
Paul Hamer


-- 
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: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org