Summary: | JSP's not compiling - javac: invalid flag: C:\Java\jars\Tomcat | ||
---|---|---|---|
Product: | Tomcat 4 | Reporter: | Steve Vanspall <steve> |
Component: | Jasper | Assignee: | Tomcat Developers Mailing List <dev> |
Status: | RESOLVED WORKSFORME | ||
Severity: | blocker | CC: | hauser |
Priority: | P3 | ||
Version: | 4.1.24 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All | ||
URL: | http://jakarta.apache.org/tomcat/faq/misc.html#compile |
Description
Steve Vanspall
2003-02-03 04:58:54 UTC
I have the same problem, please help !!! I have the same problem on Win2K Pro, jdk 1.4.1_02 running TC 4.1.24 downloaded today April 10, 2003 But I have not problem running: Mac OSX 10.2.4, JDK 1.4.1 and TC 4.1.24 (same vintage). Also have no problems with other versions: TC 4.1.18 , TC 4.0.6 (on 1.3.1_02) on Win2k and MacOSX Windows installer only installs the NT service correctly if JAVA_HOME is defined and it points to some version of Java SDK. If JAVA_HOME is not defined before the install, or it is incorrect, the installer mostly appears to work but Tomcat cannot compile JSPs. There are two problems in the Tomcat 4 script for Nullsoft Installer, tomcat.nsi, v 1.33. I apologize for not providing a patch, but I have no way to rebuild the installer to test these changes. I hope some committer can use this information to fix these problems. 1. Function findJavaPath does not validate the path it finds. If the JAVA_HOME env variable is incorrect because it was set to point to an old Java that is no longer on the machine, the installer ends up using an invalid path for things like the shortcuts on the Start menu and to copy the tools.jar file. The function should verify that the folder it found does exist, and if the JAVA_HOME setting is not valid it should fall back to using the registry. 2. Function findJVMPath only uses the JAVA_HOME setting to find the correct JVM, even though the findJavaPath function is capable of finding the Java folder from the registry settings. findJVMPath should call findJavaPath instead of relying on just the JAVA_HOME environment variable. In its current form, if JAVA_HOME is not defined or is incorrect, findJVMPath always fails to find the Java SDK and falls back to using the JRE. This leaves Tomcat unable to compile JSPs, because the Ant code cannot find Javac.exe. To fix a system that was installed this way, do the following: 1. Change registry entry for HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ Apache Tomcat 4.1\Parameters\JVM Library from (adjust these paths to your machine and java version) C:\Program Files\Java\j2re1.4.1_02\bin\client\jvm.dll to C:\j2sdk1.4.1_02\jre\bin\server\jvm.dll 2. Copy tools.jar from your-jsdk\lib\tools.jar to your- tomcat\common\lib\tools.jar This may not be necessary, but the installer does attempt to copy this file so it won't hurt to do the same. 3. If you use the shortcuts on the Start Menu, edit their properties to fix the path to java.exe. What you posted is incorrect, as the installer will also check the registry. Quite frankly, if you can't make it work, then it's really your own fault (using the default Sun JDK installer will setup everything needed). The 5.0 installer allows choosing the Java path, so that users have an easier way out (although I assume they will fail to select the right path). This "bug" will not be resolved, please do not reopen it. The Bug is still there. I have the same Problem. Here is my Testcase: 1. I made a clean W2k Server install. (VMware rulez) 2. I installed SP3 (SP2 is needed for the new Sun SDK) 3. I installed j2sdk-1_4_1_02-windows-i586.exe with the default settings. 4. I installed jakarta-tomcat-4.1.24-LE-jdk14.exe, default settings, but NT Service checked. 5. I opened the shortcut "Tomcat Administration" -> same Error as stated by Steve Vanspall 6. I stopped the NT service and opened the shortcut "Start Tomcat" -> opened "Tomcat Administration" -> everything is working fine. I have the same wrong entry in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Apache Tomcat 4.1 \Parameters\JVM Library as stated by Steve Fyfe. After I fixed it the tomcat service is working. BTW. After my installation i have three jvm.dll on my system: Two with the same size in: C:\j2sdk1.4.1_02\jre\bin\client and C:\Program Files\Java\j2re1.4.1_02\bin\client and one bigger in: C:\j2sdk1.4.1_02\jre\bin\server I think tomcat needs the server one. I have not found where the wrong registry value for the service is set in tomcat.nsi so could someone give me a hint? kind regards Daniel This is actually not a bug report, but a possible way to fix a problem users might experience. I am unable to compile my JSP! Are you seeing this? org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: -1 in the jsp file: null Generated servlet error: [javac] Since fork is true, ignoring compiler setting. [javac] Compiling 1 source file [javac] Since fork is true, ignoring compiler setting. Like others, I have downloaded and installed the latest Java and Tomcat. Installed Java and it was running fine. Installed Tomcat (multiple tries) with no success. I followed all the comments I could find. The environment variables, tricks, with the NT service and without, but I kept getting the compile error message, until... During the Tomcat install there is a pop-up message toward the end that talks about testing, the port 8080, user admin, password blank. During every attempt to install Tomcat, I had always put a password in. This last time, I tried it without a password and it worked. If you have questions send me an e-mail dlovvorn@rtkl.com I have the same problem with a different spin to it: In the browser, I see <<org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: -1 in the jsp file: null Generated servlet error: [javac] Since fork is true, ignoring compiler setting. [javac] Compiling 1 source file [javac] Since fork is true, ignoring compiler setting. [javac] javac: invalid flag: C:\Java\jars\Tomcat [javac] Usage: javac [javac] where possible options include: [javac] -g Generate all debugging info [javac] -g:none Generate no debugging info [javac] -g:{lines,vars,source} Generate only some debugging info [javac] -nowarn Generate no warnings [javac] -verbose Output messages about what the compiler is doing [javac] -deprecation Output source locations where deprecated APIs are used [javac] -classpath Specify where to find user class files [javac] -sourcepath Specify where to find input source files [javac] -bootclasspath Override location of bootstrap class files [javac] -extdirs Override location of installed extensions [javac] -d Specify where to place generated class files [javac] -encoding Specify character encoding used by source files [javac] -source Provide source compatibility with specified release [javac] -target Generate class files for specific VM version [javac] -help Print a synopsis of standard options at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:130) at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293) at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:353) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370) ....>> In catalina.out <<19.07.2003 07:52:43 org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote HTTP/1.1 on port 8443 Compile failed; see the compiler error output for details. at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:842) at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:682) at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:317) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:370) ...>> I solved it by re-installing tomcat in a directory that has no spaces in its path. I don't know how I fell into this problem, because before, I ran tomcat dozens of times successfully even with the space in the "..cat 4.1". Suggestions: For the exception case, have org.apache.jasper.compiler.Compiler.compile or org.apache.tools.ant.taskdefs.Javac.compile with which arguments they call javac and where they get them from! One more strange observation: - even though I installed with windows installer, the windows registry is unchanged (still has the old paths with spaces e.g. in "JVM Option Number 0" or "System.err File") - it even has as "JVM library" a jdk1.3... that I deleted months ago This is handled by the FAQ. http://jakarta.apache.org/tomcat/faq/misc.html#compile |