This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 17236 - Filenames vs URLs mismatch with certain paths make Tomcat fail
Summary: Filenames vs URLs mismatch with certain paths make Tomcat fail
Status: VERIFIED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Tomcat (show other bugs)
Version: 3.x
Hardware: Other Windows ME/2000
: P3 blocker (vote)
Assignee: Petr Jiricka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-11-02 08:32 UTC by hlavac
Modified: 2006-02-20 13:51 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hlavac 2001-11-02 08:32:25 UTC
I've noticed that Netbeans passes paths to Tomcat URL-encoded but Tomcat doesn't expect that but rather plain filenames, resulting in illegal path reports from Tomcat and failure to run when my user home directory path contains spaces and accented characters. Tomcat is unable to use its temporary directory in user home.
Comment 1 _ rkubacki 2001-11-02 08:40:09 UTC
Please, can you describe what you are doing? It is not clear to me how
to reproduce this error. Maybe it could be problem of httpserver
module rather than tomcatint but I can't say from your description
Comment 2 hlavac 2001-11-02 10:55:13 UTC
Steps to reproduce is as follows:

- use Netbeans 3.3 beta 2
- have your home directorym at some weird path, like
"c:\Jan Hlavatý\netbeans"
- in default project, inside sampledir, crete web module
- put in simple HTML index page
- right click web module node in Project view, select Execute (F6)
- Deplyoment window appears
- in Output window, following appears:



C:\JAVA\JDK1.3.1_01\JRE\bin\java  -cp C:\JAVA\NETBEANS-3.3BETA2\modules\jsp-tomcat.jar;C:\JAVA\NETBEANS-3.3BETA2\modules\jsp.jar;C:\JAVA\NETBEANS-3.3BETA2\modules\ext\jasper.jar;C:\JAVA\NETBEANS-3.3BETA2\modules\ext\webserver.jar;;C:\JAVA\NETBEANS-3.3BETA2\lib\ext\xerces.jar;;"C:\Jan Hlavatý\netbeans\sampledir\test\WEB-INF\classes;C:\Jan Hlavatý\netbeans\sampledir\test;C:\JAVA\NETBEANS-3.3BETA2\system;C:\Jan Hlavatý\netbeans\sampledir\test\WEB-INF\classes;C:\java\netbeans-3.3beta2\beans\TimerBean.jar;C:\java\netbeans-3.3beta2\modules\ext\AbsoluteLayout.jar;C:\java\netbeans-3.3beta2\modules\ext\servlet-2.2.jar;c:\Jan Hlavatý\netbeans\sampledir;c:\Jan Hlavatý\netbeans\system" org.netbeans.modules.web.tomcat.WebAppMain "c:\Jan Hlavatý\netbeans\system\tomcat\server.xml" "c:\Jan Hlavatý\netbeans\system\tomcat" 
2001-11-02 11:47:30 - Ctx(  ): Error setting IDE-imposed temporary directory - java.io.IOException: Systém nemùe nalézt uvedenou cestu
        at java.io.Win32FileSystem.canonicalize(Native Method)
        at java.io.File.getCanonicalPath(File.java:440)
        at org.netbeans.modules.web.tomcat.ForteDefaults.setWorkDir(ForteDefaults.java:80)
        at org.netbeans.modules.web.tomcat.ForteDefaults.contextInit(ForteDefaults.java:63)
        at org.apache.tomcat.core.ContextManager.initContext(ContextManager.java:491)
        at org.apache.tomcat.core.ContextManager.init(ContextManager.java:453)Starting tomcat. Check logs/tomcat.log for error messages 
        at org.apache.tomcat.startup.Tomcat.execute(Tomcat.java:195)
        at org.apache.tomcat.startup.Tomcat.main(Tomcat.java:235)
        at org.netbeans.modules.web.tomcat.WebAppMain.main(WebAppMain.java:37)
java.io.IOException: Invalid argument
        at java.io.Win32FileSystem.canonicalize(Native Method)
        at java.io.File.getCanonicalPath(File.java:440)
        at org.apache.tomcat.util.FileUtil.safePath(FileUtil.java:184)
        at org.apache.tomcat.core.Context.getRealPath(Context.java:794)
        at org.apache.tomcat.request.StaticInterceptor.requestMap(StaticInterceptor.java:191)
        at org.apache.tomcat.core.ContextManager.processRequest(ContextManager.java:820)
        at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:771)
        at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
        at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
        at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
        at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
        at java.lang.Thread.run(Thread.java:484)
Comment 3 hlavac 2001-11-02 10:59:49 UTC
in system\tomcat\logs, following entries appear:

