您好我有以下异常:
ERROR 13 May 2013 15:20:17,471 http-9090-1 org.springframework.web.servlet.DispatcherServlet - Context initialization failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.ws.soap.server.endpoint.interceptor.DelegatingSmartSoapEndpointInterceptor#0': Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.ws.server.EndpointInterceptor]: Could not convert constructor argument value of type [com.syngenta.panda.web.mvc.interceptor.ExternalLinkInterceptor] to required type [org.springframework.ws.server.EndpointInterceptor]: Failed to convert value of type 'com.syngenta.panda.web.mvc.interceptor.ExternalLinkInterceptor' to required type 'org.springframework.ws.server.EndpointInterceptor'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [com.syngenta.panda.web.mvc.interceptor.ExternalLinkInterceptor] to required type [org.springframework.ws.server.EndpointInterceptor]: no matching editors or conversion strategy found
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:702)
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:196)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1003)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:907)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
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:442)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:806)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:722)
这只在我添加拦截器时发生了:
@Component
public class ExternalLinkInterceptor extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
//code
}
编辑 更新: 的applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<import resource="properties-beans.xml"/>
<context:component-scan base-package="com.syngenta.panda.security"/>
<import resource="security-beans.xml"/>
<context:component-scan base-package="com.syngenta.panda.shared.service"/>
<import resource="classpath:/com/syngenta/panda/shared/service/config/shared-service-beans.xml"/>
<context:component-scan base-package="com.syngenta.panda.discovery.service"/>
<import resource="classpath:/com/syngenta/panda/discovery/service/config/discovery-service-beans.xml"/>
<context:component-scan base-package="com.syngenta.panda.analysis.service"/>
<import resource="classpath:/com/syngenta/panda/analysis/service/config/analysis-service-beans.xml"/>
<context:component-scan base-package="com.syngenta.panda.assay.service"/>
<import resource="classpath:/com/syngenta/panda/assay/service/config/assay-service-beans.xml"/>
<import resource="classpath:/com/syngenta/panda/dao/config/dao-beans.xml"/>
<import resource="classpath:/com/syngenta/panda/integration/refdata/config/xrd-integration-beans.xml"/>
<import resource="classpath:/com/syngenta/panda/integration/smartchoice/config/smartchoice-integration-beans.xml"/>
<import resource="classpath:/com/syngenta/panda/integration/vast/config/vast-integration-beans.xml"/>
<import resource="classpath:/com/syngenta/panda/integration/bfx/config/bfx-integration-beans.xml"/>
<import resource="classpath:/com/syngenta/panda/integration/magenta/config/magenta-integration-beans.xml"/>
</beans>
servlet-context.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/mvc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/web-services"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services.xsd"
xmlns:security="http://www.springframework.org/schema/security"
xmlns:tx="http://www.springframework.org/schema/tx">
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!-- Enables the Spring MVC @Controller programming model -->
<annotation-driven/>
<tx:annotation-driven proxy-target-class="true"/>
<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
<!--beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<beans:property name="prefix" value="/WEB-INF/views/" />
<beans:property name="suffix" value=".jsp" />
</beans:bean-->
<!-- Imports user-defined @Controller beans that process client requests -->
<beans:import resource="controllers.xml"/>
<beans:import resource="freemarker.xml"/>
<security:global-method-security pre-post-annotations="enabled"/>
<mvc:interceptors>
<beans:bean class="com.syngenta.panda.web.mvc.interceptor.ExternalLinkInterceptor"/>
</mvc:interceptors>
</beans:beans>
我不明白这个例外意味着什么,我需要帮助。
答案 0 :(得分:2)
由于某些其他原因,您可能会拥有此xmlns:mvc="http://www.springframework.org/schema/web-services"
。您需要将其更改为:
xmlns:mvc="http://www.springframework.org/schema/mvc"
with schemaLocation(对于上面的内容)
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"
使用Web服务命名空间,您使用的是Spring WS <interceptors>
标记,该标记期望org.springframework.ws.server.EndpointInterceptor
个实例而不是org.springframework.web.servlet.HandlerInterceptor
。