一尘不染

Tomcat部署麻烦

tomcat

我正在尝试使用Tomcat运行servlet。我的Tomcat运行良好(我在虚拟Hello World项目上对其进行了测试)。我的父目录是C:\Users\dolgopolov.a\Desktop\tattelecom\amsc\amsc。这是我的方法:

  • 运行cmd.exe
  • >cd C:\Users\dolgopolov.a\Desktop\tattelecom\amsc\amsc
  • >jar -cvf tattelecom.war *
  • 添加tattelecom.warC:\tomcat\tomcat7\webapps
  • startup.bat

这就是我得到的:

SEVERE: ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngin
e[Catalina].StandardHost[localhost].StandardContext[/tattelecom]]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:901)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:87
7)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)

        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073
)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:
1857)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:47
1)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        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)
Caused by: java.lang.NoClassDefFoundError: javax/ejb/EJBObject
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14
2)
        at org.apache.catalina.loader.WebappClassLoader.findClassInternal(Webapp
ClassLoader.java:2944)
        at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoa
der.java:1208)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1688)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1569)
        at java.lang.Class.getDeclaredFields0(Native Method)
        at java.lang.Class.privateGetDeclaredFields(Class.java:2397)
        at java.lang.Class.getDeclaredFields(Class.java:1806)
        at org.apache.catalina.util.Introspection.getDeclaredFields(Introspectio
n.java:106)
        at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(Web
AnnotationSet.java:261)
        at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAn
notations(WebAnnotationSet.java:140)
        at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotatio
ns(WebAnnotationSet.java:65)
        at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfi
g(ContextConfig.java:400)
        at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfi
g.java:876)
        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfi
g.java:371)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
eSupport.java:117)
        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBa
se.java:90)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContex
t.java:5355)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        ... 10 more
Caused by: java.lang.ClassNotFoundException: javax.ejb.EJBObject
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1718)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1569)
        ... 31 more

Їхт 20, 2014 11:27:55 AM org.apache.catalina.startup.HostConfig deployWAR
SEVERE: Error deploying web application archive C:\tomcat\tomcat7\webapps\tattel
ecom.war
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catal
ina.LifecycleException: Failed to start component [StandardEngine[Catalina].Stan
dardHost[localhost].StandardContext[/tattelecom]]
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
.java:904)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:87
7)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:632)

        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1073
)
        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:
1857)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:47
1)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        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)

Їхт 20, 2014 11:27:55 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\tomcat\tomcat7\webapps\docs
Їхт 20, 2014 11:27:55 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\tomcat\tomcat7\webapps\examples
Їхт 20, 2014 11:27:55 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\tomcat\tomcat7\webapps\host-manager

Їхт 20, 2014 11:27:56 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\tomcat\tomcat7\webapps\manager
Їхт 20, 2014 11:27:56 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\tomcat\tomcat7\webapps\ROOT
Їхт 20, 2014 11:27:56 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Їхт 20, 2014 11:27:56 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Їхт 20, 2014 11:27:56 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 582 ms

怎么了?


阅读 326

收藏
2020-06-16

共1个答案

一尘不染

如果您使用的是maven,请考虑下载与此依赖项相关的jar,我认为没有

<dependency>
    <groupId>javax</groupId>
    <artifactId>javaee-api</artifactId>
    <version>6.0</version>
    <scope>runtime</scope>
</dependency>

下载jar文件http://mvnrepository.com/artifact/javax/javaee-
api/6.0并将其放在WAR文件中的WEB-INF / lib中。

考虑查看WAR文件的结构

2020-06-16