部署应用程序时,Spring上下文初始化IllegalArgumentException

时间:2018-07-31 11:41:01

标签: java spring tomcat

我正在尝试在Tomcat上进行战争,但出现以下错误:

    14:32:44,484 ERROR [http-nio-8080-exec-3] ContextLoader:205 - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.sun.xml.ws.transport.http.servlet.SpringBinding' defined in ServletContext resource [/WEB-INF/classes/config/spring/appContext-common.xml]: Cannot create inner bean '(inner bean)' while setting bean property 'service'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#1' defined in ServletContext resource [/WEB-INF/classes/config/spring/appContext-common.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Unknown type {http://www.springframework.org/schema/beans}/WEB-INF/wsdl/Personnel.wsdl
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#1' defined in ServletContext resource [/WEB-INF/classes/config/spring/appContext-common.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Unknown type {http://www.springframework.org/schema/beans}/WEB-INF/wsdl/Personnel.wsdl
Caused by: java.lang.IllegalArgumentException: Unknown type {http://www.springframework.org/schema/beans}/WEB-INF/wsdl/Personnel.wsdl
        at org.jvnet.jax_ws_commons.spring.SpringService.resolveSDDocumentSource(SpringService.java:403)
        at org.jvnet.jax_ws_commons.spring.SpringService.afterPropertiesSet(SpringService.java:356)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1062)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1029)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:420)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBeanDefinition(BeanDefinitionValueResolver.java:198)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:116)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:955)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:729)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:416)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:290)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:348)
        at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:156)
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:246)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:184)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4792)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5256)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1349)
        at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:679)
        at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:217)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:136)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:610)
        at org.apache.catalina.valves.RequestFilterValve.process(RequestFilterValve.java:348)
        at org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:52)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:800)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1471)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:745)

war文件的构建没有问题,但是在Tomcat上上传时无法启动。

我在这里发现了类似的问题: https://github.com/javaee/metro-jaxws-commons/issues/21 但我找不到解决方法。

请帮助。预先感谢。

编辑: 在深入研究之后,我发现SpringService类内部有一个方法

private SDDocumentSource resolveSDDocumentSource(Object resource) {
    SDDocumentSource source;

    if (resource instanceof String) {
        source = this.convertStringToSource((String) resource);
    }
    else if (resource instanceof URL) {
        source = SDDocumentSource.create((URL) resource);
    }
    else if (resource instanceof SDDocumentSource) {
        source = (SDDocumentSource) resource;
    }
    else {
        throw new IllegalArgumentException("Unknown type " + resource);
    }

    return source;
}

“未知类型{http://www.springframework.org/schema/beans} / WEB-INF / wsdl / Personnel.wsdl”是由这种方法引起的。

该参数来自spring配置文件:

<wss:binding url="/services/Personnel">
    <wss:service>
        <ws:service bean="#PersonnelWs">
            <ws:handlers>
                <ref bean="biServiceHandler"/>
            </ws:handlers>
            <ws:metadata>
                <value>/WEB-INF/wsdl/Personnel.xsd</value>
            </ws:metadata>
            <ws:primaryWsdl>
                <value>/WEB-INF/wsdl/Personnel.wsdl</value>
            </ws:primaryWsdl>
        </ws:service>
    </wss:service>
</wss:binding>

我不知道那里到底发生了什么。显然,它无法将Personnel.wsdl识别为字符串,URL或SDDocumentSource,这会引起问题,但是我该如何解决呢?

0 个答案:

没有答案