SpringRoo项目无法在tomcat上部署

时间:2014-01-09 17:20:18

标签: maven tomcat spring-roo sts-springsourcetoolsuite springsource

我开始使用以下环境开发新项目:

  
      
  • Ubuntu 12.04
  •   
  • java版“1.6.0_27”
  •   
  • 适用于Web开发人员的Eclipse Java EE IDE。版本:Helios Service Release 1
  •   
  • SpringSource工具套件版本:2.9.2.RELEASE
  •   
  • tomcat 6(我可以启动,从Eclipse IDE停止)
  •   
  • PostgresSql数据库+ pgAdmin III
  •   

我按照预期的教程:

  
      
  • docs.spring.io/spring-roo/reference/html/beginning.html
  •   
  • docs.spring.io/spring-roo/reference/html/base-dbre.html
  •   

我设法创建了我的项目,并使用逆向工程流程生成所有Business Objects。 我还设法使用Web MVC流程创建了控制器对象。

我遇到的问题是我无法让我的项目在tomcat上运行。 我无法创建服务器并将项目添加到它:我右键单击服务器选项卡,New =>新服务器=>我选择tomcat 6 =>我检查运行时环境:链接到/ opt / tomcat6并使用workbench默认JRE按预期=>我点击Next按钮:然后我看不到我的项目进入列表。所以我无法将其添加到服务器 为了尝试其他方式,我将项目导出到位于/ opt / tomcat6的war文件中。当我更新war文件时,似乎我的应用程序在webapps上更新但是我认为war文件不正确,因为这里是它的内容:

-- log.roo
-- pom.xml
-- .settings/
-- src/ And here
-- ++ main/
-- ++ ** java/
-- ++ ** resources/
-- ++ ** webapp/
-- ++ ** -- images/
-- ++ ** -- styles/
-- ++ ** -- WEB-INF/
-- ++ ** -- ++ classes/
-- ++ ** -- ++ i18n/
-- ++ ** -- ++ layouts/
-- ++ ** -- ++ spring/
-- ++ ** -- ++ tags/
-- ++ ** -- ++ views/
-- ++ ** -- ++ web.xml

当我进入我的本地主机时:8080 / MyProject /,我有一个404错误...我认为根据目录内容... ... ...

从网上搜索,我对项目方面有所了解......我看到有人被告知右键点击项目的帖子=>配置=>转换为分面形式...

只要在“转换为分面形式......”结尾处有树点,我点击此菜单...实际上转换了项目-_-

我不知道这是一个额外的问题还是一件好事......但目前它并没有解决我的问题。

顺便说一下,我现在可以为我的项目选择facet ......但是哪一个???那是另一个问题......

还有一条线索:

在查看Eclipse的“Problems”选项卡时,我看到我有100次相同的错误:

Description Resource Path Location Type
javax.servlet cannot be resolved to a type category.tagx /MyProject/src/main/webapp/WEB-INF/tags/menu line 1 JSP Problem

但是,我的pom.xml中有以下内容:

<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.5</version>
    <scope>provided</scope>
</dependency>

在“错误日志”选项卡中,我也有以下错误(这与我的问题无关?): 错误项目facet grails.app尚未定义。它用于插件com.springsource.sts.server.tc.core。

我也有这条消息(这肯定与我的问题有关?):

Info build: Abort due to missing classpath/inpath/aspectpath entries
Info /MyProject : Project 'MyProject' is missing required source folder: 'src/test/resources'
Info /MyProject : Project 'MyProject' is missing required source folder: 'src/test/java'

这些文件夹是现有的...但我没有使用它们,所以我从构建路径管理窗口的“Sources”选项卡中删除它们。 它在“错误日志”选项卡中生成了很多错误。以下是一些可以帮助您帮助我的例子:

