Eclipse:错误启动静态资源java.lang.IllegalArgumentException

我的
Eclipse IDE中有一个名为myproject2的项目.我有一个Tomcat应用程序服务器,我可以在那里添加资源myproject2(它是一个Spring MVC项目).

现在我关闭了Eclipse中的myproject2,从Tomcat资源中删除了myproject2并使用projectname:myproject3进行了新的Subversion结帐.

重新启动IDE我想将myproject3设置为Tomcat服务器,因此应该部署它.但所有可用的是myproject2可供选择.所以我选择它.我可以访问http://localhost:8080/myproject2/,但我收到此警告并在控制台中提供:

14.12.2010 11:43:11 org.apache.catalina.startup.HostConfig deployDescriptor
WARNING: A docBase C:\Spring\apache-tomcat-6.0.29-windows-x86\apache-tomcat-6.0.29\webapps\myproject2 inside the host appBase has been specified, and will be ignored
14.12.2010 11:43:11 org.apache.catalina.core.StandardContext resourcesStart
SERVE: Error starting static Resources
java.lang.IllegalArgumentException: Document base C:\Spring\apache-tomcat-6.0.29-windows-x86\apache-tomcat-6.0.29\webapps\myproject3 does not exist or is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:142)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4249)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4418)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
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)
14.12.2010 11:43:11 org.apache.catalina.core.StandardContext start
SERVE: Error in resourceStart()
14.12.2010 11:43:11 org.apache.catalina.core.StandardContext start
SERVE: Error getConfigured
14.12.2010 11:43:11 org.apache.catalina.core.StandardContext start
SERVE: Context [/myproject3] startup failed due to previous errors
14.12.2010 11:43:11 org.apache.catalina.core.StandardContext stop
INFO: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/myproject3] has not been started

那么这里有什么问题?为什么我没有myproject3来选择应该在Tomcat中部署的内容?

有人知道吗?

最好的祝福.

更新:

.project(myproject2):

<projectDescription>
    <name>myproject</name>
    <comment>My-Project. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
    <projects/>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
</projectDescription>

.project(myproject3)

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>myproject</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.wst.common.project.facet.core.builder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.wst.validation.validationbuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.maven.ide.eclipse.maven2Builder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
         <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
         <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
         <nature>org.maven.ide.eclipse.maven2Nature</nature>
         <nature>org.eclipse.jdt.core.javanature</nature>
         <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
         <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
    </natures>
</projectDescription>

最佳答案 您是使用Eclipse WTP和Tomcat服务器集成来部署应用程序,还是创建WAR并将其部署到Tomcat?

如果您正在使用集成,那么您可以尝试创建一个WAR并自己部署它,然后查看会发生什么.发布更新 – 我会跟进.

我再次阅读了你原来的问题.也许问题在于您创建myproject3的方式.我怀疑Eclipse没有必要的项目性质来部署到服务器. (“项目性质”是一个Eclipse概念;一个项目可以有几个; Eclipse的不同部分检查项目性质以确定它们可以作用的项目.)你说你从Subversion检查了代码并在一个项目中创建了项目步.这并不一定能创造出合适的项目类型. Eclipse的J2EE部署机制只允许您部署具有特定项目性质的项目 – 我认为它是“eclipse.common.project.facet.core.nature”.此外,您的项目需要某些Eclipse构建器才能生效;我认为“org.eclipse.wst.common.project.facet.core.builder”就是其中之一.

项目根目录下的.project文件是配置自然和构建器的位置.您应该检查两个项目中的那些文件.

问:在Eclipse工作区中,myproject2 / .project和myproject3 / .project是否有明显不同(名称除外)?在这里发布差异.

问:SVN中的myproject2是否包含.project文件?

回答这些问题应该告诉你更多.您可能需要仔细检查一步检出和创建项目的不同选项.

点赞