Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 312506

Summary: JAXB schema gen with package-info.java fails
Product: [WebTools] Dali JPA Tools Reporter: Karen Butzke <karenfbutzke>
Component: JAXBAssignee: Tran Le <tranle1>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: neil.hauge
Version: 2.3Flags: neil.hauge: review+
Target Milestone: 2.3.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
proposed patch none

Description Karen Butzke CLA 2010-05-11 16:31:52 EDT
Start with a schema that has a namespace - the orm.xsd for example and a project that does not have EclipseLink on its classpath.  Generate JAXB classes from the schema.  Notice that a class package-info.java is created. Now choose New->JAXB->Schema from JAXB Classes and select that generated package including the package-info.java file. You get the below exception.  Using EclipseLink MOXy does not result in this exception.  Uncheck the package-info.java file and both the JDK and EclipseLink MOXy implementations appear to find the package-info.java and use it in the generation.


com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
jdk.package-info is an interface, and JAXB can't handle interfaces.
	this problem is related to the following location:
		at jdk.package-info
jdk.package-info does not have a no-arg default constructor.
	this problem is related to the following location:
		at jdk.package-info

	at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:472)
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:302)
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1140)
	at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:154)
	at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:121)
	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 javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:202)
	at javax.xml.bind.ContextFinder.find(ContextFinder.java:363)
	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
Comment 1 Neil Hauge CLA 2010-06-03 17:25:28 EDT
It appears we need to filter these files out of selection list if possible, and if not ignore them when configuring generation.
Comment 2 Tran Le CLA 2010-06-24 14:50:07 EDT
Created attachment 172664 [details]
proposed patch
Comment 3 Neil Hauge CLA 2010-06-28 16:31:28 EDT
Patch committed to 2.3.1 and head.
Comment 4 Karen Butzke CLA 2010-07-20 09:37:32 EDT
verified fixed in build wtp-sdk-M-3.2.1-20100717062943