Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Nullpointer exception in JAXB2 marshaller [SWS-621] #733
I am using Jaxb2 marshaller in groovy. It fails with NPE in marshelsendandreceive if no setClassesToBeBound or setContextPath is called. According to official springws documentation both settings are optional and it should not fail with NPE or at least it should provide some text message what is wrong.
def marshaller = new org.springframework.oxm.jaxb.Jaxb2Marshaller()
def ipinfo = new com.foois.ws.whois.Ipinforequest()
Arjen Poutsma commented
The Jaxb2Marshaller does show throw a IllegalArgumentException when afterPropertiesSet() is called (which happens by default when the marshaller is wired up in a Spring context).
In other words, make sure you call afterProperiesSet() when instantiating a marshaller in code. Not just because of this message, but also because it does other initialization.
Radim Kolar commented
You are right, calling afterProperiesSet() throws IllegalArgumentException. but it should be mentioned in http://static.springsource.org/spring-ws/sites/1.5/reference/html/oxm.html section 8.5.2. Jaxb2Marshaller more clearly what configuration is required.