Error Problems occurred when invoking code from plug-in: "org.eclipse.jdt.core".
java.lang.NullPointerException: type must not be null
at org.eclipse.jst.ws.jaxws.utils.ContractChecker.nul lCheckParam(ContractChecker.java:40)
at org.eclipse.jst.ws.jaxws.utils.internal.annotation s.impl.AnnotationInspectorImpl.<init>(AnnotationIn spectorImpl.java:76)
at org.eclipse.jst.ws.jaxws.utils.annotations.Annotat ionFactory.createAnnotationInspector(AnnotationFac tory.java:350)
at org.eclipse.jst.ws.jaxws.dom.runtime.persistence.J axWsWorkspaceResource.newAnnotationInspector(JaxWs WorkspaceResource.java:206)
at org.eclipse.jst.ws.jaxws.dom.runtime.persistence.s ync.AbstractModelSynchronizer.processCompilationUn it(AbstractModelSynchronizer.java:115)
at org.eclipse.jst.ws.jaxws.dom.runtime.persistence.s ync.OnEventModelSynchronizer.handleAddedCompilatio nUnit(OnEventModelSynchronizer.java:354)
at org.eclipse.jst.ws.jaxws.dom.runtime.persistence.s ync.OnEventModelSynchronizer.recursevilyHandleComp ilationUnits(OnEventModelSynchronizer.java:278)
at org.eclipse.jst.ws.jaxws.dom.runtime.persistence.s ync.OnEventModelSynchronizer.recursevilyHandleComp ilationUnits(OnEventModelSynchronizer.java:302)
at org.eclipse.jst.ws.jaxws.dom.runtime.persistence.s ync.OnEventModelSynchronizer.recursevilyHandleComp ilationUnits(OnEventModelSynchronizer.java:302)
at org.eclipse.jst.ws.jaxws.dom.runtime.persistence.s ync.OnEventModelSynchronizer.handleChangedProject( OnEventModelSynchronizer.java:176)
at org.eclipse.jst.ws.jaxws.dom.runtime.persistence.s ync.OnEventModelSynchronizer.elementChanged(OnEven tModelSynchronizer.java:86)
at org.eclipse.jdt.internal.core.DeltaProcessor$3.run (DeltaProcessor.java:1557)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner .java:42)
at org.eclipse.jdt.internal.core.DeltaProcessor.notif yListeners(DeltaProcessor.java:1547)
at org.eclipse.jdt.internal.core.DeltaProcessor.fireP ostChangeDelta(DeltaProcessor.java:1381)
at org.eclipse.jdt.internal.core.DeltaProcessor.fire( DeltaProcessor.java:1357)
at org.eclipse.jdt.internal.core.JavaModelOperation.r un(JavaModelOperation.java:769)
at org.eclipse.core.internal.resources.Workspace.run( Workspace.java:1975)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:47 77)
at org.eclipse.jst.jsp.core.internal.validation.JSPBa tchValidator.validate(JSPBatchValidator.java:532)
at org.eclipse.wst.validation.Validator$V2.validate(V alidator.java:1159)
at org.eclipse.wst.validation.internal.ValManager.val idate(ValManager.java:704)
at org.eclipse.wst.validation.internal.ValBuilderJob$ Visitor.visit(ValBuilderJob.java:334)
at org.eclipse.core.internal.events.ResourceDelta.acc ept(ResourceDelta.java:68)
at org.eclipse.core.internal.events.ResourceDelta.acc ept(ResourceDelta.java:79)
at org.eclipse.core.internal.events.ResourceDelta.acc ept(ResourceDelta.java:48)
at org.eclipse.wst.validation.internal.ValBuilderJob. deltaBuild(ValBuilderJob.java:211)
at org.eclipse.wst.validation.internal.ValBuilderJob. run(ValBuilderJob.java:179)
at org.eclipse.wst.validation.internal.ValBuilderJob. runInWorkspace(ValBuilderJob.java:126)
at org.eclipse.core.internal.resources.InternalWorksp aceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.j ava:54)


