Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » DynamicJAXBContext creation fails with NPE
DynamicJAXBContext creation fails with NPE [message #635483] Tue, 26 October 2010 23:22 Go to next message
No real name is currently offline No real name
Messages: 1
Registered: October 2010
Junior Member
Hi,

It seems like I'm missing something obvious, but I've been unable to create an instance of DynamicJAXBContext using EclipseLink 2.1.1, jxc 2.2.1, and these schema files:
http://metadata.dod.mil/mdr/ns/DDMS/2.0/DDMS-v2.0.zip

The calling code:
File schema = new File("src/main/resources/DDMS_2.0/ns/DDMS/2.0/DDMS-v2_0.xsd");
StreamSource ss = new StreamSource(schema);
DynamicJAXBContext c = DynamicJAXBContextFactory.createContextFromXSD(ss, null, null, null);


The stack trace:
Exception in thread "main" java.lang.NullPointerException
	at org.eclipse.persistence.jaxb.javamodel.xjc.XJCJavaClassImpl.isEnum(XJCJavaClassImpl.java:398)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.preBuildTypeInfo(AnnotationsProcessor.java:401)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.buildNewTypeInfo(AnnotationsProcessor.java:3350)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.processXmlJavaTypeAdapter(AnnotationsProcessor.java:1199)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.processPropertyAnnotations(AnnotationsProcessor.java:1668)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.buildNewProperty(AnnotationsProcessor.java:1381)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.getFieldPropertiesForClass(AnnotationsProcessor.java:1309)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.getPropertiesForClass(AnnotationsProcessor.java:1286)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.buildTypeInfo(AnnotationsProcessor.java:523)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.postBuildTypeInfo(AnnotationsProcessor.java:470)
	at org.eclipse.persistence.jaxb.compiler.AnnotationsProcessor.processClassesAndProperties(AnnotationsProcessor.java:176)
	at org.eclipse.persistence.jaxb.compiler.Generator.<init>(Generator.java:100)
	at org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext.initializeFromXJC(DynamicJAXBContext.java:326)
	at org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext.initializeFromXSDInputSource(DynamicJAXBContext.java:276)
	at org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory.createContextFromXSD(DynamicJAXBContextFactory.java:208)
	at foo.FooTest.main(FooTest.java:16)


And the pom.xml
<repositories>
	<repository>
		<id>EclipseLink Repo</id>
		<url>http://www.eclipse.org/downloads/download.php?r=1&amp;nf=1&amp;file=/rt/eclipselink/maven.repo</url>
		<snapshots>
			<enabled>true</enabled>
		</snapshots>
	</repository>
</repositories>
<dependencies>
	<dependency>
		<groupId>com.sun.xml.bind</groupId>
		<artifactId>jaxb-xjc</artifactId>
		<version>2.2.1</version>
	</dependency>
	<dependency>
		<groupId>org.eclipse.persistence</groupId>
		<artifactId>eclipselink</artifactId>
		<version>2.1.1</version>
	</dependency>
</dependencies>

I already set up java.endorsed.dirs to point to the jaxb 2.2.1 api and I've tried various versions of EclipseLink. Nothing seems to work. And the source for XJCJavaClassImpl does not seem to be in maven.
Re: DynamicJAXBContext creation fails with NPE [message #635723 is a reply to message #635483] Wed, 27 October 2010 16:31 Go to previous messageGo to next message
Rick Barkhouse is currently offline Rick Barkhouse
Messages: 22
Registered: July 2009
Junior Member
Hello there,

I have looked at this issue, and it is indeed a bug in DynamicJAXB. I have entered a new bug report for this:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=328888

We should be able to get this fixed soon in an upcoming nightly build of EclipseLink 2.2.

- Rick
Re: DynamicJAXBContext creation fails with NPE [message #636762 is a reply to message #635483] Tue, 02 November 2010 13:03 Go to previous message
Rick Barkhouse is currently offline Rick Barkhouse
Messages: 22
Registered: July 2009
Junior Member
Hello,

This bug has been fixed, please try out the latest EclipseLink 2.2 nightly build (20101102) and let us know if you have any more issues.

http://www.eclipse.org/eclipselink/downloads/nightly.php

Thanks for using EclipseLink Dynamic JAXB!

- Rick
Previous Topic:Validation errors for Eclipselink 2.1.1 project.xml
Next Topic:Weaving and OSGi
Goto Forum:
  


Current Time: Wed Aug 20 12:49:30 EDT 2014

Powered by FUDForum. Page generated in 0.01513 seconds