I'm using jaxb2,This is my spring context file
I wrote a standalone java class,main method with code as shown belowCode:<ctx:annotation-config/> <ctx:component-scan base-package="my package name"/> <bean id="template" class="org.springframework.ws.client.core.WebServiceTemplate"> <property name="marshaller" ref="marshaller"/> <property name="unmarshaller" ref="marshaller"/> </bean> <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> <property name="contextPath"> <value>my package name</value> </property> <property name="marshallerProperties"> <map> <entry key="com.sun.xml.bind.xmlDeclaration"> <value type="boolean">false</value> </entry> <entry key="com.sun.xml.bind.namespacePrefixMapper" value-ref="namespacePrefixMapper"/> </map> </property> </bean> <bean id="namespacePrefixMapper" class="prefix mapper package name"/>
Code:ClassPathXmlApplicationContext context=new ClassPathXmlApplicationContext("spring-ws.xml"); WebServiceTemplate template=(WebServiceTemplate)context.getBean("template"); FCUBSREQENV fcubsreqenv=new FCUBSREQENV(); String url="Endpoint"; FCUBSRESENV fcubsresenv = (FCUBSRESENV) template.marshalSendAndReceive(url,fcubsreqenv);
My context path property has a package name where all my jaxb generated classes using xjc compiler are present. Spring context got created successfully.but when I try to run the standalone program I end up with "org.springframework.oxm.jaxb.JaxbSystemException: class FCUBSRESENV nor any of its super class is known to this context" Request you to let me know, Incase if I'm missing something.


Reply With Quote