Error Exception occurred in listener of Java element change notification
java.lang.NullPointerException: type must not be null
at org.eclipse.jst.ws.jaxws.utils.ContractChecker.nul lCheckParam(ContractChecker.java:40)
at org.eclipse.jst.ws.jaxws.utils.internal.annotation s.impl.AnnotationInspectorImpl.<init>(AnnotationIn spectorImpl.java:76)
at org.eclipse.jst.ws.jaxws.utils.annotations.Annotat ionFactory.createAnnotationInspector(AnnotationFac tory.java:350)
at org.eclipse.jst.ws.jaxws.dom.runtime.persistence.J axWsWorkspaceResource.newAnnotationInspector(JaxWs WorkspaceResource.java:206)
at org.eclipse.jst.ws.jaxws.dom.runtime.persistence.s ync.AbstractModelSynchronizer.processCompilationUn it(AbstractModelSynchronizer.java:115)
at org.eclipse.jst.ws.jaxws.dom.runtime.persistence.s ync.OnEventModelSynchronizer.handleAddedCompilatio nUnit(OnEventModelSynchronizer.java:354)
at org.eclipse.jst.ws.jaxws.dom.runtime.persistence.s ync.OnEventModelSynchronizer.recursevilyHandleComp ilationUnits(OnEventModelSynchronizer.java:278)
at org.eclipse.jst.ws.jaxws.dom.runtime.persistence.s ync.OnEventModelSynchronizer.recursevilyHandleComp ilationUnits(OnEventModelSynchronizer.java:302)
at org.eclipse.jst.ws.jaxws.dom.runtime.persistence.s ync.OnEventModelSynchronizer.recursevilyHandleComp ilationUnits(OnEventModelSynchronizer.java:302)
at org.eclipse.jst.ws.jaxws.dom.runtime.persistence.s ync.OnEventModelSynchronizer.handleChangedProject( OnEventModelSynchronizer.java:176)
at org.eclipse.jst.ws.jaxws.dom.runtime.persistence.s ync.OnEventModelSynchronizer.elementChanged(OnEven tModelSynchronizer.java:86)
at org.eclipse.jdt.internal.core.DeltaProcessor$3.run (DeltaProcessor.java:1557)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner .java:42)
at org.eclipse.jdt.internal.core.DeltaProcessor.notif yListeners(DeltaProcessor.java:1547)
at org.eclipse.jdt.internal.core.DeltaProcessor.fireP ostChangeDelta(DeltaProcessor.java:1381)
at org.eclipse.jdt.internal.core.DeltaProcessor.fire( DeltaProcessor.java:1357)
at org.eclipse.jdt.internal.core.JavaModelOperation.r un(JavaModelOperation.java:769)
at org.eclipse.core.internal.resources.Workspace.run( Workspace.java:1975)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:47 77)
at org.eclipse.jst.jsp.core.internal.validation.JSPBa tchValidator.validate(JSPBatchValidator.java:532)
at org.eclipse.wst.validation.Validator$V2.validate(V alidator.java:1159)
at org.eclipse.wst.validation.internal.ValManager.val idate(ValManager.java:704)
at org.eclipse.wst.validation.internal.ValBuilderJob$ Visitor.visit(ValBuilderJob.java:334)
at org.eclipse.core.internal.events.ResourceDelta.acc ept(ResourceDelta.java:68)
at org.eclipse.core.internal.events.ResourceDelta.acc ept(ResourceDelta.java:79)
at org.eclipse.core.internal.events.ResourceDelta.acc ept(ResourceDelta.java:48)
at org.eclipse.wst.validation.internal.ValBuilderJob. deltaBuild(ValBuilderJob.java:211)
at org.eclipse.wst.validation.internal.ValBuilderJob. run(ValBuilderJob.java:179)
at org.eclipse.wst.validation.internal.ValBuilderJob. runInWorkspace(ValBuilderJob.java:126)
at org.eclipse.core.internal.resources.InternalWorksp aceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.j ava:54)


