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
/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.
I'm not able to reproduce this issue following the steps above.
Which version of application server do you use?
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.
Also as soon as I switch the target server back to Glashfish, run index.jsp fails.
Reproducible on Win XP.
I will look at it. Thanks for reporting.
which jdk is GF using? check the value of AS_JAVA in asenv.conf or asenv.bat
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
- 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
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.
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?
> 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.
GF issues are already fixed but will be integrated in GF V3. So workarounded.
Please verify and reopen if the problem still exists. Thanks.
*** Issue 128232 has been marked as a duplicate of this issue. ***
Integrated into 'main-golden', available in NB_Trunk_Production #271 build
User: Tomas Mysik <email@example.com>
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.
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)