我采取了我的“旧”(几个月前创建,当工作正常)JSF& maven应用程序并开始进行一些重构和重组。
但是,当我做了一些时,应用程序完全停止工作(在Eclipse中,但我担心它在普通的Tomcat中会类似)。
当我将我的应用程序添加到Tomcat实例并启动服务器时,eclipse显示对话框,其中显示消息“Server Tomcat 8(evic2 emulator)无法启动。”。在日志中可以看到以下异常(完成日志:http://pastebin.com/YEX60a9c)(第一个异常导致服务器再抛出三个,省略,如果需要,请参阅完整日志):
unsigned short id = (buffer[4] << 8) | buffer[5];
printf("Identification: 0x%hx (%hu)\n", id, id);
由于我的应用程序组件出现问题,服务器无法启动。我的应用程序的问题 - 看起来像 - 是由这个例外给出的:
....
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/hg6web]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/hg6web]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
... 6 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [org.apache.catalina.webresources.StandardRoot@747befb5]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4928)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5058)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 6 more
Caused by: java.lang.IllegalArgumentException: The main resource set specified [**MYAPP**/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/hg6web] is not valid
at org.apache.catalina.webresources.StandardRoot.createMainResourceSet(StandardRoot.java:723)
at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:684)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 9 more
Dub 28, 2016 2:06:01 DOP. org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:916)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:441)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:769)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.startup.Catalina.start(Catalina.java:625)
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:497)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1408)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1398)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:924)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:871)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 6 more
....
这意味着我的应用程序出了问题,但遗憾的是没有说明是什么。
经过大量的谷歌搜索,我没有找到解决方案,所以我一直在尝试这些(以各种组合):
Caused by: java.lang.IllegalArgumentException: The main resource set specified [**MYAPP**/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/hg6web] is not valid
)mvn clean install
**MYAPP**/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/
)这些都没有帮助。我得到的“最好的”是服务器启动,没有错误,但应用程序仍未正确部署,因为浏览器始终显示404页面。
我认为问题不在我的应用程序中(再次,在重构之前它运行良好),但是在Eclipse / Tomcat环境中。
我正在跑步:
这是我的应用mvn eclipse:clean eclipse:eclipse
:
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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>hg6web</artifactId>
<packaging>war</packaging>
<!-- the parent project is just simple pom project -->
<parent>
<groupId>cz.martlin</groupId>
<artifactId>homeguard6local</artifactId>
<version>0.1.0</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<!-- JSF stuff -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
</dependency>
<!-- other dependencies went here -->
</dependencies>
<build>
<plugins>
<!-- http://kosalads.blogspot.cz/2014/03/maven-deploy-war-in-tomcat-7.html -->
<!-- Tomcat plugin -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<path>/${project.build.name}</path>
<update>true</update>
<url>http://localhost:8080/manager/text</url>
<username>***username***</username>
<password>***password***</password>
</configuration>
</plugin>
</plugins>
</build>
</project>
:
web.xml
我的应用的项目方面(https://www.dropbox.com/s/5kvz87ooc1ftzpb/hg6web-facets.png?dl=0)是
请注意,Eclipse在 Problems 面板中显示以下错误元组:
但是,无论应用程序是否有效,我都会看到这些错误。
有人遇到过这个问题吗?有人可以建议我尝试别的吗?或者我的项目设置有什么问题吗?
由于
答案 0 :(得分:0)
@BalusC的通知解决了这个问题。
我一直在使用Servlet 3.0版(3.0.1)(使用maven依赖),但是已经为2.5配置了web.xml,而且Tomcat 8与3.1配合使用。
因此,我将javax.servlet-api
的版本更改为3.1.0,将web.xml更新为servlet的版本(请参阅this post)并且它可以正常工作。