web-dev-qa-db-ja.com

IntelliJ 13Tomcatクラスorg.springframework.web.util.Log4jConfigListenerのアプリケーションリスナーの構成中にエラーが発生しました

IntelliJ13とその組み込みのTomcatデプロイメントプラグインを使用してJava/Spring/Hibernate/Ivyアプリケーションを実行しようとしています。私はTomcat8.0.9を使用していますが、Tomcat6.0.39を使用してこれも試みました。 Tomcatを起動しようとすると、アーティファクトが作成されます。より具体的には爆発した戦争。 Ivyを使用して依存関係を解決しています。これは、Mavenを使用しないレガシーアプリだからです。愚かな、私は知っています。

任意のバージョンのTomcatを使用してIntelliJ内からこのアプリケーションを実行しようとすると、「サーバー」ログに次のメッセージが表示されます。

C:\dev\Apache-Tomcat-6.0.39\Apache-Tomcat-6.0.39\bin\catalina.bat run
[2014-07-01 05:33:09,056] Artifact Kiosk:war exploded: Server is not connected. Deploy is not available.
Using CATALINA_BASE:   "C:\Users\{username}\.IntelliJIdea13\system\Tomcat\Unnamed_Kiosk_4"
Using CATALINA_HOME:   "C:\dev\Apache-Tomcat-6.0.39\Apache-Tomcat-6.0.39"
Using CATALINA_TMPDIR: "C:\dev\Apache-Tomcat-6.0.39\Apache-Tomcat-6.0.39\temp"
Using JRE_HOME:        "C:\apps\Java\jdk1.7.0_51"
Using CLASSPATH:       "C:\dev\Apache-Tomcat-6.0.39\Apache-Tomcat-6.0.39\bin\bootstrap.jar"
Connected to the target VM, address: '127.0.0.1:57131', transport: 'socket'
Jul 01, 2014 5:33:09 PM org.Apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the Java.library.path: C:\apps\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\apps\Java\jdk1.7.0_51\bin;C:\Apps\TortoiseSVN\bin;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\dev\Apache-Tomcat-6.0.39\Apache-Tomcat-6.0.39;C:\dev\Apache-maven-3.2.1-bin\Apache-maven-3.2.1\bin;C:\dev\SlikSvn\bin;.;;.;;.
Jul 01, 2014 5:33:09 PM org.Apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jul 01, 2014 5:33:09 PM org.Apache.catalina.startup.Catalina load
INFO: Initialization processed in 475 ms
Jul 01, 2014 5:33:09 PM org.Apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jul 01, 2014 5:33:09 PM org.Apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.39
Jul 01, 2014 5:33:10 PM org.Apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jul 01, 2014 5:33:10 PM org.Apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jul 01, 2014 5:33:10 PM org.Apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/15  config=null
Jul 01, 2014 5:33:10 PM org.Apache.catalina.startup.Catalina start
INFO: Server startup in 97 ms
Connected to server
[2014-07-01 05:33:10,133] Artifact Kiosk:war exploded: Artifact is being deployed, please wait...
Jul 01, 2014 5:33:10 PM org.Apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Jul 01, 2014 5:33:10 PM org.Apache.catalina.core.StandardContext start
SEVERE: Context [] startup failed due to previous errors
[2014-07-01 05:33:10,479] Artifact Kiosk:war exploded: Error during artifact deployment. See server log for details.
Jul 01, 2014 5:33:20 PM org.Apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory manager

私のTomcatローカルホストログは次のようになります。

