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 module suite with one Library Wrapper module and one NetBeans Plugin module. The plugin needs classes from the library. I build .nbm files for the library and plugin. Then I install the library.nbm and plugin.nbm. Everything works fine. Then I uninstall the plugin. The library module automatically gets disabled. Then I install the plugin again. The library module automatically gets enabled again. But the plugin now gets a NoClassDefFoundError when trying to use classes from the library. After restart of IDE, it works again. Using NB 5.0 Beta, JDK 5.0_04.
0. 051020, Linux, Mustang. 1. Make a new suite project. 2. Add a lib wrapper for jmf.jar (from Java Media Framework). 3. Add a regular module; give it a dep on the lib wrapper. 4. Make an Action in the module, always enabled, add to menu. 5. Write public void performAction() { System.err.println(javax.media.Manager.class); } 6. Clean & build suite. 7. Reload module in target platform. When platform starts, select menu item. Prints class javax.media.Manager 8. Reload again, run it again, works again. ------------------------------------------------------------------------------- Turning on modules: org.openide.util [6.5 051020] org.openide.modules [6.4 051020] jmf [1.0 051020] org.yourorghere.module22 [1.0 051020] [...] Deploying test module /tmp/suite10/build/cluster/modules/org-yourorghere-module22.jar... Disabling StandardModule:org.yourorghere.module22 jarFile: /tmp/suite10/build/cluster/modules/org-yourorghere-module22.jar... Turning off modules: org.yourorghere.module22 [1.0 051020] jmf [1.0 051020] Enabling StandardModule:org.yourorghere.module22 jarFile: /tmp/suite10/build/cluster/modules/org-yourorghere-module22.jar... Turning on modules: jmf [1.0 051020] org.yourorghere.module22 [1.0 051020] Done. class javax.media.Manager Deploying test module /tmp/suite10/build/cluster/modules/org-yourorghere-module22.jar... Disabling StandardModule:org.yourorghere.module22 jarFile: /tmp/suite10/build/cluster/modules/org-yourorghere-module22.jar... Turning off modules: org.yourorghere.module22 [1.0 051020] jmf [1.0 051020] Enabling StandardModule:org.yourorghere.module22 jarFile: /tmp/suite10/build/cluster/modules/org-yourorghere-module22.jar... Turning on modules: jmf [1.0 051020] org.yourorghere.module22 [1.0 051020] Done. class javax.media.Manager
I still have the same problem with my module in NB 5.0 Beta 2. Your repro is not exactly the same, as what I have described. Should I upload my project (~18 MB because lots of jars from outside module)?
If possible, a smaller test case is appreciated, but what counts is whether it can really be reproduced by someone else using only the files you upload and instructions you provide.
I went through your jmf example. On first Install/Reload, I got this exception: java.lang.IllegalArgumentException: Cannot disable autoload: StandardModule:jmapps.ui jarFile: D:\temp\suite1\build\cluster\modules\jmapps-ui.jar at org.netbeans.ModuleManager.simulateDisable(ModuleManager.java:1209) at org.netbeans.core.startup.ModuleSystem.turnOffModule(ModuleSystem.java:366) at org.netbeans.core.startup.ModuleSystem.deployTestModule(ModuleSystem.java:295) at org.netbeans.core.startup.TestModuleDeployer.deployTestModule(TestModuleDeployer.java:40) at org.netbeans.core.startup.CLITestModuleReload.cli(CLITestModuleReload.java:47) at org.netbeans.CLIHandler.notifyHandlers(CLIHandler.java:173) at org.netbeans.CLIHandler.access$000(CLIHandler.java:42) at org.netbeans.CLIHandler$1.exec(CLIHandler.java:493) at org.netbeans.CLIHandler.finishInitialization(CLIHandler.java:342) at org.netbeans.Main.finishInitialization(Main.java:184) at org.netbeans.core.NonGui.run(NonGui.java:136) at org.netbeans.core.startup.Main.start(Main.java:395) at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:90) [catch] at java.lang.Thread.run(Thread.java:595) But it worked. And a 2nd reload also worked, as you described. Then I created NBMs for module and wrapper and installed them in the running IDE. Worked. Then I uninstalled the module and installed it again. Worked. Then I uninstalled module and wrapper and tried to install again both NBMs. This got me some ZIP errors and a not working module. Uninstalled the module and again installed both. Worked. You see, there are some glitches using your example, but basically, it works. Still it does not work with my module. I am willing to upload it and provide instructions to reproduce the problem. Can I upload such large files as attachment here?
BTW, I was using NB Beta 2, JDK 5.0_06 for the latest test.
Re. IAE on autoload - you attempted to reload an autoload module, such as the lib wrapper, directly. You cannot do that currently. You can reload a regular module which depends on an autoload module however. My step #7 was referring to the regular module, not the lib wrapper, and it should work without exceptions. Re. uploading large attachments - not into Issuezilla. (Anything over 1Mb will be rejected.) Anyway I don't know if your source code is confidential. You can send to jesse.glick@sun.com privately (mention the bug #). But you need to be precise about what you have to do in order to reproduce - assume I have no idea what you are talking about when you say something like "then I uninstall the plugin". Replace with "then I choose Tools -> Module Manager in the target IDE, select Foo Bar in the category Stuff and uncheck Enable, then close Module Manager and exit the target IDE, then ...". Ideal is to trim unnecessary details from your module and progressively whittle it down to a small test case, since that indicates what is special about your situation; if you don't do it, I will probably need to.
I have sent you a mail with instructions and code.
Unable to reproduce exactly acc. to (privately sent) instructions. I do get a NCDFE, but earlier than reporter claims - immediately upon first trying the module's functionality when installed. Get java.lang.NoClassDefFoundError at com.apag.p2plus.p2core.Transaction.<clinit>(Transaction.java:97) at com.apag.p2plus.netbeans.MyAction.performAction(MyAction.java:101) at org.openide.util.actions.CallableSystemAction$1.run(CallableSystemAction.java:94) ... Tracking it down a bit I find $ java -classpath nb/nb5.0/modules/ext/p2plus.jar com.apag.p2plus.p2core.Transaction Exception in thread "main" java.lang.NoClassDefFoundError: com/inzoom/comjni/ComJniException at com.apag.p2plus.p2core.Transaction.<clinit>(Transaction.java:97) gives more info, and this gives still more: $ java -classpath nb/nb5.0/modules/ext/p2plus.jar:nb/nb5.0/modules/ext/izmcomjni.jar com.apag.p2plus.p2core.Transaction Exception in thread "main" java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: c:\program files\infozoom\izmjnicom.dll at java.lang.Runtime.load0(Runtime.java:766) at java.lang.System.load(System.java:967) at com.inzoom.comjni.Dll.start(Dll.java:79) at com.inzoom.comjni.Dll.runRoyaltyFree(Dll.java:47) at com.apag.p2plus.p2core.Tool.<clinit>(Tool.java:225) at com.apag.p2plus.p2core.Transaction.<clinit>(Transaction.java:97) So assuming a problem with reporter's libraries of some sort.
Sorry, I did not provide the necessary DLLs with the repro mail. I had tested the repro on another machine, but did not realize, that those DLLs are installed on all machines here. However, thanks to your analysis, I was able to track down the problem and find the real cause: java.lang.UnsatisfiedLinkError: Native Library xxx already loaded in another classloader Apparently, the problem occurs, if the lib wrapper uses a native library. After uninstalling the module, the lib wrapper becomes inactive. When installing the module again, NB tried to activate the lib wrapper again, which results in the error. I also have a very small test case now, which I can upload here, if you are interested. If this is not supported, then feel free to close again as invalid.
Ah, definitely invalid then. It is impossible to reload native libraries as far as I know, due to a limitation of the JVM: http://www.netbeans.org/download/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/api.html#jni
More precisely: you *can* reload a JNI library if the previous ClassLoader to load it has been garbage collected and finalized. But the NB module system cannot as a rule force a module class loader to be collected immediately after the module is disabled. It can try, by trying to null out all of its own references and call System.gc(), and I think does try; but if some other code is holding onto the class loader, even if only momentarily, then there is nothing to be done. (In fact this used to cause problems with unreleased JAR locks on Windows when reloading modules, which is one reason we cannot use java.net.URLClassLoader.) So while I would like to support reloading of JNI-based modules, I don't see a way to make it work. The workarounds are: 1. During development only, put the actual JAR with the JNI bindings on the app classpath so it is not actually reloaded. Cumbersome to set up, though. 2. Shut down the test app and restart rather than using reload. Safe but slow.
OK, thanks for your efforts and clarification.