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 213539 - CNFEs for Class-Path extensions after "Reload in Target Platform" for Maven NBM
Summary: CNFEs for Class-Path extensions after "Reload in Target Platform" for Maven NBM
Status: RESOLVED FIXED
Alias: None
Product: apisupport
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.0
Hardware: All All
: P2 normal (vote)
Assignee: Jesse Glick
URL:
Keywords:
: 213272 (view as bug list)
Depends on:
Blocks: 195074
  Show dependency tree
 
Reported: 2012-06-04 13:13 UTC by gregersen
Modified: 2012-06-12 15:32 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Test case (16.22 KB, application/zip)
2012-06-07 16:55 UTC, Jesse Glick
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gregersen 2012-06-04 13:13:12 UTC
For example if a module depends on Apache Commons Collections:

When using "Reload in Target Platform", the jarfile passed to the CLI is the file located in "target/", but in the manifest file of the jar, the dependencies are listed like:
X-Class-Path: ext/commons-collections/commons-collections-3.2.1.jar
Maven-Class-Path: commons-collections:commons-collections:3.2.1

But the file doesn't exist there, so you get ClassNotFoundException when trying to use classes from that library.

Instead, if target/nbm/netbeans/[name]/modules/[modulename].jar is used, then the ext folder with the dependencies are present, and the manifest has this instead:
Class-Path: ext/commons-collections/commons-collections-3.2.1.jar

Easy way to reproduce:
* Create  a new maven netbeans application
* create a new maven netbeans module
* Add commons collections as a dependency to module
* Create an action that uses a class from that library for instance: JOptionPane.showMessageDialog(null, new org.apache.commons.collections.bag.HashBag().getClass().toString());
* Start Application
* Trigger action -> popup box with "class org.apache.commons.collections.bag.HashBag"
* Select "Reload in target platform"
* Trigger action -> java.lang.ClassNotFoundException: org.apache.commons.collections.bag.HashBag

For Javeleon usage, we are currently patching the binaries in JaveleonModuleReloader to reload from target/nbm/netbeans/[name]/modules/[modulename].jar, but for standard module reloading the problem remains.
Comment 1 Jesse Glick 2012-06-07 16:31:46 UTC
Reproduced on Linux.
Comment 2 Jesse Glick 2012-06-07 16:55:35 UTC
Created attachment 120507 [details]
Test case
Comment 3 Jesse Glick 2012-06-07 16:57:28 UTC
core-main #7bc91f25f938
Comment 4 Quality Engineering 2012-06-08 06:06:41 UTC
Integrated into 'main-golden', will be available in build *201206080001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/7bc91f25f938
User: Jesse Glick <jglick@netbeans.org>
Log: #213539: CNFEs for Class-Path extensions after "Reload in Target Platform" for Maven NBM
Reload from unpacked NBM structure, rather than naked JAR (primary artifact) which lacks Class-Path.
Comment 5 Jesse Glick 2012-06-12 15:17:52 UTC
*** Bug 213272 has been marked as a duplicate of this bug. ***