开发者

Eclipse: Error starting static Resources java.lang.IllegalArgumentException

开发者 https://www.devze.com 2023-01-30 06:09 出处:网络
I have a project called myproject2 in my Eclipse IDE. I have a Tomcat application server and I can add there the resource myproject2 (it is a Spring MVC project).

I have a project called myproject2 in my Eclipse IDE. I have a Tomcat application server and I can add there the resource myproject2 (it is a Spring MVC project).

Now I closed the myproject2 in Eclipse, removed myproject2 from the Tomcat resources and do a fresh Subversion checkout with projectname: myproject3.

REstarting the IDE I want to set myproject3 to the Tomcat server so this should be deployed. But all what is available is myproject2 to choose. So I choose it. I can access http://localhost:8080/myproject2/ but I get this warning and serve in the console:

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.Co开发者_如何学PythonntainerBase.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

So what's wrong here? Why don't I have a myproject3 to choose what should be deployed in Tomcat?

Does anyone know?

Best Regards.


Update:

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


Are you using the Eclipse WTP and Tomcat-server integration to deploy your app, or are you creating a WAR and deploying it to Tomcat yourself?

If you're using the integration, you might try creating a WAR and deploying it yourself, next, to see what happens. Post an update - I'll follow up after.


I've read your original question again. Maybe the problem is with the way you created myproject3. I suspect doesn't have the necessary project nature to be deployed to a server by Eclipse. ("Project nature" is an Eclipse concept; a project can have several of them; different parts of Eclipse check project natures to determine what projects they can act on.) You said you checked out the code from Subversion and created the project in one step. That doesn't necessarily create the right type of project. Eclipse's J2EE deployment mechanism only allows you to deploy projects with a certain project nature - I think it's "eclipse.common.project.facet.core.nature". Also, your project needs certain Eclipse builders to be viable; I think "org.eclipse.wst.common.project.facet.core.builder" is one of them.

The .project file at the root of your project is where natures and builders are configured. You should examine those files in your two projects.

Q: in your Eclipse workspace, are myproject2/.project and myproject3/.project significantly different (besides the name)? Post the differences here.

Q: does myproject2, in SVN, contain the .project file?

Answering those questions should tell you more. You may want to carefully examine the different options for checking out and creating a project in a single step.


I searched a few days for it, but I did not find a solution. So I reinstalled everything and set it up from a new project.


I think Ladlestein is certainly on the right track but I can add a bit more context to this problem in the way that I was able to reproduce it:

I have a similar Eclipse (Indigo) set up whereby I have a Maven project and use the Eclipse WTP feature to deploy to an embedded Tomcat 7 server. It all works fine if I import the project as a Maven project from within Eclipse but my issue occurs when I perform a mvn eclipse:clean and mvn eclipse:eclipse from the command line. This of course rebuilds the Eclipse .project file but leaves it without some apparently important Natures and buildCommands.

I observe a .project file very similar to the erroneous one in the question (in myproject2) and within Eclipse itself the project is no longer what Eclipse calls a "Dynamic Web Module" - hence not deployable - nor is it any longer a Maven project. I was able to fix this as follows:

Firstly make it a Maven project by adding the following to the .project file (I don't know if there is a better way through Eclipse itself):

<buildSpec>
    ...
    ...
    <buildCommand>
        <name>org.eclipse.m2e.core.maven2Builder</name>
    </buildCommand>
</buildSpec>

<natures>
    ...
    ...
    <nature>org.eclipse.m2e.core.maven2Nature</nature> 
</natures>

Now you can ensure the project is up to date by right clicking on the project and running Maven > Update Project Configuration....

Next you can make the project deployable through Properties > Project Facets > Dynamic Web Module (checkbox). Here is a more complete set of instructions for making your project a Dynamic Web Module.

In the end your .project file should look more like this:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>project1</name>
    <comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
    <projects>
    </projects>
    <buildSpec>
        <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.m2e.core.maven2Builder</name>
            <arguments>
            </arguments>
        </buildCommand>
        <buildCommand>
            <name>org.eclipse.wst.validation.validationbuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.jdt.core.javanature</nature>
        <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
        <nature>org.eclipse.m2e.core.maven2Nature</nature>
        <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
    </natures>
</projectDescription>


This happens because the project was run before using that server or was configured using that server. Hence its path is stored in a folder inside your tomcat directory.

In you tomcat folder, go to conf\Catalina\localhost\

In this folder, delete the xml file that corresponds to your project.

Alternatively, remove the server and add it again.


I'd similar problem(with eclipse & tomcat7 & WTP) & I solved it by manually editing eclipse_workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmpX\server.xml where tmpX is temporary folder which caches projects publish settings.


This problem will be resolved only by creating a new project.


I'd similar problem(with eclipse & tomcat7 & WTP). Solved it by removing (commenting out ) the following line from %CATALINA_HOME%/conf/server.xml

Context docBase="[CATALINA_HOME]\webapps\\ROOT" path="" reloadable="false"/>


Solve my problem. I just copy the .project file from another runnable web project and modify the project name attribute


I faced the same problem. What did a trick for me, in the overview of server (double-click on your server in servers tab) I had to set the deploy path to "MY_SERVER_PATH\webapps" .Hope it will be helpful .

Thanks :-)


Removing the server instance from my IDE and adding it back solved my problem.


In my situation I did the following two steps and the error went away:

1 - right click on project > properties > project facets > runtime I removed the web server then applied. added it back again then applied

2 - restarting the IDE

Awkwardly worked for me.


Issue Resolved!! Simply Delete your Server Instance and start with a new Server.

0

精彩评论

暂无评论...
验证码 换一张
取 消