Jul 01, 2014 5:33:10 PM org.Apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.springframework.web.util.Log4jConfigListener
Java.lang.ClassNotFoundException: org.springframework.web.util.Log4jConfigListener
    at org.Apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.Java:1680)
    at org.Apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.Java:1526)
    at org.Apache.catalina.core.StandardContext.listenerStart(StandardContext.Java:4153)
    at org.Apache.catalina.core.StandardContext.start(StandardContext.Java:4709)
    at org.Apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.Java:799)
    at org.Apache.catalina.core.ContainerBase.addChild(ContainerBase.Java:779)
    at org.Apache.catalina.core.StandardHost.addChild(StandardHost.Java:583)
    at org.Apache.catalina.startup.HostConfig.manageApp(HostConfig.Java:1429)
    at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:57)
    at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
    at Java.lang.reflect.Method.invoke(Method.Java:606)
    at org.Apache.Tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.Java:297)
    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:631)
    at org.Apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.Java:568)
    at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:57)
    at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
    at Java.lang.reflect.Method.invoke(Method.Java:606)
    at org.Apache.Tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.Java:295)
    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:1487)
    at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.Java:97)
    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.Java:1328)
    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.Java:1420)
    at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.Java:848)
    at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:57)
    at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
    at Java.lang.reflect.Method.invoke(Method.Java:606)
    at Sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.Java:322)
    at Sun.rmi.transport.Transport$1.run(Transport.Java:177)
    at Sun.rmi.transport.Transport$1.run(Transport.Java:174)
    at Java.security.AccessController.doPrivileged(Native Method)
    at Sun.rmi.transport.Transport.serviceCall(Transport.Java:173)
    at Sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.Java:556)
    at Sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.Java:811)
    at Sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.Java:670)
    at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1145)
    at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:615)
    at Java.lang.Thread.run(Thread.Java:744)

Jul 01, 2014 5:33:10 PM org.Apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
Java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
    at org.Apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.Java:1680)
    at org.Apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.Java:1526)
    at org.Apache.catalina.core.StandardContext.listenerStart(StandardContext.Java:4153)
    at org.Apache.catalina.core.StandardContext.start(StandardContext.Java:4709)
    at org.Apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.Java:799)
    at org.Apache.catalina.core.ContainerBase.addChild(ContainerBase.Java:779)
    at org.Apache.catalina.core.StandardHost.addChild(StandardHost.Java:583)
    at org.Apache.catalina.startup.HostConfig.manageApp(HostConfig.Java:1429)
    at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:57)
    at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
    at Java.lang.reflect.Method.invoke(Method.Java:606)
    at org.Apache.Tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.Java:297)
    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:631)
    at org.Apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.Java:568)
    at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:57)
    at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
    at Java.lang.reflect.Method.invoke(Method.Java:606)
    at org.Apache.Tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.Java:295)
    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:1487)
    at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.Java:97)
    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.Java:1328)
    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.Java:1420)
    at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.Java:848)
    at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:57)
    at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
    at Java.lang.reflect.Method.invoke(Method.Java:606)
    at Sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.Java:322)
    at Sun.rmi.transport.Transport$1.run(Transport.Java:177)
    at Sun.rmi.transport.Transport$1.run(Transport.Java:174)
    at Java.security.AccessController.doPrivileged(Native Method)
    at Sun.rmi.transport.Transport.serviceCall(Transport.Java:173)
    at Sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.Java:556)
    at Sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.Java:811)
    at Sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.Java:670)
    at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1145)
    at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:615)
    at Java.lang.Thread.run(Thread.Java:744)

Jul 01, 2014 5:33:10 PM org.Apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.springframework.web.util.IntrospectorCleanupListener
Java.lang.ClassNotFoundException: org.springframework.web.util.IntrospectorCleanupListener
    at org.Apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.Java:1680)
    at org.Apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.Java:1526)
    at org.Apache.catalina.core.StandardContext.listenerStart(StandardContext.Java:4153)
    at org.Apache.catalina.core.StandardContext.start(StandardContext.Java:4709)
    at org.Apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.Java:799)
    at org.Apache.catalina.core.ContainerBase.addChild(ContainerBase.Java:779)
    at org.Apache.catalina.core.StandardHost.addChild(StandardHost.Java:583)
    at org.Apache.catalina.startup.HostConfig.manageApp(HostConfig.Java:1429)
    at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:57)
    at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
    at Java.lang.reflect.Method.invoke(Method.Java:606)
    at org.Apache.Tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.Java:297)
    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:631)
    at org.Apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.Java:568)
    at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:57)
    at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
    at Java.lang.reflect.Method.invoke(Method.Java:606)
    at org.Apache.Tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.Java:295)
    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:1487)
    at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.Java:97)
    at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.Java:1328)
    at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.Java:1420)
    at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.Java:848)
    at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:57)
    at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
    at Java.lang.reflect.Method.invoke(Method.Java:606)
    at Sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.Java:322)
    at Sun.rmi.transport.Transport$1.run(Transport.Java:177)
    at Sun.rmi.transport.Transport$1.run(Transport.Java:174)
    at Java.security.AccessController.doPrivileged(Native Method)
    at Sun.rmi.transport.Transport.serviceCall(Transport.Java:173)
    at Sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.Java:556)
    at Sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.Java:811)
    at Sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.Java:670)
    at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1145)
    at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:615)
    at Java.lang.Thread.run(Thread.Java:744)

