Once in a while we have those small issues which still can take some hours of our day. For example last week I was configuring a Spring JAXB2Marshaller using the context below: <bean id="jaxb2Marshaller"> <property name="contextPaths"> <list value-type="java.lang.String"> <value>nl.jdriven.myproject.package.with.a.very.long.name </value> <value>nl.jdriven.myproject</value> </list> </property> </bean> However when running my JUnit test using this context the following exception occurred:

java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jaxb2Marshaller' defined in class path resource \[test-savings-online-direct-export.xml\]: Invocation of init method failed; nested exception is org.springframework.oxm.UncategorizedMappingException: Unknown JAXB exception; nested exception is javax.xml.bind.JAXBException: " nl.jdriven.myproject.package.with.a.very.long.name
                                                  " doesnt contain ObjectFactory.class or jaxb.index

It look liked something was wrong with my generated JAXB project. Unfortunately I needed some hours to notice that maybe the break line in the value element of the _contextPaths_list could cause the issue After changing the spring-context.xml as below, moving the tag inline, the JAXB2Marshaller worked perfectly. <bean id="jaxb2Marshaller"> <property name="contextPaths"> <list value-type="java.lang.String"> <value>nl.jdriven.myproject.package.with.a.very.long.name</value> <value>nl.jdriven.myproject</value> </list> </property> </bean> Apparently the spring-context is sensitive to break lines when we configure the Jaxb2Marshaller context paths. Due to my habit of using the Eclipse format shortcut Ctrl + Shift + F the formatter kept moving the end tag of the context path to a newline. We can prevent this issue by changing the settings of your Eclipse XML editor settings. In your Eclipse click Window -> Preferences -> XML -> Editor and set the line width to e.g. 140.

shadow-left