Issue
I have a java 8 spring 5 project / spring ws 3. It is running in tomcat 8. It has been mirgrated from older versions of spring and uses xml configuration of the webservices. When I start the application I am getting the following error
ERROR: [May-04 15:03:25,263] web.context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping#0': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping]: Constructor threw exception; nested exception is java.lang.ExceptionInInitializerError
This bean is getting created by Spring and is not specially called by my application. I checked the code here
and looked at all the constructors getting called but still can't figure out what could be going wrong. Anyone ever see this? Or have any idea what I could look at to track down the error?
Thanks
Edit: Should have added the final exception
Caused by: java.lang.ExceptionInInitializerError at org.springframework.xml.xpath.XPathExpressionFactory.createXPathExpression(XPathExpressionFactory.java:73) at org.springframework.ws.soap.addressing.version.AbstractAddressingVersion.createNormalizedExpression(AbstractAddressingVersion.java:116) at org.springframework.ws.soap.addressing.version.AbstractAddressingVersion.(AbstractAddressingVersion.java:88) at org.springframework.ws.soap.addressing.version.Addressing200408.(Addressing200408.java:36) at org.springframework.ws.soap.addressing.server.AbstractAddressingEndpointMapping.initDefaultStrategies(AbstractAddressingEndpointMapping.java:107) at org.springframework.ws.soap.addressing.server.AbstractAddressingEndpointMapping.(AbstractAddressingEndpointMapping.java:98) at org.springframework.ws.soap.addressing.server.AbstractActionEndpointMapping.(AbstractActionEndpointMapping.java:38) at org.springframework.ws.soap.addressing.server.AbstractActionMethodEndpointMapping.(AbstractActionMethodEndpointMapping.java:34) at org.springframework.ws.soap.addressing.server.AnnotationActionEndpointMapping.(AnnotationActionEndpointMapping.java:60) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
Edit 2: The last line of code that runs is org.springframework.xml.xpath.XPathExpressionFactory.java:36
This calls
org.springframework.xml.xpath.Jaxp13XPathExpressionFactory.createXPathExpression()
with the following data
expression = normalize-space(wsa:To)
namespaces = ["wsa" -> "http://schemas.xmlsoap.org/ws/2004/08/addressing"]
I have a break point in Jaxp13XPathExpressionFactory.createXPathExpression()
but it never gets hit. Puzzled why this is, it says it can't find the class but the class is in the same package as the class calling it.
Edit 3. It actually does find the class, breakpoints in intellij weren't working so well. The error seems to be caused by
jar:file:.../saxon9he-9.2.1.5.jar!/META-INF/services/javax.xml.xpath.XPathFactory:2: Illegal configuration-file syntax
Solution
Simple answer in the end. Was an old maven dependency causing the issue. I upgraded saxon9he v9.2.1.5 to Saxon-HE v9.8.0-11 and the error no longer occurs and my app starts without issue.
Answered By - user260495