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.
Created attachment 112889 [details] testcase in zip file This is a follow-up from issue 201937 - in fact this new error needs to be fixed also so that 201937 can be verified fixed. How to use the attached testcase: - Start NetBeans with a new userdir without importing settings - Create library JavaDB with files in the GlassFish distribution <GlassFish install dir>/javadb/lib/ - derby.jar - derbyclient.jar - derbynet.jar - Start JavaDB Server - Create database testDB if required - Under Drivers, JavaDB (Network) connect using URL: jdbc:derby://localhost:1527/testDB - Open project Web - Verify that "Compile on Save" is off - Replace the VM run option "javaagent" with your version e.g. -javaagent:"C:\Program Files\NetBeans 7.0.1\java\modules\ext\eclipselink\eclipselink-2.2.0.jar" - Clean and build the project - Compile the test class MyServiceTest - Run the test class MyServiceTest Te test should succeed and it succeeds - this is just test setup. To reproduce the error: - Turn "Compile on Save" on - Run the test class MyServiceTest The test fails with the following error: java.lang.ClassNotFoundException: javax.persistence.spi.PersistenceUnitInfo WARNING: multiple versions of ant detected in path for junit jar:file:/C:/Program%20Files/NetBeans%20Dev%20201111040600/java/ant/lib/ant.jar!/org/apache/tools/ant/Project.class and jar:file:/C:/Program%20Files/glassfish-3.1.1/glassfish/modules/ant.jar!/org/apache/tools/ant/Project.class java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:323) at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:338) Caused by: java.lang.NoClassDefFoundError: javax/persistence/spi/PersistenceUnitInfo at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:169) at org.eclipse.persistence.internal.jpa.deployment.JavaSECMPInitializerAgent.initializeFromAgent(JavaSECMPInitializerAgent.java:44) at org.eclipse.persistence.internal.jpa.deployment.JavaSECMPInitializerAgent.premain(JavaSECMPInitializerAgent.java:39) ... 6 more Caused by: java.lang.ClassNotFoundException: javax.persistence.spi.PersistenceUnitInfo at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) FATAL ERROR in native method: processing of -javaagent failed at java.lang.ClassLoader.loadClass(ClassLoader.java:247) ... 10 more Exception in thread "main" Testsuite: ejb.service.MyServiceTest Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec Testcase: ejb.service.MyServiceTest:null: Caused an ERROR Forked Java VM exited abnormally. Please note the time in the report does not reflect the time until the VM exit. junit.framework.AssertionFailedError: Forked Java VM exited abnormally. Please note the time in the report does not reflect the time until the VM exit. at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
With these details I see now it may be something similar to initial issue instead of new one, thanks. It may be an issue with incomplete ee api added froms server classpath also( and this api hide proper jpa api) and may be can be fixed by changes in classpath order in project properties. It's just some assumptions without deep evaluation so far.
Yet, with my assumtions it still strange as it mean classpath is still different for cos on/off.
I cannot reproduce this. I followed your steps exactly and the test passes in both of the cases. Sergey, can you reproduce it? Could anybody who is able to reproduce it turn Ant into verbose mode (in Output window click on Ant Settings icon and set Verbosity Level to "Verbose") and now run test with CoS enabled and save output from Ant and repeat the same with CoS disabled and again save output from Ant and attach both outputs to this issue. That way we can compare how javac is executed and why it fails in one case. Thx.
Created attachment 112985 [details] Verbose output COS off Product Version: NetBeans IDE Dev (Build 201111040600)
Created attachment 112986 [details] Verbose output COS on Product Version: NetBeans IDE Dev (Build 201111040600)
Just a note It may not be so good to use -javaagent:"C:\Program Files\NetBeans 7.0.1\java\modules\ext\eclipselink\eclipselink-2.2.0.jar" i.e. from 7.0.1 and verify in latest build which already use later eclipselink.
>Sergey, can you reproduce it? no I can't, even tried eclipselin 2.2.0 and 2.3.0 and gf 3.0.1 and 3.1.1 to have different libraries set. hope verbose will help.
When COS is enabled parameters for bootclasspath are screwed. Instead of: '-Xbootclasspath/p:C:\Program Files\NetBeans Dev 201111040600\enterprise\modules\ext\javaee6-endorsed\javax.annotation.jar;C:\Program Files\NetBeans Dev 201111040600\enterprise\modules\ext\javaee6-endorsed\jaxb-api-osgi.jar;C:\Program Files\NetBeans Dev 201111040600\enterprise\modules\ext\javaee6-endorsed\webservices-api-osgi.jar' there is: '-Xbootclasspath/p:C:\Program' 'Files\NetBeans' 'Dev' '201111040600\enterprise\modules\ext\javaee6-endorsed\javax.annotation.jar;C:\Program' 'Files\NetBeans' 'Dev' '201111040600\enterprise\modules\ext\javaee6-endorsed\jaxb-api-osgi.jar;C:\Program' 'Files\NetBeans' 'Dev' '201111040600\enterprise\modules\ext\javaee6-endorsed\webservices-api-osgi.jar' I'm not sure why it should cause NoClassDefFoundError though because C:\Program Files\glassfish-3.1.1\glassfish\modules\javax.persistence.jar is still on regular classpath. So perhaps the cause is somewhere else. I will fix the path first and then we will see.
Fixed in web-main #b34154fc468b The way to reproduce this problem is to start NetBeans IDE from a directory which has a space character in its path (without that issue never happens). When a test from attached test case is run what happens is that unit test must be run with endorsed classpath and jars of this endorsed classpath are in NetBeans installation and will therefore contain a space character in the path. I'm fixing it by quoting path. And I'm also converting path to have platform specific path delimiter.
Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/b34154fc468b User: David Konecny <dkonecny@netbeans.org> Log: #204729 - ClassNotFoundException when running JUnit Test with "Compile on Save" on