Aug 7th, 2008, 04:36 AM
JAXB and Spring integration error
I am using Spring 2.5.5 and Spring-WS 1.5.4.
I am trying to use the JAXB functionnality to unmarshall XML and to marshall objects.
My application-context.xml file is as follow :
<bean id="xmlMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshalle r">
<property name="contextPath" value="com.alu.mpv3.enricher.domain.jaxbgen" />
<property name="schema" value="classpath:xsd/request.xsd" />
and when I initialize the Spring context I have the following error :
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'xmlMarshaller' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.io.Resource.getURI()Ljava/net/URI;
If I remove the line relative to the property "schema" the error disappears.
I tried to replace the value="classpath..." with a reference to another bean
such as :
<bean id="xsd" class="org.springframework.core.io.ClassPathResour ce">
<constructor-arg value="xsd/request.xsd" />
but the error still remains.
I really don't know why and I can't find a solution. Does anyone can help me please ?
Aug 11th, 2008, 08:44 PM
You do not have to set the schema for jaxb2Marshaller unless you want to validate the schema. Well if you want to set schema make sure the file can be loaded as a Resource.