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 135568 - Error running JSP in web application with source/target JDK 1.6
Summary: Error running JSP in web application with source/target JDK 1.6
Status: VERIFIED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: JSP (show other bugs)
Version: 6.x
Hardware: Sun All
: P2 blocker (vote)
Assignee: Tomas Mysik
URL:
Keywords:
: 128232 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-05-22 00:02 UTC by Nam Nguyen
Modified: 2008-09-18 14:16 UTC (History)
4 users (show)

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 Nam Nguyen 2008-05-22 00:02:20 UTC
Using NB 6.1 FCS running with JDK 1.6
- Create standard web project accepting all default
- Use project customizer and change Source > 'Source/binary format' value to JDK 6.
- Run the index.jsp
Will get error:

Exception in thread "main" java.lang.IllegalArgumentException: PWC6309: Illegal compilerSourceVM: 1.6
        at org.apache.jasper.JspC.setCompilerSourceVM(JspC.java:707)
        at org.netbeans.
modules.web.project.ant.JspC.main(JspC.java:78)
        at org.netbeans.modules.web.project.ant.JspCSingle.main(JspCSingle.java:122)
/export/home/nam/NetBeansProjects/WebApplication5/nbproject/build-impl.xml:452: Java returned: 1
BUILD FAILED (total time: 4 seconds)

If JSP is not supported with JDK 6 then some warning or prevention of selection mechanism should exist.
Comment 1 Jan Horvath 2008-05-22 11:16:08 UTC
I'm not able to reproduce this issue following the steps above. 
Which version of application server do you use?
Comment 2 Nam Nguyen 2008-05-22 17:19:12 UTC
Here are more details:
- I am on Solaris x86 (don't think it matters, though, because one of my colleague also see this on windows).
- I don't have JDK 1.5 registered as Java Platform
- I start with fresh userdir (also don't think it matters).
- My glassfish is from NB6.1 bundled v2ur2 (the failure is consistent and right at compilation time).
- The test case works fine with Tomcat target.

Comment 3 Nam Nguyen 2008-05-22 17:21:04 UTC
Also as soon as I switch the target server back to Glashfish, run index.jsp fails.
Comment 4 Dan Kolar 2008-05-26 09:35:44 UTC
Reproducible on Win XP.
Comment 5 Tomas Mysik 2008-05-26 10:01:35 UTC
I will look at it. Thanks for reporting.
Comment 6 Vince Kraemer 2008-06-02 05:07:53 UTC
which jdk is GF using?  check the value of AS_JAVA in asenv.conf or asenv.bat
Comment 7 Tomas Mysik 2008-06-11 09:53:55 UTC
This issue is related to changeset http://hg.netbeans.org/main/rev/3c1577e4ccfa (done by Tomas Zezula). But it is NOT 
a regression because it wasn't possible to compile JSP on JDK 6 on NB 6.0 FCS as well. Here is the explanation:
- in NB 6.0 if one sets project to use JDK 6, then the javac target is set to "1.6" but javac source is set to "1.5" 
and so the exception for NB 6.0 FCS is this:

Exception in thread "main" java.lang.IllegalArgumentException: PWC6311: compilerTargetVM 1.6 too high
        at org.apache.jasper.JspC.setCompilerTargetVM(JspC.java:686)

- in NB 6.1 FCS the javac source has been changed to "1.6" so the exception is different (see the first post)

The reason is that we use Jasper Ant task for compiling JSP and this task forbids using "1.6" as javac source but 
allows "1.6" as javac target (I don't know why, issue filed, see 
https://glassfish.dev.java.net/issues/show_bug.cgi?id=5126).

BUT I have discovered another bug in this Ant task which is related - the detection of the current Java specification 
version is incorrect (see https://glassfish.dev.java.net/issues/show_bug.cgi?id=5138) - this is the cause of the 
exception in NB 6.0.

Why it works with Tomcat? Because we put server libraries on the classpath before our JSP Parser (taken from GF) and 
Tomcat uses Jasper as well but their Ant task is quite modified and doesn't do any similar checks.

Possible solution is, for the Ant task only, to set javac source and javac target to "1.5" if the JDK 6 is selected 
(not sure if it can have any impact on JSPs but I don't think so); this will not affect Java editor so the javac 
source for Java files will stay "1.6".
Another fix should probably be to put our JSP Parser before server libraries so we know that "our" Ant task is always 
used (if Tomcat changes this Ant task - e.g. makes it final - then we have problem).

Any suggestions/comments/ideas please? If not I will do these two fixes but first I would like to wait for any 
reaction from GF.
IMHO this issue is not P1 but probably P2, the workaround exists and is quite easy - just use JDK 5 or do not 
compile/run any specific JSP, just run the whole project and no issue will happen.
Comment 8 David Konecny 2008-06-11 22:37:43 UTC
Perhaps unrelated but last time I looked jasper distributed with NB I could not figure out which version it is but I had
feeling it was quite an old version missing lot of bugfixes. I would suggest to double check it and perhaps update it?
Comment 9 Tomas Mysik 2008-06-12 06:21:26 UTC
> I would suggest to double check it and perhaps update it?

Could be - I can try to do it (I think only Petr Pisl right now knows what exactly is needed :). But I was looking at 
actual sources so the bugs against GF are valid IMHO. Thanks for your comment, Davide.
Comment 10 Tomas Mysik 2008-06-19 11:47:36 UTC
GF issues are already fixed but will be integrated in GF V3. So workarounded.
http://hg.netbeans.org/main?cmd=changeset;node=3ab9da6e2570

Please verify and reopen if the problem still exists. Thanks.
Comment 11 Tomas Mysik 2008-06-19 17:02:03 UTC
*** Issue 128232 has been marked as a duplicate of this issue. ***
Comment 12 Quality Engineering 2008-06-20 15:51:36 UTC
Integrated into 'main-golden', available in NB_Trunk_Production #271 build
Changeset: http://hg.netbeans.org/main/rev/3ab9da6e2570
User: Tomas Mysik <tmysik@netbeans.org>
Log: Workaround for #135568: Error running JSP in web application with source/target JDK 1.6

The proper fix must be done in GF, see IZ for more information.
Comment 13 josin 2008-09-18 14:16:28 UTC
V.

Product Version: NetBeans IDE Dev (Build 200809180201)
Java: 1.6.0_10-beta; Java HotSpot(TM) Client VM 11.0-b11
System: Linux version 2.6.24-19-generic running on i386; UTF-8; en_US (nb)