Jul 01, 2014 5:33:10 PM org.Apache.catalina.core.StandardContext listenerStart
SEVERE: Skipped installing application listeners due to previous error(s)

そして、私のTomcatカタリナログは次のようになります。

Jul 01, 2014 5:33:09 PM org.Apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the Java.library.path: C:\apps\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\apps\Java\jdk1.7.0_51\bin;C:\Apps\TortoiseSVN\bin;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\dev\Apache-Tomcat-6.0.39\Apache-Tomcat-6.0.39;C:\dev\Apache-maven-3.2.1-bin\Apache-maven-3.2.1\bin;C:\dev\SlikSvn\bin;.;;.;;.
Jul 01, 2014 5:33:09 PM org.Apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Jul 01, 2014 5:33:09 PM org.Apache.catalina.startup.Catalina load
INFO: Initialization processed in 475 ms
Jul 01, 2014 5:33:09 PM org.Apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jul 01, 2014 5:33:09 PM org.Apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.39
Jul 01, 2014 5:33:10 PM org.Apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Jul 01, 2014 5:33:10 PM org.Apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Jul 01, 2014 5:33:10 PM org.Apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/15  config=null
Jul 01, 2014 5:33:10 PM org.Apache.catalina.startup.Catalina start
INFO: Server startup in 97 ms
Jul 01, 2014 5:33:10 PM org.Apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Jul 01, 2014 5:33:10 PM org.Apache.catalina.core.StandardContext start
SEVERE: Context [] startup failed due to previous errors
Jul 01, 2014 5:33:20 PM org.Apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory manager

これは、それらのリスナーが私のweb.xmlで宣言されている場所です

<!-- Spring log4j listener -->
  <listener>
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
  </listener> 
  <!-- Spring bootstrap listener -->
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>  
  <!-- Spring cleanup listener -->
  <listener>
    <listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
  </listener>

これらのクラスはすべて私のクラスパスで利用できますが、問題は、Tomcatのクラスパスで利用できないことのようです。

Ivyキャッシュを「shared.loader」プロパティの下のcatalina.propertiesファイルに追加しようとした後、これらのjarをTomcatのクラスパスで使用できるようにするために、ディレクトリを正しくフォーマットできませんでした。おそらくそれは必要なjarをTomcatで利用できるようにするでしょう、そしてもちろんTomcatは共有ローダーを指定するために必要な構文に関するドキュメントを提供しません...ヘルプ...

8
brad142

私は同様の問題を抱えていました、または少なくとも例外

30-Aug-2014 20:31:12.044 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.Apache.catalina.core.StandardContext.listenerStart Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
Java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
at org.Apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.Java:1324)
at org.Apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.Java:1177)
at org.Apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.Java:550)
at org.Apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.Java:531)

問題は、ライブラリがアーティファクトに追加されていないことでした。

修正するには、File-> Project Structure

次に、見つかったすべてのエラーで[修正]をクリックし、[OK]をクリックします。

次回プロジェクトを実行したとき、エラーは発生しませんでした。

21
pont

プロジェクト設定にjarを追加-ライブラリ enter image description here

4
saneryee

同じ問題がありました。Mavenを使用してビルドすると、正常に実行されましたが、TomcatのIDEで実行するとエラーが発生しました。

IDE jarライブラリを出力フォルダにコピーできない、つまりWEB-INF/lib /が原因だと思います。 check this folder 確認してください

私(怠惰な方法)の場合、不足しているjarファイルをwebapp/WEB-INF/lib/[ps:under出力ディレクトリではなく、開発ディレクトリ]

3
artificerpi