gpt4 book ai didi

eclipse - Eclipse 中的 Tomcat 启动 JSF 项目失败

转载 作者:行者123 更新时间:2023-11-28 22:27:29 25 4
gpt4 key购买 nike

<分区>

我使用了我的“旧”(几个月前创建的,当时运行良好)JSF 和 Maven 应用程序并开始进行一些重构和重组。

但是,当我做了一些操作时,应用程序完全停止工作(在 Eclipse 中,但我担心它在普通 Tomcat 中会类似)。

日志

当我将我的应用程序添加到 Tomcat 实例并启动服务器时,eclipse 向我显示消息“Server Tomcat 8 (evic2 emulator) failed to start.”的对话框。在日志中可以看到以下异常(完整日志在这里:http://pastebin.com/YEX60a9c)(第一个异常导致服务器再抛出三个,省略,如果需要请查看完整日志):

 .... 
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

这意味着我的应用程序有问题,但遗憾的是没有具体说明。

我尝试了什么

经过大量谷歌搜索,我没有找到解决方案,所以我一直在尝试这些(以各种组合):

  • 清理 tomcat
  • 清理 Tomcat 工作目录
  • 添加和删除
  • 清理(项目 -> 清理...)
  • 使用 maven 重建(mvn clean install)
  • 重新启动项目
  • 再次删除并导入项目
  • 删除“有问题的”文件夹 **MYAPP**/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/
  • 使用 maven (mvn eclipse:clean eclipse:eclipse) 删除并重新创建项目
  • 创建新服务器并使用旧服务器

这些都没有帮助。我得到的“最好的”是服务器启动,没有错误,但应用程序仍然没有正确部署,因为浏览器总是显示 404 页面。

我的想法

我觉得问题不在我的应用程序中(同样,在重构之前它运行良好),但在 Eclipse/Tomcat 环境中。

我的环境

我在运行:

  • Debian Linux,amd64
  • 甲骨文 java 1.8.0_60
  • Eclipse Mars.1 版本 (4.5.1)
  • Apache 专家 3.0.5
  • Apache Tomcat 8.0.30

我的应用

这是我的应用程序的 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:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>hg6web</display-name>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>

<context-param>
<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>

<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>

<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>

<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>

</web-app>

我的应用程序的项目方面 ( https://www.dropbox.com/s/5kvz87ooc1ftzpb/hg6web-facets.png?dl=0) 是

  • 动态网络模块 3.1
  • Java 1.8
  • JavaScript 1.0
  • JavaServerFaces 2.2

请注意,Eclipse 在问题 面板中显示以下错误元组:

  • 无法将项目方面动态 Web 模块的版本更改为 2.5。
  • 未满足一个或多个约束条件。

但是,无论应用程序是否正常运行,我总是会看到此错误。

问题

有人遇到过这个问题吗?有人可以建议我尝试其他方法吗?或者我的项目设置有什么问题吗?

谢谢

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