相关疑难解决方法(0)

Eclipse Indigo/3.7中的Maven/Tomcat项目

我正在尝试使用最新里程碑版本的Eclipse的下一个版本,我遇到了将我的Maven项目部署到Tomcat的问题.

以前在Eclipse 3.6中,我的项目在从SVN签出时自动作为Web项目启用.我已经在3.7中检查了我的项目,但没有得到任何表明它可以作为一个Web项目运行(例如,尝试运行该项目并没有给我通常的"Run on Server"选项).

我安装的是Indigo RC4"用于Java EE开发人员的Eclipse IDE"版本.然后我从这里添加了最新的M2E里程碑.这使我能够启动并运行,检查我的项目,我似乎能够很好地构建项目(这确实创建了我的.war文件进行远程部署).但仍然没有"Run On Server"选项.

有没有人能找到我可能遗失的线索?我猜这是一个Maven和WTP集成插件,但我还没有找到合适的插件.

eclipse-wtp maven eclipse-indigo

25
推荐指数
2
解决办法
3万
查看次数

Eclipse WTP在Tomcat服务器中部署依赖项的奇怪行为

我的Eclipse WTP在Tomcat部署过程中有一个奇怪的行为.我使用Eclipse 3.7(Indigo),WTP 3.3,没有 m2eclipse插件,Java 1.6,Tomcat 5.5.

我的应用程序是一个Web应用程序,其他一些项目作为依赖项,以及一些第三方依赖项.我的项目由Maven管理,当我们使用这个工具构建应用程序时,一切正常.

要使用Eclipse处理我的项目,我运行mvn eclipse:clean eclipse:eclipse然后,我在IDE中导入我的项目.

当我想在Tomcat 5.5服务器上部署此Web应用程序时(这个服务器由Eclipse管理),我的问题出现了.当我创建一个新的Tomcat服务器,并在其中部署my -project-portal应用程序时,它只添加了my-project-xxx依赖项,以及很少的第三方依赖项(大约有9个定义的).在我的一位同事桌面上(他正在使用Eclipse 3.5),根本没有部署第三方依赖,只有my-project-xxx JAR ......

但是,当我查看Web-app项目属性,在Java Build Path> Libraries或"Deployment Assembly"中时,依赖项列表是正确和完整的.

笔记

我使用较旧的Eclipse(3.3,使用WTP 3.1)进行了一些测试,但我没有遇到任何部署问题.但是,这个WTP仍在使用"Java EE Modules Dependencies",而不是最新的WTP版本.

到目前为止,我们使用了一个自定义的Maven插件,然后将mvn eclipse:eclipse所有依赖项(包括传递的)复制到其中my-webapp-project/WebContent/WEB-INF/lib.这样做,Eclipse自动部署了这些依赖项的内容,因此,我们获得了Tomcat服务器中的所有依赖项.

问题

  • 我的流程出了什么问题?
  • 我真的需要复制WEB-INF/lib目录中的所有依赖项吗?
  • 当我们想要使用Eclipse在Tomcat服务器上部署Web应用程序时,正常的过程是什么?

以下是运行后Eclipse配置文件的摘录mvn eclipse:eclipse:

的.classpath

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src/main/java"/>
    <classpathentry excluding="**/*.java" kind="src" path="src/main/resources"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="var" path="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0.jar" sourcepath="M2_REPO/aopalliance/aopalliance/1.0/aopalliance-1.0-sources.jar"/>
    <classpathentry kind="var" path="M2_REPO/asm/asm/2.2.2/asm-2.2.2.jar" sourcepath="M2_REPO/asm/asm/2.2.2/asm-2.2.2-sources.jar"/>
    <classpathentry kind="src" …
Run Code Online (Sandbox Code Playgroud)

eclipse tomcat eclipse-wtp maven

6
推荐指数
1
解决办法
4427
查看次数

运行Tomcat + Spring + Maven项目(Eclipse)时出现NoClassDefFoundError

我得到的是:

java.lang.NoClassDefFoundError: com/mongodb/DB
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethods(Class.java:1791)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:446)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:430)
at org.springframework.util.ReflectionUtils.getAllDeclaredMethods(ReflectionUtils.java:475)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:634)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:573)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1319)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:315)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeansOfType(DefaultListableBeanFactory.java:394)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:594)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:407)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4420)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4733)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Run Code Online (Sandbox Code Playgroud)

这个类在maven jar里面(来自M2存储库).我将Maven Dependencies添加到DeploymentAssembly(在我做之前我得到了:java.lang.ClassNotFoundException:org.springframework.web.filter.CharacterEncodingFilter).我使用m2e插件并将我的项目配置为Maven项目.我的应用程序部署到标准位置/.metadata/.plugins/.../tmp0.在WEB-INF/lib里面我有所有必要的罐子.项目编译没有错误.我该怎么办? …

eclipse spring tomcat noclassdeffounderror maven

2
推荐指数
1
解决办法
7491
查看次数