在我的春天语境中,我定义了marshaller:
<sws:annotation-driven marshaller="marshaller" unmarshaller="marshaller" />
<bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="contextPaths">
<array>
<value>...</value>
<value>...</value>
...
</array>
</property>
</bean>
为什么在收到请求时spring会创建一个新的?
com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:91) ~[?:1.7.0_25]
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:451) ~[?:1.7.0_25]
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:283) ~[?:1.7.0_25]
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:126) ~[?:1.7.0_25]
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1148) ~[?:1.7.0_25]
at com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:130) ~[?:1.7.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[?:1.7.0_25]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.7.0_25]
at java.lang.reflect.Method.invoke(Method.java:606) ~[?:1.7.0_25]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:248) ~[?:1.7.0_25]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:235) ~[?:1.7.0_25]
at javax.xml.bind.ContextFinder.find(ContextFinder.java:445) ~[?:1.7.0_25]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:637) ~[?:1.7.0_25]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:584) ~[?:1.7.0_25]
at org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor.getJaxbContext(AbstractJaxb2PayloadMethodProcessor.java:216) ~[spring-ws-core-2.1.2.RELEASE.jar:?]
at org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor.createMarshaller(AbstractJaxb2PayloadMethodProcessor.java:191) ~[spring-ws-core-2.1.2.RELEASE.jar:?]
at org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor.access$500(AbstractJaxb2PayloadMethodProcessor.java:70) ~[spring-ws-core-2.1.2.RELEASE.jar:?]
at org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor$Jaxb2ResultCallback.<init>(AbstractJaxb2PayloadMethodProcessor.java:312) ~[spring-ws-core-2.1.2.RELEASE.jar:?]
at org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor$Jaxb2ResultCallback.<init>(AbstractJaxb2PayloadMethodProcessor.java:305) ~[spring-ws-core-2.1.2.RELEASE.jar:?]
at org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor.marshalToResponsePayload(AbstractJaxb2PayloadMethodProcessor.java:100) ~[spring-ws-core-2.1.2.RELEASE.jar:?]
at org.springframework.ws.server.endpoint.adapter.method.jaxb.JaxbElementPayloadMethodProcessor.handleReturnValue(JaxbElementPayloadMethodProcessor.java:60) ~[spring-ws-core-2.1.2.RELEASE.jar:?]
at org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter.handleMethodReturnValue(DefaultMethodEndpointAdapter.java:295) ~[spring-ws-core-2.1.2.RELEASE.jar:?]
at org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter.invokeInternal(DefaultMethodEndpointAdapter.java:248) ~[spring-ws-core-2.1.2.RELEASE.jar:?]
at org.springframework.ws.server.endpoint.adapter.AbstractMethodEndpointAdapter.invoke(AbstractMethodEndpointAdapter.java:53) ~[spring-ws-core-2.1.2.RELEASE.jar:?]
at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:233) [spring-ws-core-2.1.2.RELEASE.jar:?]
at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:173) [spring-ws-core-2.1.2.RELEASE.jar:?]
发生此异常是因为他只使用了当前的对象工厂,但并非像我在spring上下文中定义的那样。