2001-11-02 11:47:30 - The scratchDir you specified: c:\Jan Hlavat??\netbeans\jspwork\Tomcat+3.2\C%3A%2FJan+Hlavat%3F%3F%2Fnetbeans%2Fsampledir%2Ftest is unusable.
2001-11-02 11:47:30 - The scratchDir you specified: c:\Jan Hlavat??\netbeans\jspwork\Tomcat+3.2\C%3A%2FJan+Hlavat%FD%2Fnetbeans%2Fsystem%2Ftomcat%2Fwebapps%2Fdummyapp is unusable.
Comment 4 hlavac 2001-11-02 11:12:37 UTC
Appearance of two questionmarks instead of accented y suggests that UTF-8 encoded data are treated as some 8-bit encoding somewhere...
Also having directory named jspwork\Tomcat+3.2 in filesystem suggests
using URL paths in place of filesystem paths somewhere. And, of course, using URL directly as filename...
In other words, usual mess caused by having ASCII as a subset of most encodings and developers only trying ASCII characters. They all look same when only ASCII letters are used, so they are often mixed...
Comment 5 Milan Kuchtiak 2001-11-06 17:42:32 UTC
Error is somewhere in the class ForteDefaults - method setWorkDir
Comment 6 Jan Chalupa 2001-11-27 17:05:54 UTC
Target milestone 3.3.1.
Comment 7 Petr Jiricka 2002-05-06 15:56:14 UTC
I suggest the fix should be to replace the question marks 
by a more neutral character, such as '_'.

Will be fixed for 3.4.
Comment 8 hlavac 2002-05-07 11:11:35 UTC
Replacing ? with _ makes no sense.

Check what you pass to Runtime.exec() when spawning Tomcat.
If these Strings are OK, there's not much you can do about 
it.

Two ?? in place of one accented character are typically 
caused by serializing/writing a string into a 8-bit byte 
stream (file,byte[]) using UTF-8 encoding, then reading it 
back as if it were US-ASCII encoding. If you can find 
where these ?? are created, you can fix it there.
Comment 9 hlavac 2002-05-08 03:01:46 UTC
OK, found source of the problem.
It's a bug in generation of server.xml configration file 
for Tomcat, which gets placed in <userhome>\system\tomcat.
While its xml header says it's in ISO-8859-1 encoding, 
it's really written in UTF-8 encoding. Fix: update header 
to say encoding=UTF-8. When I fix that manually, it seems 
to work.

That temporary path Tomcat is complaining about is workDir 
attribute of ContextManager node. URL encoding seems to be 
OK...
Comment 10 hlavac 2002-05-08 03:32:30 UTC
ARG! Just found another trouble! That URL is NOT OK!
Whatever creates jspwork subdir in my home, which was set 
to "C:\Jan Hlavatý\netbeans", has created a new directory 
with (illegal?) name of
"C:\Jan Hlavat&#195;&#189;\netbeans\jspwork\Tomcat+3.2", (note again 
malformed ý) with subdirectories in it:

"C%3A%2FJan+Hlavat%3F%3F%2Fnetbeans%2Fsampledir"
"C%3A%2FJan+Hlavat%3F%3F%2Fnetbeans%2F%3F%3F%3F%ADlen%3F%
3F+adres%3F%3F%3F%3F"
"C%3A%2FJan+Hlavat%FD%2Fnetbeans%2Fsystem%2Ftomcat%
2Fwebapps%2Fdummyapp"

These seem to be URL-encoded forms of:
"C:/Jan Hlavat??/netbeans/sampledir"
"C:/Jan Hlavat??/netbeans/???ºlen?? adres????"
"C:/Jan Hlavat??/netbeans/system/tomcat/webapps/dummyapp"

Which seem to be again UTF-8 written, ISO-8859-1 read, 
wrong path separator versions of 
"C:\Jan Hlavatý\netbeans\sampledir"
"C:\Jan Hlavatý\netbeans\ílený adresáø"
"C:\Jan Hlavatý\netbeans\system\tomcat\webapps\dummyapp"

This may be Tomcat bug and I don't know intentions behind 
this, but looks like unsuccessful attempt to create some 
working directories for/by Tomcat...
Bad about this is it actually created directories
"C:\Jan Hlavat&#195;&#189;\netbeans" instead of putting stuff 
in "C:\Jan Hlavatý\netbeans" where it seems it was 
intended.


Comment 11 Petr Jiricka 2002-06-21 13:07:08 UTC
This works for me with Tomcat 4.0 in NetBeans 3.4 dev, 
build 20020621, so this is probably fixed.
Comment 12 Jaroslav Pospisil 2006-02-20 13:51:46 UTC
VERIFIED