Announcement Announcement Module
Collapse
No announcement yet.
unable to resolve properties when using classpath:*.xml in contextConfigLocation Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • unable to resolve properties when using classpath:*.xml in contextConfigLocation

    When defining the MessageDispatcherServlet in my web.xml I'd like spring to automatically pickup the xml files from my application instead of needing to hand include each xml. So I am trying to use the Resource call classpath:*.xml in the contextConfigLocation init-param but when I do the error below occurs.

    org.springframework.beans.factory.BeanDefinitionSt oreException: Error registering bean with name 'validatingInterceptor' defined in file [D:\cithaeron\stuff\tomcat\apache-tomcat-6.0.14\webapps\ROOT\WEB-INF\classes\soapapi.xml]: Could not resolve placeholder 'soapapi.validateRequest'

    Here is my web.xml
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/javaee"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    		  http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
               version="2.5">
    
        <display-name>Cithaeron Soap API</display-name>
    
        <servlet>
            <servlet-name>spring-ws</servlet-name>
            <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
            <init-param>
                <param-name>contextConfigLocation</param-name>
                <!-- <param-value>/WEB-INF/classes/demo.xml,/WEB-INF/classes/spring-ws-servlet.xml,/WEB-INF/classes/soapapi.xml,/WEB-INF/classes/orderbookmanager.xml,/WEB-INF/classes/matching.xml,/WEB-INF/classes/clearing.xml,/WEB-INF/classes/reference.xml</param-value> -->
                 <param-value>classpath:*.xml</param-value> 
            </init-param>
            <init-param>
                <param-name>transformWsdlLocations</param-name>
                <param-value>true</param-value>
            </init-param>
        </servlet>
    
        <servlet-mapping>
            <servlet-name>spring-ws</servlet-name>
            <url-pattern>/*</url-pattern>
        </servlet-mapping>
        
    </web-app>
    And here are the failing bean definitions from the soapapi.xml
    Code:
        <bean id="propertiesAbstract" abstract="true" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            <property name="locations">
                <list merge="true">
                    <value>classpath:com/cithaeron/soapapi/report/report.properties</value>
                    <value>classpath:com/cithaeron/soapapi/soapapi.properties</value>
                </list>
            </property>
        </bean>
    
        <bean id="validatingInterceptor"
              class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
            <description>
                This interceptor validates both incoming and outgoing message contents according to the 'cithaeron.xsd' XML
                Schema file.
            </description>
            <property name="schema" value="classpath:com/cithaeron/soapapi/cithaeron.xsd"/>
            <property name="validateRequest" value="${soapapi.validateRequest}"/>
            <property name="validateResponse" value="${soapapi.validateResponse}"/>
        </bean>
    where the abstract property placeholder is made concrete inthe spring-ws-servlete.xml
    Code:
        <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" parent="propertiesAbstract">
            <property name="locations">
                <list merge="true">
                    <value>classpath:deployment.properties</value>
                </list>
            </property>
    It all works if I list the xml files, anyone have any ideas why spring would not be able to find the properties files when using "classpath:*.xml"

  • #2
    Wildcards with classpath

    Section 4.7.2.3. "Other notes relating to wildcards" of the Spring Framework Reference Documentation explains why.

    Comment

    Working...
    X