Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-647

PayloadValidatingInterceptor throws IllegalArgumentException when passed a schema collection

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5.9
    • Fix Version/s: 2.0.4
    • Component/s: None
    • Labels:
      None

      Description

      When I configure the PayloadValidatingInterceptor to refer to a CommonsXsdSchemaCollection, I get the following error when my web service is invoked:

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'validatingInterceptor' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
      PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'xsdSchemaCollection' threw exception; nested exception is java.lang.IllegalArgumentException: Path must not be null
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1341)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1067)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
      	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
      	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
      	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
      	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:557)
      	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
      	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
      	at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:402)
      	at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:316)
      	at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:282)
      	at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126)
      	at javax.servlet.GenericServlet.init(GenericServlet.java:241)
      	at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:283)
      	at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      	at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
      	at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:64)
      	at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
      	at weblogic.servlet.internal.StubLifecycleHelper.(StubLifecycleHelper.java:48)
      	at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:539)
      	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:243)
      	at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183)
      	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.doIt(WebAppServletContext.java:3686)
      	at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3650)
      	at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      	at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
      	at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2268)
      	at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2174)
      	at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1446)
      	at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
      	at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
      Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
      PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'xsdSchemaCollection' threw exception; nested exception is java.lang.IllegalArgumentException: Path must not be null
      	at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:102)
      	at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)
      	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1338)
      	... 33 more

      -------------------------

      Here's my spring bean config:

          <bean id="validatingInterceptor" class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
              <property name="xsdSchemaCollection" ref="schemaCollection" />
              <property name="validateRequest" value="true" />
              <property name="validateResponse" value="true" />
          </bean>
       
          <bean id="schemaCollection" class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
              <property name="xsds">
                  <list>
                      <value>classpath:schemas/CommonTypes.xsd</value>
                      <value>classpath:schemas/TakeService.xsd</value>
                  </list>
              </property>
              <property name="inline" value="true" />
          </bean>

      ------------------------

      The workaround is to explicit set the "schemas" property, thus duplicating the XSD paths in the config (which is not ideal):

          <bean id="validatingInterceptor" class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
              <property name="schemas">
                  <list>
                      <value>classpath:schemas/CommonTypes.xsd</value>
                      <value>classpath:schemas/TakeService.xsd</value>
                  </list>
              </property>
              <property name="validateRequest" value="true" />
              <property name="validateResponse" value="true" />
          </bean>

        Activity

        arjen.poutsma Arjen Poutsma logged work - 25/Jan/12 1:36 AM
        • Time Spent:
          0.2h
           
          <No comment>

          People

          • Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            sah5 Scott Haynie
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - Not Specified
              Not Specified
              Logged:
              Time Spent - 0.2h
              0.2h