Eclipse Maven web应用程序 - 无法在服务器上运行
我有一个maven eclipse webapp项目,我可以右键单击并在服务器上运行,它将在tomcat上部署。我最近做了一个'maven - >更新项目配置',我现在不能部署和运行项目作为web应用程序。有没有人见过这个?从tomcat的唯一输出如下 - 它甚至不像它试图部署应用程序。Eclipse Maven web应用程序 - 无法在服务器上运行
Apr 14, 2010 3:58:54 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: .:/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
Apr 14, 2010 3:58:54 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:taac-web' did not find a matching property.
Apr 14, 2010 3:58:54 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Apr 14, 2010 3:58:54 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 402 ms
Apr 14, 2010 3:58:54 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Apr 14, 2010 3:58:54 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.24
Apr 14, 2010 3:58:54 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Apr 14, 2010 3:58:54 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Apr 14, 2010 3:58:54 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/14 config=null
Apr 14, 2010 3:58:54 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 247 ms
的POM仍设置为战争,但清理的项目,现在我正在图书馆ClassNotFoundExceptions正在包括作为Maven依赖后:
SEVERE: Error configuring application listener of class org.springframework.security.web.session.HttpSessionEventPublisher
java.lang.ClassNotFoundException: org.springframework.security.web.session.HttpSessionEventPublisher
这里是我的POM:
<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>com.cable.wuntee.neto.nse</groupId>
<artifactId>taac-web</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>taac-web JEE5 Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>3.0.1.RELEASE</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>2.3.16</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>3.0.2.RELEASE</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-acl</artifactId>
<version>3.0.2.RELEASE</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>3.0.2.RELEASE</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>3.0.2.RELEASE</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>2.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap-core</artifactId>
<version>1.3.0.RELEASE</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap</artifactId>
<version>1.3.0.RELEASE</version>
<type>pom</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-ldap</artifactId>
<version>3.0.2.RELEASE</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.cable.wuntee.neto.nse</groupId>
<artifactId>wuntee.neto.nse-ldap</artifactId>
<version>1.0-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.cable.wuntee.neto.nse</groupId>
<artifactId>wuntee.neto.nse-cada</artifactId>
<version>1.0-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.cable.wuntee.neto.nse</groupId>
<artifactId>wuntee.neto.nse-sams</artifactId>
<version>2.0-SNAPSHOT</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.0.1.RELEASE</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>3.0.1.RELEASE</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
</plugins>
<finalName>taac-web</finalName>
</build>
</project>
也许你更改了<packaging>
从war
到其他事故。你可以展示你的POM?
你能否确认,你有Maven的WTP集成WTP安装(这是不可能的,但也许你安装了最新版本的m2eclipse没有这种额外的,不管怎样,事情是工作,直到您更新项目配置)?
这些都没有帮助 - 我最终只是禁用了工作空间解决方案,并且在处理过期时处理安装工作空间依赖关系。
我在WAR项目上遇到了那些奇怪的编译错误。由于某种原因,类路径以某种方式发生了变化,并且忽略了WAR所依赖的工作空间中的其他项目。
最终工作的唯一解决方案是擦除我的工作区,并在每个项目中删除.classpath,.project和.settings。从一个新的工作区开始解决它。
我发现了一个bug,提到Maven WTP bug跟踪器中类似的东西,但我没有得到足够的投票来修复我猜。
三种可能的解决方案。我已经使用了所有三个取决于它是如何出错的。
我解决了这个由我的POM移除春季安全依赖关系(我只有弹簧安全标签库和弹簧安全配置它拉一切我需要),节约了POM,让Maven的做它的东西,然后再次将它们添加回来,让Maven再次获得依赖关系并在Eclipse中重新启动服务器。当问题发生时,Eclipse项目中的Maven依赖关系目录似乎缺少spring-security-web构件(其中包含org.springframework.security.web.session.HttpSessionEventPublisher)。对我而言,只有在重新启动我的电脑后启动Eclipse才会发生,所以我假设它是Windows(Vista),而Eclipse M2Eclipse插件没有很好地打开文件锁定或什么的。
替代解决方案(问题再次发生,以前的解决方案将无法正常工作)。这一次,我从本地maven仓库(Eclipse窗口 - >首选项 - > Maven->用户设置)中删除了org/springframework目录。然后,更新Maven的依赖关系,然后在这里我们再次去。
如果你已经完成了“Maven-> Update Project Configuration”,这可能是因为你的“Deployment Assembly”设置不包括Maven依赖项。转至project-> properties->部署程序集。检查Maven Dependencies是否存在,并拥有/ WEB-INF/lib的部署路径。如果没有,请单击添加并在Java构建路径选项下找到它。如果它不在那里,你的构建路径可能也会被破坏(尽管这从来没有发生过)。
替代解决方案(问题再次发生,以前的解决方案将无法正常工作)。
这一次,我从本地maven仓库(Eclipse窗口 - >首选项 - > Maven->用户设置)中删除了org/springframework目录。然后,更新Maven的依赖关系,然后在这里我们再次去。
在项目属性下,转到“方面”,按转换某物,启用动态Web模块,然后按应用。
我发现
你需要推动Maven依赖到服务器时,该项目被发布到它的答案。
右键单击项目资源管理器中的Web项目 - >选择“属性”。在项目属性下,选择“部署程序集”。
部署组件属性页面显示将作为Eclipse的已装配工件发布到服务器的内容。您需要告诉Eclipse您希望所有Maven依赖项都被发布。
要做到这一点,请点击'添加'按钮,然后选择'Java Build Path Entries'。点击Next并选择Maven Dependencies。这将发布Maven的依赖JAR文件,到lib文件夹时,Eclipse的发布你的项目WST服务器
哦,上帝谢谢!你救了我几个小时! – ianaz 2013-01-27 17:29:51
今天我有同样的问题,对我来说它有助于重新安装的Apache在eclipse的重建/刷新项目之后
好吧,我也为此付出了一点努力。我不认为有很多明确的答案,并且一段时间之后我会删除该项目并重新导入它,因为每次都会起作用。
今天我发现它在项目上运行一个maven clean(例如mvn clean)后又开始工作了。试试看看它是否适合你。
这不等同于eclipse clean,因为它只从目标目录中删除选定的几个文件夹,而不是整个东西。
我碰到这个问题,每隔一段时间,快速修复是:
- 右键项目 - >的Maven - >更新项目...
- Eclipse的服务器选项卡:停止服务器,右键点击Tomcat的v# - >清理 - > OK
下面是我用它来看看Eclipse是实际部署当它运行的tomcat的故障排除步骤。这是目前的火星和霓虹灯。(这些步骤假设你已经使用运行项目至少一次“在服务器上运行...”)
D:\code\workspaceNeon\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
- 即目录包含标准的web应用部署结构。在OS文件浏览器中打开该目录并检查其内容。当我在
WEB-INF/lib
望去,只见我最依赖的人失踪 - 一定要退出当您完成该目录的出来,否则Eclipse会得到错误试图修改/更新
-
打开你的项目展开组件设置:
Maven依赖关系是上面的关键项目。 如果没有这个,收出对话框,做行家更新: 右键项目 - >的Maven - >更新项目...
-
现在我们所做的更新,让我们清除掉服务器工作手动目录并重新发布。这可能并不总是必要的,但要确保一切都在同步之间什么部署总成所示,什么是实际部署是一个好办法:
现在是有时间来解决这个问题。让我们来看看Eclipse是应该进行部署:
祝你好运!
是的,有Maven的WTP安装 - 只是试图卸载和重新安装(没有帮助)。而且,是的,它是在我更新项目配置之前工作的......在以下帖子 – wuntee 2010-04-14 22:28:44
上查看新的错误/ pom也 - 如果我打包项目,它会复制所有项目。jar文件到WEB-INF/libs目录;如果我手动把它们放在eclipse项目中,它运行的很好......不知道为什么WTP不能管理它在eclipse中...... – wuntee 2010-04-14 22:44:14
@wuntee你之前更改过什么“更新项目配置”。你有没有改变一些版本? – 2010-04-14 22:47:37