Error File not found: '/MyProject/src/main/java/__2F_MyProject_2F_src_2F_main_2F_webapp_2F_WEB_2D_ INF_2F_tags_2F_form_2F_fields_2F_select_2E_tagx.ja va'
org.eclipse.core.internal.resources.ResourceExcept ion: Resource '/MyProject/src/main/java/__2F_MyProject_2F_src_2F_main_2F_webapp_2F_WEB_2D_ INF_2F_tags_2F_form_2F_fields_2F_select_2E_tagx.ja va' does not exist.
at org.eclipse.core.internal.resources.Resource.check Exists(Resource.java:326)
at org.eclipse.core.internal.resources.Resource.check Accessible(Resource.java:200)
at org.eclipse.core.internal.resources.File.getConten ts(File.java:291)
at org.eclipse.jdt.internal.core.util.Util.getResourc eContentsAsCharArray(Util.java:1186)
at org.eclipse.jdt.internal.core.CompilationUnit.getC ontents(CompilationUnit.java:649)
(...)
at org.eclipse.core.internal.events.ResourceDelta.acc ept(ResourceDelta.java:48)
at org.eclipse.wst.validation.internal.ValBuilderJob. deltaBuild(ValBuilderJob.java:211)
at org.eclipse.wst.validation.internal.ValBuilderJob. run(ValBuilderJob.java:179)
at org.eclipse.wst.validation.internal.ValBuilderJob. runInWorkspace(ValBuilderJob.java:126)
at org.eclipse.core.internal.resources.InternalWorksp aceJob.run(InternalWorkspaceJob.java:38)
at org.eclipse.core.internal.jobs.Worker.run(Worker.j ava:54)
  • 现在,我在“问题”标签中出现以下错误:

    描述资源路径位置类型 classpath错误:无法找到org.aspectj.lang.JoinPoint(检查aspectjrt.jar是否在您的类路径中)MyProject未知Java问题

但是,我的pom.xml中有预期的内容:

        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>${aspectj.version}</version>
        </dependency>

2 个答案:

答案 0 :(得分:0)

这似乎是一个Eclipse问题。尝试从头开始创建项目并使用Maven Tomcat插件运行:“mvn clean install tomcat:run”

答案 1 :(得分:0)

最终解决方案:

wiki.eclipse.org/WTP_Tomcat_FAQ#If_I_start_my_Tomcat_server_and_try_to_display_Tomcat.27s_default_page.2C_why_do_I_see_a_directory_listing_or_404_error_page.3F
    then
    wiki.eclipse.org/WTP_Tomcat_FAQ#What_configuration_option_determines_whether_the_Tomcat_server_uses_a_separate_instance_or_the_instance_from_the_Tomcat_installation.3F

在STS中,在“服务器”标签中,右键单击您的服务器=&gt;打开。

在“服务器位置”部分,您有一些单选按钮:

  • 使用工作区元数据(不修改Tomcat安装)
  • 使用Tomcat安装(控制Tomcat安装)
  • 使用自定义位置(不修改Tomcat安装)

在我的案例中选择了第一个,而不是第二个。 服务器路径通向我的工作区.metada目录(/xxx/.metadata/.plugins/org.eclipse.wst.server.core/tmp0)。 部署路径是“wtpwebapps”。

事实上,我的项目可能从一开始就有用......但我从未试图直接到达我的项目页面...试图首先到达根tomcat页面。这是一个错误......

如果你想让它发挥作用,试试这个:

  • 运行时关闭服务器
  • 从此服务器中删除所有项目
  • rigth点击它=&gt;开
  • 在“Servers location”部分中,选择“使用Tomcat安装(控制Tomcat安装)”
  • 更改服务器路径值(在我的情况下:“/ opt / tomcat6”)
  • 更改部署路径值(在我的情况下为“webapps”)
  • 将您的项目再次添加到服务器
  • 运行它

这有效!!!