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.
I have a standard web project, with "IBM WebSphere Application Server V6.0" selected in the Run -> Server project setting. Clean/Build/Run at the project level works as expected, and I can browse the app running in my WAS 6 installation. However, if I edit one of the JSPs and select Run File (right-clicking in the project explorer window) it fails to build and the output window contains the following: init: deps-module-jar: deps-ear-jar: deps-jar: library-inclusion-in-archive: library-inclusion-in-manifest: compile: compile-jsps: Created dir: C:\fmg\build\generated\src Created dir: C:\fmg\build\generated\classes Compiling 1 source file to C:\fmg\build\generated\classes C:\fmg\build\generated\src\org\apache\jsp\jsp\test_jsp.java:7: cannot access org.apache.jasper.runtime.HttpJspBase bad class file: C:\Program Files\NetBeans 6.1 Beta\enterprise5\modules\ext\glassfish-jspparser-2.0.jar(org/apache/jasper/runtime/HttpJspBase.class) class file has wrong version 49.0, should be 48.0 Please remove or make sure it appears in the correct subdirectory of the classpath. public final class test_jsp extends org.apache.jasper.runtime.HttpJspBase 1 error C:\fmg\nbproject\build-impl.xml:453: The following error occurred while executing this line: C:\fmg\nbproject\build-impl.xml:204: Compile failed; see the compiler error output for details. BUILD FAILED (total time: 17 seconds)
Part of the problem (and this may be a more general problem with web apps rather than the WAS6 module) is the fact it's trying to test compile the single JSP in the first place. Compare the compile-jsps and -do-compile-single-jsp targets: <target depends="compile" description="Test compile JSP pages to expose compilation errors." if="do.compile.jsps" name="compile-jsps"> ... <target depends="compile" if="jsp.includes" name="-do-compile-single-jsp"> I've got compile.jsps=false in project.properties, which probably explains why only the single JSP gives me the problem. Perhaps there needs to be an additional jsp.includes+do.compile.jsps property, in the same fashion as the netbeans.home+have.tests one? As for the action error message (incorrect class version), I guess that's because I've got "IBM JDK 1.4" selected as the Java Platform (pointing to the JDK from the WAS6 runtime directory)? But since WAS 6.0 only uses 1.4.2, not 1.5 (which came in with WAS 6.1) I suspect changing this would just lead to similar errors about the class versions after I deploy the app to the server. I'm surprised it needs org.apache.jasper.runtime.HttpJspBase at all, though, since I'm targetting Websphere. Surely it should be using some equivalent class from Websphere's j2ee.jar? I haven't yet figured out where it's picking that up from, though, there's no mention of Glassfish in j2ee.platform.classpath
Okay, a fresh morning and realisation dawns... The reference to jasper's HttpJspBase is of course in the generated servlet, and will be due to the <java classname="org.netbeans.modules.web.project.ant.JspCSingle" failonerror="true" fork="true"> command (and I suspect <java classname="org.netbeans.modules.web.project.ant.JspC" failonerror="true" fork="true"> too) being coded to use Glassfish's JSP compiler. WAS, not unexpectedly, will have its own JSP compiler that generates code which uses its own base class instead. I found classes com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase and com.ibm.ws.jsp.runtime.HttpJspBase in $WAS/runtimes/base_v6/lib/jspruntime.jar so I'd assume one of those is the base class used by WAS. I also see some jasper packages in that jar so I guess it was derived from jasper at some point. Ideally, I suppose NetBeans JspC/JspCSingle classes should delegate to (a class in the WAS plugin that calls) Websphere's JSP compiler when that's selected as the target server type for the project, but I don't know if they're currently written to allow for that...? If it helps any, I found the classes com.ibm.wsspi.jsp.compiler.JspCompiler (and JspCompilerFactory, JspCompilerResult & JspLineId) in the jsptranslation.jar in the runtime. I'm guessing those are the classes that should be used. One other thing I forgot to mention in all this, on the off chance it's relevant I'm using the NB6.1 beta under Sun's JDK 1.6.0_02 on Windows XP.
Thanks a lot for your detail report. I'll investigate the behaviour.
Unfortunately I'm not able to reproduce this issue. Maybe it is not related to WS at all. Can try the same thing with different server? The fail occurs even before any action with WS is taken. I'm guessing JspCSingle runs with java 1.4 somehow. But I can't imagine how this could happen. Do you have any special configuration of your project? What is your JAVA_HOME and the content of C:\Program Files\NetBeans 6.1 Beta\etc\netbeans.conf? What is the output of the "java -version"? Can you provide your project for testing? Thanks, P.
No response from user. Closing as WORKSFORME. Feel free to reopen.
Well, it's not hard to reproduce for me :-( Create new web application project, select WAS 6.0 as the target server, IBM JDK 1.4 on the Libraries tab, 1.4 as the source version, right-click index.jsp and select "compile file", and... compile-single-jsp: init: deps-module-jar: deps-ear-jar: deps-jar: Created dir: C:\test\WebApplication1\build\web\WEB-INF\classes Created dir: C:\test\WebApplication1\build\web\META-INF Copying 1 file to C:\test\WebApplication1\build\web\META-INF Copying 4 files to C:\test\WebApplication1\build\web library-inclusion-in-archive: library-inclusion-in-manifest: compile: Created dir: C:\test\WebApplication1\build\generated\src Created dir: C:\test\WebApplication1\build\generated\classes Compiling 1 source file to C:\test\WebApplication1\build\generated\classes C:\test\WebApplication1\build\generated\src\org\apache\jsp\index_jsp.java:7: cannot access org.apache.jasper.runtime.HttpJspBase bad class file: C:\Program Files\NetBeans 6.1\enterprise5\modules\ext\glassfish-jspparser-2.0.jar(org/apache/jasper/runtime/HttpJspBase.class) class file has wrong version 49.0, should be 48.0 Please remove or make sure it appears in the correct subdirectory of the classpath. public final class index_jsp extends org.apache.jasper.runtime.HttpJspBase 1 error C:\test\WebApplication1\nbproject\build-impl.xml:508: The following error occurred while executing this line: C:\test\WebApplication1\nbproject\build-impl.xml:500: The following error occurred while executing this line: C:\test\WebApplication1\nbproject\build-impl.xml:243: Compile failed; see the compiler error output for details. BUILD FAILED (total time: 10 seconds) Adding various debug <echo> tasks to the build.xml, I get uriroot=C:\test\WebApplication1/build/web d=C:\test\WebApplication1/build/generated/src jspc.files=C:\test\WebApplication1\build\web\index.jsp compilerSourceVM=1.4 compilerTargetVM=1.4 java.home=C:\Program Files\Java\jdk\1.6.0\jre copyfiles.classpath=C:\Program Files\NetBeans 6.1\enterprise5\ant\extra\copyfiles.jar jspcompilation.classpath=C:\Program Files\NetBeans 6.1\java2\ant\lib\ant.jar:C:\Program Files\NetBeans 6.1\enterprise5\modules\ext\servlet2.5-jsp2.1-api.jar:C:\RAD7\runtimes\base_v6\lib\j2ee.jar:C:\Program Files\NetBeans 6.1\enterprise5\modules\ext\glassfish-jspparser-2.0.jar:C:\Program Files\NetBeans 6.1\enterprise5\modules\ext\glassfish-logging-2.0.jar:C:\Program Files\NetBeans 6.1\ide9\modules\ext\commons-logging-1.0.4.jar:C:\Program Files\NetBeans 6.1\java2\ant\lib\ant-launcher.jar: I'll zip & attach the project, netbeans.conf and build.properties from the userdir. This was with 6.1 final, up to date with current patches. Help->About reports Product Version: NetBeans IDE 6.1 (Build 200804211638) Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b05 System: Windows XP version 5.1 running on x86; Cp1252; en_GB (nb) Userdir: C:\temp\netbeans\6.1 Changing the server to GlassFish V2, followed by Clean and Compile File again produces the same message, as does Apache Tomcat 6.0.16 Changing the Java Platform to JDK 1.4 (Sun's) also produces the message; selecting JDK 1.5, JDK 1.6 (default) or IBM JDK 1.5 results in BUILD SUCCESSFUL.
Created attachment 68021 [details] testcase
Hmm... a couple of further thoughts. I just realised the line no. mentioned in the error's stack trace is not the <java classname="org.netbeans.modules.web.project.ant.JspCSingle"> task of the -do-compile-single-jsp target but the <webproject2:javac> task. This, of course, uses the selected java platform so any project targetting a 1.4 or earlier JDK will object to the glassfish-jspparser-2.0.jar since that's built for 1.5. That alone might make it a more general "web project" issue rather than serverplugins, except that arguably it's not a valid test anyway to compile the JSPs using the parser/compiler from a server other than the selected target server platform. And the fact the error message mentions org.apache.jasper.runtime.HttpJspBase rather than com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase or com.ibm.ws.jsp.runtime.HttpJspBase seems to suggest this is what's happening. Potentially (due to JSP implementation bugs or whatever in the server) a JSP that Glassfish is perfectly happy with might not compile when deployed to some other server, since the generated servlet will be different, so org.netbeans.modules.web.project.ant.JspC/JspCSingle ought to use the server-specific JSP compiler to generate the servlet, which brings us back into serverplugins' realm. Here's another thought - assuming IBM's JSP compiler produces servlets extending their own class rather than org.apache.jasper.runtime.HttpJspBase, would we still have seen the class version error? It's the 1.5+ jasper class that javac is attempting to read from the glassfish jar; IBM's base class would be loaded from their j2ee jar, and is built with the earlier JDK anyway.
feel free to reopen if you see similar issue