I use Spring OXM as well as Struts 1 but without integrating Struts with Spring IOC. This is because the application is an old one and I'm just adding a module that involves the XML binding and I have no intention to change the architecture of the application.
I have an action class that calls ClasspathXmlApplicationContext for bean injection for the OXM.
Here is my spring context XML:
The action class:Code:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oxm="http://www.springframework.org/schema/oxm" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-1.5.xsd"> <bean id="xmlMapper" class="com.st.mas.wmr.utils.xml.stifbinconv.XmlMapper"> <property name="marshaller" ref="jaxbMarshaller" /> <property name="unmarshaller" ref="jaxbMarshaller" /> </bean> <bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> <property name="contextPath" value="com.st.mas.wmr.utils.xml.jaxb.stifbinconv"/> <property name="validating" value="true"/> </bean> </beans>
The service class:Code:public class StifBinConversionAction extends AnyDispatchAction { private IProcessStifOliBinConversion svc; public StifBinConversionAction() { super(); svc = new ProcessStifOliBinConversion(); }
The web application gives HTTP 500 WITHOUT any error message or stack trace.Code:public class ProcessStifOliBinConversion implements IProcessStifOliBinConversion { private BasicDataSource ds; private IAtomStifOliBinConversion dao; private ApplicationContext ctx; private XmlMapper xmlMapper; public ProcessStifOliBinConversion() { super(); ds = new BasicDataSource(); //TODO consts ds.setDriverClassName("oracle.jdbc.driver.OracleDriver"); ds.setUrl("jdbc:oracle:thin:@sglx482:1521:wmr"); ds.setUsername("wmr_online"); ds.setPassword("wmr_online"); dao = new AtomStifOliBinConversion(ds); ctx = new ClassPathXmlApplicationContext("oxm-context.xml", XmlMapper.class); xmlMapper = ctx.getBean(XmlMapper.class); }
Seems that the problem is within the Spring injection.
It's irritating when there's an error but there's no error message. It makes you stuck for days.
Thanks
Will


Reply With Quote
