Announcement Announcement Module
Collapse
No announcement yet.
two spring-ws applications on one tomcat wsdl problem Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • two spring-ws applications on one tomcat wsdl problem

    Hi,

    I ran into a strange behaviour I cannot see where it is coming from. I have two spring-ws applications, both running on tomcat6. Both have different wsdl files, one is created by spring-ws using xsd, the other one is a wsdl document shown by spring-ws.

    When I deploy both of them, it depends on which wsdl I call first, the other one will not be shown on call in the browser but instead a 500 error.

    I use spring-ws 1.5.9

    these are my spring-ws-servlet.xml:

    Code:
    	<bean id="AMMClient"
    		class="org.springframework.ws.wsdl.wsdl11.SimpleWsdl11Definition">
    		<constructor-arg value="classpath:AMMClient.wsdl" />
    	</bean>

    and the second one throwing the exception in this case:

    Code:
    	 <bean id="MeteringPointDataService" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">  
    	    <property name="schema" ref="schema"/>                                           
    	    <property name="portTypeName" value="MeteringPointData"/>                      
    	    <property name="locationUri" value="/services/MeteringPointData"/>                         
    	    <property name="targetNamespace" value="http://www.example.com/mpds/20100806"/>     
    	</bean>
    	<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    	  <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
    	  <property name="prefix" value="/"/>
    	  <property name="suffix" value=".jsp"/>
    	</bean>
    
    
    	<bean id="schema" class="org.springframework.xml.xsd.SimpleXsdSchema">              
    	    <property name="xsd" value="classpath:MeteringPointDataService.xsd"/>
    	</bean>

    I use jaxb2 and saajSoapMessageFactory in both apps, both configured in the main config up and running.


    Here is the output in the browser:

    Code:
    javax.servlet.ServletException: Servlet.init() for servlet spring-ws threw exception
    	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
    	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    	java.lang.Thread.run(Thread.java:619)
    
    root cause
    
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MeteringPointDataService' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Invocation of init method failed; nested exception is java.lang.ClassCastException: org.apache.xerces.parsers.XML11Configuration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    	org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    	org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    	org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    	org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
    	org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
    	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442)
    	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458)
    	org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339)
    	org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306)
    	org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
    	javax.servlet.GenericServlet.init(GenericServlet.java:212)
    	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
    	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    	java.lang.Thread.run(Thread.java:619)
    
    root cause
    
    java.lang.ClassCastException: org.apache.xerces.parsers.XML11Configuration cannot be cast to org.apache.xerces.xni.parser.XMLParserConfiguration
    	org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
    	org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
    	org.apache.xerces.jaxp.DocumentBuilderImpl.<init>(Unknown Source)
    	org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(Unknown Source)
    	com.sun.org.apache.xalan.internal.xsltc.trax.SAX2DOM.createDocument(SAX2DOM.java:324)
    	com.sun.org.apache.xalan.internal.xsltc.trax.SAX2DOM.<init>(SAX2DOM.java:84)
    	com.sun.org.apache.xalan.internal.xsltc.runtime.output.TransletOutputHandlerFactory.getSerializationHandler(TransletOutputHandlerFactory.java:187)
    	com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.getOutputHandler(TransformerImpl.java:392)
    	com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:298)
    	org.springframework.xml.transform.TransformerObjectSupport.transform(TransformerObjectSupport.java:112)
    	org.springframework.ws.wsdl.wsdl11.provider.InliningXsdSchemaTypesProvider.getSchemaElement(InliningXsdSchemaTypesProvider.java:113)
    	org.springframework.ws.wsdl.wsdl11.provider.InliningXsdSchemaTypesProvider.addTypes(InliningXsdSchemaTypesProvider.java:101)
    	org.springframework.ws.wsdl.wsdl11.ProviderBasedWsdl4jDefinition.afterPropertiesSet(ProviderBasedWsdl4jDefinition.java:233)
    	org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition.afterPropertiesSet(DefaultWsdl11Definition.java:170)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    	org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    	org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    	org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    	org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    	org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
    	org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
    	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442)
    	org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458)
    	org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339)
    	org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306)
    	org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
    	javax.servlet.GenericServlet.init(GenericServlet.java:212)
    	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
    	org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
    	org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
    	org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
    	java.lang.Thread.run(Thread.java:619)

    Has anybody an idea why this happens?

  • #2
    Hi,
    try to remove Xerces.jar from project,
    looks like there is an problem with Xerces and Tomcat.
    Rgs.

    Comment


    • #3
      Resolved

      Thanks for the advice!

      Originally posted by NenadJaksic View Post
      Hi,
      try to remove Xerces.jar from project,
      looks like there is an problem with Xerces and Tomcat.
      Rgs.
      I added an exclusion to maven pom.xml and it worked. Here's the snipped:

      Code:
      		<!-- 
      			Apache Commons DBCP for connection pooling
      		 -->
      		<dependency>
      			<groupId>commons-dbcp</groupId>
      			<artifactId>commons-dbcp</artifactId>
      			<version>1.2.2</version>
      			<exclusions>
                      <exclusion>
                          <groupId>xml-apis</groupId>
                          <artifactId>xml-apis</artifactId>
                      </exclusion>
                      <exclusion>
                          <groupId>xerces</groupId>
                          <artifactId>xerces</artifactId>
                      </exclusion>
              	</exclusions>	
      		</dependency>

      Comment

      Working...
      X