gpt4 book ai didi

java - 无法在 Tomcat 8 上部署 war 文件

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

您好,以前我使用的是 tomcat 7,并且在 tomcat 7(在 linux 服务器上)上部署我的 war 文件。现在我已经安装了 tomcat8(在 linux 服务器上)但它没有部署我的 war 文件。我的配置是:

下图中的最后一个是我的 Web 应用程序。

enter image description here

我的 Web.xml 文件是:

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>DL Access</display-name>
<listener>
<listener-class>
com.dl.pretasks.PreTasks
</listener-class>
</listener>
<servlet>
<servlet-name>jersey-serlvet</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.dl.dlaccess.service</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>jersey-serlvet1</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.dl.contentTags.service</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>jersey-serlvet2</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.dl.contentTags.service</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet>
<servlet-name>jersey-serlvet3</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.dl.changeApiStatus.service</param-value>
</init-param>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>jersey-serlvet</servlet-name>
<url-pattern>/dl/dlaccess/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>jersey-serlvet1</servlet-name>
<url-pattern>/dl/content/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>jersey-serlvet2</servlet-name>
<url-pattern>/dl/content/cron</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>jersey-serlvet3</servlet-name>
<url-pattern>/apistatus/*</url-pattern>
</servlet-mapping>
<error-page>
<location>/defaultErrorPage.jsp</location>
</error-page>
</web-app>

我的 Pom.xml 文件是:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>svc</groupId>
<artifactId>svc</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>svc Maven Webapp</name>
<url>http://maven.apache.org</url>

<dependencies>
<!-- <dependency> <groupId>org.apache.thrift</groupId> <artifactId>libthrift</artifactId>
<version>0.9.0</version> </dependency> -->

<dependency>
<groupId>com.github.ptgoetz</groupId>
<artifactId>storm-signals</artifactId>
<version>0.2.0</version>
</dependency>


<dependency>
<groupId>org.apache.storm</groupId>
<artifactId>storm-core</artifactId>
<version>0.9.1-incubating</version>
<exclusions>
<exclusion>
<artifactId>servlet-api</artifactId>
<groupId>javax.servlet</groupId>
</exclusion>
<exclusion>
<artifactId>servlet-api</artifactId>
<groupId>org.mortbay.jetty</groupId>
</exclusion>
<exclusion>
<artifactId>asm</artifactId>
<groupId>org.ow2.asm</groupId>
</exclusion>
</exclusions>
</dependency>


<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.6</version>
</dependency>

<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
<version>2.2.0</version>
<exclusions>
<exclusion>
<artifactId>javax.servlet</artifactId>
<groupId>org.glassfish</groupId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>0.98.4-hadoop2</version>
</dependency>

<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.4.6</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.32</version>
</dependency>

<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>

<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.16</version>
</dependency>

<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>

<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.8</version>
</dependency>



<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.8</version>
</dependency>

<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-multipart</artifactId>
<version>1.8</version>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
</dependency>

<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
<version>2.0.0</version>
</dependency>

<!-- <dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency> -->
<dependency>
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
<version>1.0</version>
</dependency>
<!-- <dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.0</version>
<scope>runtime</scope>
</dependency> -->
</dependencies>

<build>
<finalName>svc</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>

</project>

Tomcat 日志文件:

16-Nov-2014 20:27:44.985 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server version: Apache Tomcat/8.0.14
16-Nov-2014 20:27:44.987 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server built: Sep 24 2014 09:01:51
16-Nov-2014 20:27:44.987 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Server number: 8.0.14.0
16-Nov-2014 20:27:44.987 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name: Linux
16-Nov-2014 20:27:44.987 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version: 3.13.0-37-generic
16-Nov-2014 20:27:44.987 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture: amd64
16-Nov-2014 20:27:44.988 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version: 1.7.0_67-b01
16-Nov-2014 20:27:44.988 INFO [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor: Oracle Corporation
16-Nov-2014 20:27:45.295 INFO [main] org.apache.catalina.core.AprLifecycleListener.init The APR based Apache Tomcat Native library which allows optimal performance in production environments was n$
16-Nov-2014 20:27:45.520 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-22410"]
16-Nov-2014 20:27:45.536 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
16-Nov-2014 20:27:45.539 INFO [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
16-Nov-2014 20:27:45.543 INFO [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
16-Nov-2014 20:27:45.543 INFO [main] org.apache.catalina.startup.Catalina.load Initialization processed in 636 ms
16-Nov-2014 20:27:45.568 INFO [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
16-Nov-2014 20:27:45.569 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.14
16-Nov-2014 20:27:45.609 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /etc/tools/tomcat-8.0.14/webapps/svc.war
SLF4J: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError.
SLF4J: See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
16-Nov-2014 20:27:50.074 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Error listenerStart
16-Nov-2014 20:27:50.080 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [/svc] startup failed due to previous errors
16-Nov-2014 20:27:50.091 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /etc/tools/tomcat-8.0.14/webapps/svc.war has finished i$
16-Nov-2014 20:27:50.094 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /etc/tools/tomcat-8.0.14/webapps/docs
16-Nov-2014 20:27:50.145 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /etc/tools/tomcat-8.0.14/webapps/docs has finis$
16-Nov-2014 20:27:50.146 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /etc/tools/tomcat-8.0.14/webapps/examples
16-Nov-2014 20:27:50.437 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /etc/tools/tomcat-8.0.14/webapps/examples has f$
16-Nov-2014 20:27:50.437 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /etc/tools/tomcat-8.0.14/webapps/ROOT
16-Nov-2014 20:27:50.460 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /etc/tools/tomcat-8.0.14/webapps/ROOT has finis$
16-Nov-2014 20:27:50.460 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /etc/tools/tomcat-8.0.14/webapps/manager
16-Nov-2014 20:27:50.491 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /etc/tools/tomcat-8.0.14/webapps/manager has fi$
16-Nov-2014 20:27:50.491 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory /etc/tools/tomcat-8.0.14/webapps/host-manager
16-Nov-2014 20:27:50.516 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory /etc/tools/tomcat-8.0.14/webapps/host-manager h$
16-Nov-2014 20:27:50.526 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-22410"]
16-Nov-2014 20:27:50.535 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
16-Nov-2014 20:27:50.540 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 4996 ms

在我的本地 ubuntu 机器上,此 Web 应用程序在 tomcat 上运行良好。但是当我在 ubuntu 服务器上删除它并想要访问时,它开始创建 404 错误。我认为 web.xml 或 pom.xml 没有问题,因为在那种情况下它不应该部署在我的本地机器上。

有什么建议吗?

最佳答案

SLF4J: Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflowError.
SLF4J: See also http://www.slf4j.org/codes.html#log4jDelegationLoop for more details.
16-Nov-2014 20:27:50.074 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Error listenerStart
16-Nov-2014 20:27:50.080 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.startInternal Context [/svc] startup failed due to previous errors

解决 .jars 之间的冲突应该是第一步。应删除其中之一。

关于java - 无法在 Tomcat 8 上部署 war 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26950279/

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