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 157757

Summary: Cannot create NB module that uses JAXB
Product: platform Reporter: kitfox <kitfox>
Component: -- Other --Assignee: issues@platform <issues>
Status: NEW ---    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description kitfox 2009-02-02 10:48:53 UTC
I'm writing a module for NetBeans so that I can conveniently edit a custom XML file with a visual interface in the
NetBeans environment.  Most of the the code for encapsulating, visualizing and mutating my file is stored in an ordinary
JAR file built in a regular NB library project.  I've then wrapped it in a module wrapper and added it to my module
suite.  I've also added a second module to my suite which creates the DataObjects, ClonableEditorSupports and other
things I would need to see it within the NB environment.

Unfortunately, my library uses JAXB to marshal my XML to and from its 'live' form - and according to bug 96711, this is
problematic.  I am using JDK 6 and have set the source level of both modules to version 1.6.  I've also included the
JAX-WS dependency for both modules, but am still unable to run.  Whenever any attempt is made to use JAXB, I get an
error like:

java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
	at org.netbeans.ProxyClassLoader.loadClass(ProxyClassLoader.java:253)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Caused: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
	at com.kitfox.tw.TileLayoutPanel.<init>(TileLayoutPanel.java:70)
	at com.kitfox.source.SourceLayoutPanel.<init>(SourceLayoutPanel.java:32)
	at com.kitfox.source.SourceGridView.<init>(SourceGridView.java:34)
	at com.kitfox.nb.source.SourceVisualView.createElement(SourceVisualView.java:109)
	at org.netbeans.core.multiview.MultiViewModel.getElementForDescription(MultiViewModel.java:206)
	at org.netbeans.core.multiview.MultiViewModel.getActiveElement(MultiViewModel.java:127)


What can I do to use JAXB in my module?
Comment 1 kitfox 2009-02-03 04:26:40 UTC
Okay, I found a work around:

1) Right click on the project of the wrapped module and select Properties
2) Select Libraries/Add Dependency...   Check Non API Modules and scroll down to JAXB 2.1 library.  Press OK
3) Highlight the JAXB 2.1 Library entry in Module Dependencies and press Edit...
4) Select Implementation Version

After doing all this, JAXB seems to work.  However, the IDE issues warnings about incompatibilities during startup.

JAXB is now a standard part of the JDK, and it would be nice if this process of integrating it into a module could made
much cleaner and intuitive.