类应用程序监听器的配置错误

时间:2017-08-02 11:09:42

标签: java spring web-services maven tomcat

我在Windows 64位上运行Tomcat 7.0和INTELLIJ,当我运行应用程序时,我遇到了应用程序监听器的问题(org.springframework web.context.ContextLoaderListener。  以下是文件的一部分:

的web.xml:



<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
         version="3.1">

    <display-name>Apache-cxf</display-name>

    <context-param>
        <param-name>isRemote</param-name>
        <param-value>false</param-value>
    </context-param>
    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>

    <servlet>
    <servlet-name>CXFServlet</servlet-name>

    <servlet-class>
        org.apache.cxf.transport.servlet.CXFServlet
    </servlet-class>

    </servlet>

    <servlet-mapping>
        <servlet-name>CXFServlet</servlet-name>
        <url-pattern>/services/*</url-pattern>
    </servlet-mapping>


    <!-- currently the W3C havent settled on a media type for WSDL;
    http://www.w3.org/TR/2003/WD-wsdl12-20030303/#ietf-draft
    for now we go with the basic 'it's XML' response -->
    <mime-mapping>
        <extension>wsdl</extension>
        <mime-type>text/xml</mime-type>
    </mime-mapping>


    <mime-mapping>
        <extension>xsd</extension>
        <mime-type>text/xml</mime-type>
    </mime-mapping>

    <welcome-file-list id="WelcomeFileList">
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>

</web-app>
&#13;
&#13;
&#13;

Tomcat日志:

    org.apache.catalina.core.StandardContext listenerStart
GRAVE: Erreur lors de la configuration de la classe d'écoute de l'application (application listener) org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
    at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:532)
    at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:514)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:142)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4876)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5455)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:634)
    at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1741)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:620)
    at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:567)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
    at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1468)
    at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:76)
    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1309)
    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1401)
    at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:829)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:324)
    at sun.rmi.transport.Transport$1.run(Transport.java:200)
    at sun.rmi.transport.Transport$1.run(Transport.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

août 02, 2017 12:38:37 PM org.apache.catalina.core.StandardContext listenerStart
GRAVE: L''installation des écouteurs (listeners) de l''application a été sautée suite aux erreurs précédentes

服务器日志:

    Connected to server
[2017-08-02 12:29:36,505] Artifact webservice-server.jar.src:war exploded: Artifact is being deployed, please wait...
août 02, 2017 12:29:36 PM org.apache.catalina.deploy.WebXml setVersion
AVERTISSEMENT: Unknown version string [3.1]. Default version will be used.?
août 02, 2017 12:29:39 PM org.apache.catalina.core.StandardContext startInternal
GRAVE: Error listenerStart
août 02, 2017 12:29:39 PM org.apache.catalina.core.StandardContext startInternal
GRAVE: Erreur de démarrage du contexte [] suite aux erreurs précédentes
[2017-08-02 12:29:39,611] Artifact webservice-server.jar.src:war exploded: Error during artifact deployment. See server log for details.
août 02, 2017 12:29:46 PM org.apache.catalina.startup.HostConfig deployDirectory
INFOS: Déploiement du répertoire D:\tomcat7\apache-tomcat-7.0.50\webapps\manager de l'application web
[2017-08-02 12:38:34,539] Artifact webservice-server.jar.src:war exploded: Artifact is being deployed, please wait...
août 02, 2017 12:38:37 PM org.apache.catalina.core.StandardContext startInternal
GRAVE: Error listenerStart
août 02, 2017 12:38:37 PM org.apache.catalina.core.StandardContext startInternal
GRAVE: Erreur de démarrage du contexte [] suite aux erreurs précédentes
[2017-08-02 12:38:37,918] Artifact webservice-server.jar.src:war exploded: Error during artifact deployment. See server log for details.

有没有人对我如何进一步调试有任何建议?任何帮助都将非常感激。

弹簧配置:

<?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.xsd
   http://www.springframework.org/schema/context ">

    <bean id="greetingService"
          class="com.springRemotingRmiServer.GreetingServiceImpl"/>

    <bean class="org.springframework.remoting.rmi.RmiServiceExporter">
        <property name="serviceName" value="greetingService"/>
        <property name="service" ref="greetingService"/>
        <property name="serviceInterface" 
                  value="com.springRemotingRmiServer.GreetingService"/>
        <property name="registryPort" value="1099"/>
    </bean>

</beans>

1 个答案:

答案 0 :(得分:0)

这是我的spring-config:

<?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.xsd
http://www.springframework.org/schema/context ">

    <bean id="greetingService"
          class="com.springRemotingRmiServer.GreetingServiceImpl"/>

    <bean class="org.springframework.remoting.rmi.RmiServiceExporter">
        <property name="serviceName" value="greetingService"/>
        <property name="service" ref="greetingService"/>
        <property name="serviceInterface" value="com.springRemotingRmiServer.GreetingService"/>
        <property name="registryPort" value="1099"/>
    </bean>


</beans>