gpt4 book ai didi

使用 Gradle 构建的 Spring 应用程序在 eclipse 中运行,但 war 文件在 tomcat 上抛出 404

转载 作者:行者123 更新时间:2023-11-28 22:56:48 24 4
gpt4 key购买 nike

我使用 Eclipse gradle 插件执行了 gradle 构建,并将 war 文件从 build/lib 部署到远程服务器上的 tomcat 上。即使 tomcat 管理器将 war 识别为已部署,war 文件也会抛出 404。看日志,似乎Spring应用根本没有启动。

日志:

Aug 05, 2014 5:04:45 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common/classes], exists: [false], isDirectory: [false], canRead: [false]
Aug 05, 2014 5:04:45 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common], exists: [false], isDirectory: [false], canRead: [false]
Aug 05, 2014 5:04:45 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server/classes], exists: [false], isDirectory: [false], canRead: [false]
Aug 05, 2014 5:04:45 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server], exists: [false], isDirectory: [false], canRead: [false]
Aug 05, 2014 5:04:45 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
Aug 05, 2014 5:04:45 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared], exists: [false], isDirectory: [false], canRead: [false]
Aug 05, 2014 5:04:46 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Aug 05, 2014 5:04:46 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 372 ms
Aug 05, 2014 5:04:46 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Aug 05, 2014 5:04:46 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.52 (Ubuntu)
Aug 05, 2014 5:04:46 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive /var/lib/tomcat7/webapps/branch.war
Aug 05, 2014 5:04:46 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/var/lib/tomcat7/webapps/branch/WEB-INF/lib/javaee-api-6.0-6.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Aug 05, 2014 5:04:46 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/var/lib/tomcat7/webapps/branch/WEB-INF/lib/javax.servlet-api-3.0.1.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Aug 05, 2014 5:04:46 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/var/lib/tomcat7/webapps/branch/WEB-INF/lib/jsp-api-2.1.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/el/Expression.class
Aug 05, 2014 5:04:50 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined
Aug 05, 2014 5:04:50 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core is already defined
Aug 05, 2014 5:04:50 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined
Aug 05, 2014 5:04:50 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined
Aug 05, 2014 5:04:50 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined
Aug 05, 2014 5:04:50 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined
Aug 05, 2014 5:04:50 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined
Aug 05, 2014 5:04:50 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined
Aug 05, 2014 5:04:50 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined
Aug 05, 2014 5:04:50 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined
Aug 05, 2014 5:04:50 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined
Aug 05, 2014 5:04:50 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined
Aug 05, 2014 5:04:50 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined
Aug 05, 2014 5:04:50 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined
Aug 05, 2014 5:04:50 PM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/var/lib/tomcat7/webapps/branch/WEB-INF/lib/slf4j-log4j12-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/var/lib/tomcat7/webapps/branch/WEB-INF/lib/slf4j-simple-1.5.8.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
log4j:WARN No appenders could be found for logger (net.kencochrane.raven.DefaultRavenFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Aug 05, 2014 5:05:21 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error listenerStart
Aug 05, 2014 5:05:21 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/branch] startup failed due to previous errors
Aug 05, 2014 5:05:21 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [/branch] registered the JDBC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Aug 05, 2014 5:05:21 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/branch] appears to have started a thread named [pool-1-thread-1] but has failed to stop it. This is very likely to create a memory leak.
Aug 05, 2014 5:05:21 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/branch] appears to have started a thread named [pool-1-thread-2] but has failed to stop it. This is very likely to create a memory leak.
Aug 05, 2014 5:05:21 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/branch] appears to have started a thread named [pool-1-thread-3] but has failed to stop it. This is very likely to create a memory leak.
Aug 05, 2014 5:05:21 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/branch] appears to have started a thread named [pool-1-thread-4] but has failed to stop it. This is very likely to create a memory leak.
Aug 05, 2014 5:05:21 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/branch] appears to have started a thread named [pool-1-thread-5] but has failed to stop it. This is very likely to create a memory leak.
Aug 05, 2014 5:05:21 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/branch] appears to have started a thread named [pool-1-thread-6] but has failed to stop it. This is very likely to create a memory leak.
Aug 05, 2014 5:05:21 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/branch] appears to have started a thread named [pool-1-thread-7] but has failed to stop it. This is very likely to create a memory leak.
Aug 05, 2014 5:05:21 PM org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/branch] appears to have started a thread named [pool-1-thread-8] but has failed to stop it. This is very likely to create a memory leak.
Aug 05, 2014 5:05:21 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/branch] created a ThreadLocal with key of type [net.kencochrane.raven.Raven$1] (value [net.kencochrane.raven.Raven$1@183601a5]) and a value of type [java.lang.Boolean] (value [false]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Aug 05, 2014 5:05:21 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/branch] created a ThreadLocal with key of type [net.kencochrane.raven.Raven$1] (value [net.kencochrane.raven.Raven$1@183601a5]) and a value of type [java.lang.Boolean] (value [false]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Aug 05, 2014 5:05:21 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/branch] created a ThreadLocal with key of type [net.kencochrane.raven.Raven$1] (value [net.kencochrane.raven.Raven$1@183601a5]) and a value of type [java.lang.Boolean] (value [true]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Aug 05, 2014 5:05:21 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/branch] created a ThreadLocal with key of type [net.kencochrane.raven.Raven$1] (value [net.kencochrane.raven.Raven$1@183601a5]) and a value of type [java.lang.Boolean] (value [true]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Aug 05, 2014 5:05:21 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/branch] created a ThreadLocal with key of type [net.kencochrane.raven.Raven$1] (value [net.kencochrane.raven.Raven$1@183601a5]) and a value of type [java.lang.Boolean] (value [true]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Aug 05, 2014 5:05:21 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/branch] created a ThreadLocal with key of type [net.kencochrane.raven.Raven$1] (value [net.kencochrane.raven.Raven$1@183601a5]) and a value of type [java.lang.Boolean] (value [true]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Aug 05, 2014 5:05:21 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/branch] created a ThreadLocal with key of type [net.kencochrane.raven.Raven$1] (value [net.kencochrane.raven.Raven$1@183601a5]) and a value of type [java.lang.Boolean] (value [true]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Aug 05, 2014 5:05:21 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/branch] created a ThreadLocal with key of type [net.kencochrane.raven.Raven$1] (value [net.kencochrane.raven.Raven$1@183601a5]) and a value of type [java.lang.Boolean] (value [true]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Aug 05, 2014 5:05:21 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/branch] created a ThreadLocal with key of type [net.kencochrane.raven.Raven$1] (value [net.kencochrane.raven.Raven$1@183601a5]) and a value of type [java.lang.Boolean] (value [true]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Aug 05, 2014 5:05:21 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/branch] created a ThreadLocal with key of type [net.kencochrane.raven.Raven$1] (value [net.kencochrane.raven.Raven$1@183601a5]) and a value of type [java.lang.Boolean] (value [true]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.

更新:

在更改 log4j 属性后,感谢 Stefan,我在尝试部署我的 war 文件时发现了以下错误。

INFO: Deploying web application archive /var/lib/tomcat7/webapps/branch.war
Aug 6, 2014 7:47:00 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-8080"]
Aug 6, 2014 7:47:00 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Aug 6, 2014 7:47:00 PM org.apache.catalina.startup.HostConfig deployWARs
SEVERE: Error waiting for multi-thread deployment of WAR files to complete
java.lang.InterruptedException
at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1000)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1304)
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:248)
at java.util.concurrent.FutureTask.get(FutureTask.java:111)
at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:751)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:471)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1453)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:295)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1379)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1537)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1547)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1526)
at java.lang.Thread.run(Thread.java:701)

最佳答案

首先,您需要修复日志配置。从您的 war 文件中删除 slf4j-simple-1.5.8.jar 并将有效的 log4j.properties 文件插入到 WEB-INF/classes(或您的项目:“src”)目录中:

log4j.rootLogger=WARN, console
log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d [%t] %-5p %c - %m%n

关于使用 Gradle 构建的 Spring 应用程序在 eclipse 中运行,但 war 文件在 tomcat 上抛出 404,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25150532/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com