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.
Product Version: NetBeans IDE 6.7 RC3 (Build 200906142201) Java: 1.5.0_19; Java HotSpot(TM) Client VM 1.5.0_19-137 System: Mac OS X version 10.5.7 running on i386; MacRoman; en_US (nb) After the update of JDK on Mac OS X it is not possible to create project. When I create new J2SE project the wizard stops and the exception appears: java.lang.NoClassDefFoundError: javax/script/ScriptEngineFactory at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:675) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124) at java.net.URLClassLoader.defineClass(URLClassLoader.java:260) at java.net.URLClassLoader.access$100(URLClassLoader.java:56) at java.net.URLClassLoader$1.run(URLClassLoader.java:195) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(ClassLoader.java:316) at java.lang.ClassLoader.loadClass(ClassLoader.java:306) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:209) at java.lang.ClassLoader.loadClass(ClassLoader.java:251) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:242) at sun.misc.Service$LazyIterator.next(Service.java:271) at javax.script.ScriptEngineManager.initEngines(ScriptEngineManager.java:127) at javax.script.ScriptEngineManager.access$000(ScriptEngineManager.java:55) at javax.script.ScriptEngineManager$1.run(ScriptEngineManager.java:98) at java.security.AccessController.doPrivileged(Native Method) at javax.script.ScriptEngineManager.init(ScriptEngineManager.java:96) at javax.script.ScriptEngineManager.<init>(ScriptEngineManager.java:69) at org.netbeans.modules.templates.ScriptingCreateFromTemplateHandler.engine(ScriptingCreateFromTemplateHandler.java:129) at org.netbeans.modules.templates.ScriptingCreateFromTemplateHandler.accept(ScriptingCreateFromTemplateHandler.java:70) at org.openide.loaders.MultiDataObject.handleCreateFromTemplate(MultiDataObject.java:707) at org.openide.loaders.DefaultDataObject.handleCreateFromTemplate(DefaultDataObject.java:159) at org.openide.loaders.DataObject$CreateAction.run(DataObject.java:1288) at org.openide.loaders.DataObjectPool$1WrapAtomicAction.run(DataObjectPool.java:258) at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:120) at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:509) at org.openide.loaders.DataObjectPool.runAtomicAction(DataObjectPool.java:270) at org.openide.loaders.DataObject.invokeAtomicAction(DataObject.java:873) at org.openide.loaders.DataObject.createFromTemplate(DataObject.java:805) at org.openide.loaders.DataObject.createFromTemplate(DataObject.java:785) at org.netbeans.modules.java.j2seproject.J2SEProjectGenerator.createMainClass(J2SEProjectGenerator.java:381) at org.netbeans.modules.java.j2seproject.J2SEProjectGenerator.access$200(J2SEProjectGenerator.java:78) at org.netbeans.modules.java.j2seproject.J2SEProjectGenerator$1.run(J2SEProjectGenerator.java:114) at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:120) at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:509) at org.netbeans.modules.java.j2seproject.J2SEProjectGenerator.createProject(J2SEProjectGenerator.java:95) at org.netbeans.modules.java.j2seproject.ui.wizards.NewJ2SEProjectWizardIterator.instantiate(NewJ2SEProjectWizardIterator.java:182) at org.openide.loaders.TemplateWizard$InstantiatingIteratorBridge.instantiate(TemplateWizard.java:1016) at org.openide.loaders.TemplateWizard.handleInstantiate(TemplateWizard.java:588) at org.openide.loaders.TemplateWizard.instantiateNewObjects(TemplateWizard.java:409) at org.openide.loaders.TemplateWizardIterImpl.instantiate(TemplateWizardIterImpl.java:253) at org.openide.loaders.TemplateWizardIteratorWrapper.instantiate(TemplateWizardIteratorWrapper.java:165) at org.openide.WizardDescriptor.callInstantiateOpen(WizardDescriptor.java:1524) at org.openide.WizardDescriptor.callInstantiate(WizardDescriptor.java:1481) at org.openide.WizardDescriptor.access$1700(WizardDescriptor.java:127) at org.openide.WizardDescriptor$Listener$2$1.run(WizardDescriptor.java:2052) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:577) [catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:1030) With previous version JDK build 1.5.0_16-133 everything worked properly. Now the workaround is to start NetBeans with jdkhome switch pointing to JDK6. Seems like the problem is similar to http://www.netbeans.org/issues/show_bug.cgi?id=129227
I suspect the issue is the same as with 6.5.1, see http://www.netbeans.org/issues/show_bug.cgi?id=167188 Don't know if the scripting-api.jar is still included with 6.7 though since I'm using 6.5.1
*** Issue 167268 has been marked as a duplicate of this issue. ***
Please review the patch for jsr223.jar ScriptEngineManager.java 136a137,146 > } catch (UnsupportedClassVersionError err) { > if (DEBUG) { > err.printStackTrace(); > } > continue; > } catch (NoClassDefFoundError ncdfe) { > if (DEBUG) { > ncdfe.printStackTrace(); > } > continue;
Verified in custom build by QE, please transplant into release_67.
Fixed in core-main and release67. http://hg.netbeans.org/core-main/rev/2c89ca25465f http://hg.netbeans.org/release67/rev/f5e6c212c0fb
The patch does not explain what was really wrong on the Mac. A full explanation belongs here in IZ. Would this be better fixed by adding to libs.jsr223/manifest.mf: OpenIDE-Module-Hide-Classpath-Packages: javax.script.** ?
Integrated into 'main-golden', will be available in build *200906190201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/2c89ca25465f User: Milan Kubec <mkubec@netbeans.org> Log: #167240: catching and ignoring NCDFE in javax.script.ScriptEngineManager
The problem on Mac is that JDK 5 and JDK 6 both see /System/Library/Java/Extensions/AppleScriptEngine.jar and this jar when NB scripting module (running on JDK 5) wants to load all impls. for javax.script will be loaded by boot classloader, but this classloader cannot see javax.script package on JDK 5 because only NB module classloader can see it. We already had this problem, but it was manifested by "UnsupportedClassVersionError: Bad version number in .class file" (see issue #129227), because that jar was compiled by JDK 6, so out first fix was to ignore that error. With recent JDK update this jar has been updated but this time already compiled by JDK 5, so our catch stopped working, so I added other catch, this time for NCDFE. I cannot say whether "OpenIDE-Module-Hide-Classpath-Packages: javax.script.**" in manifest would fix the problem.
Sources for the javax.script are on http://libs.netbeans.org/servlets/ProjectDocumentList Patch file for these sources will be attached.
Created attachment 83790 [details] Patch
Created attachment 83791 [details] jar file with the fix (platform/modules/ext/script-api.jar)
Attached patch file contains also change already applied when fixing issue #129227.
Verified in release67 build by QE.
Please at least try OIDE-M-H-C-P to see if it works. This would seem to me a cleaner fix than patching the Script API JAR. The effect would be for NB's module class loader to ignore the specified packages if they happen to be on the bootclasspath, always using its own. From your description perhaps what you really want is to also/instead ignore the packages contained in AppleScriptEngine.jar, whatever those are.
From your description it would probably work, but I don't know if it's what we want to do. The fix you are proposing would change also loading of scripting frameworks for JDK 6 and above and I'm not sure we want to do it. The fix is only because of JDK 5, but it will reach its End of Service Life on October 30th, 2009. So it's highly probable that we won't support JDK 5 after this date.
Yes, of course when we drop JDK 5 support then we can simply delete libs.jsr223, so it will no longer be an issue.
> Please at least try OIDE-M-H-C-P to see if it works. I can bet five beers that it does not work.
*** Issue 167617 has been marked as a duplicate of this issue. ***
*** Issue 167685 has been marked as a duplicate of this issue. ***
*** Issue 167722 has been marked as a duplicate of this issue. ***
*** Issue 168645 has been marked as a duplicate of this issue. ***
One of the things that occurs to me, is that perhaps there is not the correct classloader mechanisms involved here. The Jini platform, along time ago, starting providing the PreferredClassLoader and PreferredClassProvider (for the SPI) that allows jar files to contain META-INF/PREFERRED.LIST as a list that indicates preferred packages and classes. What this provides, is the ability for a jar to substitute "working" for "broken" platform classes so that the jar can guarantee that it gets the correct version of a class that it knows will provide the proper implementation. This really helps tremendously in making sure that platforms are platforms and that impls can be provided for particular Jars to use so that things that are not shared beyond a particular class loader root can be provided by jars that need specific implementations with no worries about class name conflicts. This would also help compartmentalize the platform module mechanism to allow modules to truly be standalone.
What greggwon describes is essentially OpenIDE-Module-Hide-Classpath-Packages, I think. We decided that we will not bother with this since the issue becomes moot once JDK 5 support is dropped.
*** Issue 168719 has been marked as a duplicate of this issue. ***
*** Bug 184986 has been marked as a duplicate of this bug. ***