Announcement Announcement Module
Collapse
No announcement yet.
Error creating bean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • neotherack
    started a topic Error creating bean

    Error creating bean

    Hi, i need some help... I'm using spring ws 1.5.6 and deploying my war with jBoss 4.2.3GA but an error occurs when i try to access my WSDL

    this is my spring-ws-servlet.xml

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans" 
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    
    	
    	<!-- Definicion de los Endpoint -->
    	<bean id="metodoInformEndpoint" class="com.hp.ws.informEndpoint">
    		<!--property name="inform" ref="inform"/-->
    	</bean>
    	
    	<bean id="metodoGetRPCMethodsEndpoint" class="com.hp.ws.getRPCMethodsEndpoint">
    		<!--property name="inform" ref="inform"/-->
    	</bean>
    
    	<!-- Mapeo de los Endpoint -->
    	<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
    		<property name="mappings">
    			<props> 
    				<prop key="{http://localhost:8080/ACS/}InformRequest">metodoInformEndpoint</prop>
    				<prop key="{http://localhost:8080/ACS/}GetRPCMethodsRequest">metodoGetRPCMethodsEndpoint</prop>
    			</props>
    		</property>
    
    		<property name="interceptors">
    			<list>
    				<bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"/>
    				<bean class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
    					<property name="schema">
    						<list>
    							<value>/WEB-INF/schema.xsd</value>
    						</list>
    					</property>
    					<property name="validateRequest" value="true"/>
    					<property name="validateResponse" value="true"/>
    				</bean>
    			</list>
    		</property>
    	</bean>
    
    	
    	<!-- Definicion de WSDL-->
    	<bean id="ACS" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
    		<property name="schema" value="schemaXML"/>
    		<property name="portTypeName" value="ACS"/>
    		<property name="locationUri" value="http://localhost:8080/ACS/"/>
    
    	</bean>
    	
    	<!-- Esquema -->
    	<bean id="schemaXML" class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
    		<property name="inline" value="true"/>
    		<property name="xsds">
    			<list>
    				<value>/WEB-INF/schema.xsd</value>
    			</list>
    		</property>
    	</bean>
    
    </beans>

    this is the error shown:

    Code:
    javax.servlet.ServletException: Servlet.init() for servlet spring-ws throws
    	org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
    org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)	java.lang.Thread.run(Thread.java:619)
    
    root cause:
    
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping#0' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Cannot create inner bean 'org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor#14879f2' of type [org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor] while setting bean property 'interceptors' with key [1]; nested exception is 
    (more and more output)
    
    
    root cause
    
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor#14879f2' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.util.ArrayList] to required type [org.springframework.core.io.Resource] for property 'schema'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.util.ArrayList] to required type [org.springframework.core.io.Resource] for property 'schema': PropertyEditor (more and more output)
    
    
    root cause
    
    org.springframework.beans.TypeMismatchException: Failed to convert property value of type [java.util.ArrayList] to required type [org.springframework.core.io.Resource] for property 'schema'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.util.ArrayList] to required type [org.springframework.core.io.Resource] for property 'schema': PropertyEditor [org.springframework.core.io.ResourceEditor] returned inappropriate value
    	org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:391)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)
    (more and more output)
    
    
    root cause
    
    java.lang.IllegalArgumentException: Cannot convert value of type [java.util.ArrayList] to required type [org.springframework.core.io.Resource] for property 'schema': PropertyEditor [org.springframework.core.io.ResourceEditor] returned inappropriate value
    	org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)
    	org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:138)
    	org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:386)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1289)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1250)
    	org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1010)
    (more and more output)
    I've googlesearched but i found no responses for this error

    thx

  • sky_xynapse
    replied
    Hi All,

    Sorry for interrupt
    I facing the similar issue too...

    my exception message will be like below:

    Code:
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.ws.server.endpoint.mapping.PayloadRootAnnotationMethodEndpointMapping#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.ws.soap.server.endpoint.interceptor.DelegatingSmartSoapEndpointInterceptor#0': Cannot create inner bean 'org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor#0' of type [org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor#0' defined in URL [file:web/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 'schema' threw exception; nested exception is java.lang.IllegalArgumentException: schema "class path resource [WEB-INF/wsclicks.xsd]" does not exit
    my project structure will be like below:

    Project_Folder
    +src
    ...
    +test
    &nbsp-com
    &nbsp&nbsp+company
    &nbsp&nbsp&nbsp-chum
    &nbsp&nbsp&nbsp&nbsp+ws
    &nbsp&nbsp&nbsp&nbsp&nbsp-endpoints
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp+echoEndpointTest.ja va
    +web
    &nbsp-WEB-INF
    &nbsp&nbsp+spring-ws-servlet.xml
    &nbsp&nbsp+wsclicks.xsd

    my echoEndpointTest.java =
    Code:
    @RunWith(SpringJUnit4ClassRunner.class)
    // your endpoint configuration + Default helper config
    @ContextConfiguration(locations = {"file:web/WEB-INF/spring-ws-servlet.xml"})
    public class EchoEndpointTest {
    
        private static final Log log = LogFactory.getLog(EchoEndpointTest.class);
        @Autowired
        private ApplicationContext applicationContext;
        private MockWebServiceClient mockClient;
    
        @Before
        public void createClient() {
            mockClient = MockWebServiceClient.createClient(applicationContext);
        }
    
        /**
         * Test of handleEchoRequest method, of class EchoEndpoint.
         */
        @Test
        public void testHandleEchoRequest() throws Exception {
            Source requestPayload = new StringSource(...);
            Source responsePayload = new StringSource(...);
            
            mockClient.sendRequest(withPayload(requestPayload)).andExpect(payload(responsePayload));
        }
    }

    Leave a comment:


  • neotherack
    replied
    thanks!!! it works

    last one issue was so stupid.....

    my XSD file name was schema.xml instead schema.xsd



    thanks again

    Leave a comment:


  • dortman
    replied
    It looks like it can't find the XSD file. It also looks like there is a spelling error in the message.

    Code:
    java.lang.IllegalArgumentException: schema "ServletContext resource [/WEB-INF/schema.xsd]" does not exit

    Leave a comment:


  • neotherack
    replied
    thanks!!!!

    this issue is OK, but i got a new error like this:

    Code:
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping#0' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Cannot create inner bean 'org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor#1aedbde' of type [org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor] while setting bean property 'interceptors' with key [1]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor#1aedbde' 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 'schema' threw exception; nested exception is java.lang.IllegalArgumentException: schema "ServletContext resource [/WEB-INF/schema.xsd]" does not exit
    	(more output.....)
    I see that there r some problem with my schema.xml but i think that schema.xml, web.xml and spring-ws-servlet.xml are located at WEB-INF

    now, this is my spring-ws-servlet.xml

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans" 
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    
    	
    	<!-- Definicion de los Endpoint -->
    	<bean id="metodoInformEndpoint" class="com.hp.ws.informEndpoint">
    		<!--property name="inform" ref="inform"/-->
    	</bean>
    	
    	<bean id="metodoGetRPCMethodsEndpoint" class="com.hp.ws.getRPCMethodsEndpoint">
    		<!--property name="inform" ref="inform"/-->
    	</bean>
    
    	<!-- Mapeo de los Endpoint -->
    	<bean class="org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping">
    		<property name="mappings">
    			<props> 
    				<prop key="{http://localhost:8080/ACS/}InformRequest">metodoInformEndpoint</prop>
    				<prop key="{http://localhost:8080/ACS/}GetRPCMethodsRequest">metodoGetRPCMethodsEndpoint</prop>
    			</props>
    		</property>
    
    		<property name="interceptors">
    			<list>
    				<bean class="org.springframework.ws.server.endpoint.interceptor.PayloadLoggingInterceptor"/>
    				<bean class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
    					<property name="schema" value="/WEB-INF/schema.xsd"/>
    					<property name="validateRequest" value="true"/>
    					<property name="validateResponse" value="true"/>
    				</bean>
    			</list>
    		</property>
    	</bean>
    
    	
    	<!-- Definicion de WSDL-->
    	<bean id="ACS" class="org.springframework.ws.wsdl.wsdl11.DefaultWsdl11Definition">
    		<property name="schema" value="schemaXML"/>
    		<property name="portTypeName" value="ACS"/>
    		<property name="locationUri" value="http://localhost:8080/ACS-1/"/>
    
    	</bean>
    	
    	<!-- Esquema -->
    	<bean id="schemaXML" class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
    		<property name="inline" value="true"/>
    		<property name="xsds">
    			<list>
    				<value>/WEB-INF/schema.xsd</value>
    			</list>
    		</property>
    	</bean>
    
    </beans>

    and this is my web.xml

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    
    <web-app 
    		xmlns="http://java.sun.com/xml/ns/j2ee" 
    		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
            version="2.4">
    
        <display-name>Servicio Web del Servidor ACS</display-name>
    
        <servlet>
            <servlet-name>spring-ws</servlet-name>
            <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class>
        </servlet>
    
        <servlet-mapping>
            <servlet-name>spring-ws</servlet-name>
            <url-pattern>/*</url-pattern>
        </servlet-mapping>
    
    </web-app>
    thanks again

    Leave a comment:


  • dortman
    replied
    It looks like you defined your interceptor such that you are trying to set a List into a setter expecting a single value.

    Code:
    				<bean class="org.springframework.ws.soap.server.endpoint.interceptor.PayloadValidatingInterceptor">
    					<property name="schema">
    						<list>
    							<value>/WEB-INF/schema.xsd</value>
    						</list>
    					</property>
    					<property name="validateRequest" value="true"/>
    					<property name="validateResponse" value="true"/>
    				</bean>
    The PayloadValidatingInterceptor has two properties; 'schema' and 'schemas'. The first takes a Resource, the second takes an array of Resource.

    I would guess that if you change the property name to 'schemas', or remove the list tags, the error should go away.

    Leave a comment:

Working...
X