Has anyone got EclipseLink MOXy (I'm using eclipselink 2.1.0) to work with Java 5? Whenever I try to unmarshal I get a null pointer exception in org.eclipse.persistence.oxm.record.UnmarshalRecord, in the startCDATA() method (xPathNode is null). The exact same code and XML works wonderfully in Java6.
+1
A:
I'm the tech lead for MOXy. Can you provide the stack trace & more details on your use case?
For more information on MOXy check out:
Re your update:
I haven't been able to reproduce this on my end. I am using the following env. Do you have a test case you can send ([email protected]) or point out what I'm doing differently?:
- JDK: 1.5.0_22
- EclipseLink 2.1.0
The following model:
package cdata;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class Customer {
private String firstName;
private String lastName;
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}
Demo code:
package cdata;
import java.io.File;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
public class Demo {
public static void main(String[] args) throws Exception {
JAXBContext jc = JAXBContext.newInstance(Customer.class);
Unmarshaller unmarshaller = jc.createUnmarshaller();
Customer customer = (Customer) unmarshaller.unmarshal(new File("src/cdata/input.xml"));
Marshaller marshaller = jc.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.marshal(customer, System.out);
}
}
And XML:
<?xml version="1.0" encoding="UTF-8"?>
<customer>
<firstName>Jane</firstName>
<middleName><![CDATA[<?xml version="1.0"?>]]></middleName>
<lastName>Doe</lastName>
</customer>
Blaise Doughan
2010-10-05 15:50:42
Thanks for checking this out so quickly! I actually got it figured out. I was adding EclipseLink via Maven and didn't have the required dependencies that are included in the version available for download added to my project (or not all of them at least). Once I had that fixed everything worked like a charm!
Frothy
2010-10-05 20:07:26
Looks like I jumped the gun in calling this fixed... I've added details to the original post.
Frothy
2010-10-07 13:38:11
I haven't been able to reproduce this yet. I've updated my answer with what I have tried. Can you provide any details on what I might be doing different than you?
Blaise Doughan
2010-10-07 15:43:43
I'll test this and get right back to you.
Frothy
2010-10-07 16:26:20