Win a copy of Rust Web Development this week in the Other Languages forum!

Eric James

Greenhorn
+ Follow
since Jun 28, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Eric James

Hello,
I am trying to marshall one of several classes created created by the xjc compiler from .xsd. Not sure why the object can't be marshalled???

<%
ObjectFactory objFactory = new ObjectFactory();
SoftwareType st = objFactory.createSoftwareType();
st.setName("java");
st.setVersion("1.4");
st.setComments("comments here");

JAXBContext jaxbcontext = JAXBContext.newInstance("sourceforge.psi.mzdata");
Marshaller marshaller = jaxbcontext.createMarshaller();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, new Boolean(true));
marshaller.marshal(st,System.out);
%>


Here is the stack trace:
javax.xml.bind.MarshalException: the object parameter to marshal() is not marshallable
com.sun.xml.bind.marshaller.MarshallerImpl.marshal(MarshallerImpl.java:74)
javax.xml.bind.helpers.AbstractMarshallerImpl.marshal(AbstractMarshallerImpl.java:66)
org.apache.jsp.displayXML_jsp._jspService(displayXML_jsp.java:78)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:105)
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:336)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:297)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:247)
javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:249)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:282)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:165)

Here is the java src soc generated:
@XmlAccessorType(AccessType.FIELD)
@XmlType(name = "softwareType", propOrder = {
"name",
"version",
"comments"
})
public class SoftwareType {

protected String name;
protected String version;
protected String comments;
@XmlAttribute
protected XMLGregorianCalendar completionTime;

public String getName() {
return name;
}
public void setName(String value) {
this.name = value;
}
public String getVersion() {
return version;
}
public void setVersion(String value) {
this.version = value;
}
public String getComments() {
return comments;
}
public void setComments(String value) {
this.comments = value;
}
public XMLGregorianCalendar getCompletionTime() {
return completionTime;
}
public void setCompletionTime(XMLGregorianCalendar value) {
this.completionTime = value;
}

}


Thanks,Eric
15 years ago