IllegalArgumentException: The main resource set specified [ D:\ProjectName\Tomcat 9.0\webapps\api] is not valid
Hello every one,
I am getting crazy this couple of days.
- My Intellij IDEA has lost swaths (maybe all) its configuration settings since the last time I opened it on this project (the 2019/12/23)
After struggling to revert the loss of the "Runs configurations" or which folders are excluded, are source code, etc. I managed to make it run but the IDE was still an unproductive mess. I gave up and clone again the project in a new directory hoping Intellij would sort itself without my help. It kinda work, the Sping MVC project was recognized and things looked better.
So I start adding a new run configuration.
On a w10 machine, it's a multi pom modules Spring Web MVC project that I want to run on a local Tomcat. I have the _Tomcat 9.0_ folder next to my project at
D://ProjectName//Tomcat 9.0
and for example
D://ProjectName/project-root/.idea
D://ProjectName/project-root/pom.xml
D://ProjectName/project-root/module1/pom.xml
D://ProjectName/project-root/module2/src/...
etc.
I set up the CATALINA_HOME system env variable to D://ProjectName//Tomcat 9.0 (It's not taken into account by Intellij when I run the Tomcat, Intellij uses the Application Server settings to calculate a CATALINA_HOME value)
I set up the CATALINA_BASE but see this post, Intellij overrides it anyway.
I configured a Run/Debug Configuration with :
- Tomcat Application Server : pointing to D://ProjectName//Tomcat 9.0, 2 classes are added jsp-api.jar & servlet-api.jar,
- JRE 1.8 (default, JRE 1.8 or pointing to a correct location has not consequence so far),
- Deployment : I tried both to add modules artefact or to point directly with external source to module/target/module.war, no impact.
- Startup/Connection : I used Default or custom location to D://ProjectName//Tomcat 9.0//bin//catalina.bat run/stop with no consequences
I always got the error below :
27-Dec-2019 16:39:46.870 GRAVE [main] org.apache.catalina.startup.Catalina.start Le composant Server requis n'a pas démarré, en conséquence Tomcat ne peut démarrer.
org.apache.catalina.LifecycleException: Un conteneur fils a échoué pendant son démarrage
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:926)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:423)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:933)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.startup.Catalina.start(Catalina.java:637)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Un conteneur fils a échoué pendant son démarrage
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:914)
... 13 more
Caused by: org.apache.catalina.LifecycleException: Un conteneur fils a échoué pendant son démarrage
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:926)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1382)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1372)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:907)
... 13 more
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Echec de démarrage du composant [org.apache.catalina.webresources.StandardRoot@5ad851c9]
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:914)
... 21 more
Caused by: org.apache.catalina.LifecycleException: Echec de démarrage du composant [org.apache.catalina.webresources.StandardRoot@5ad851c9]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:441)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4778)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4913)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1382)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1372)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:907)
... 21 more
Caused by: java.lang.IllegalArgumentException: L'ensemble de ressources principal [D:\ProjectName\Tomcat 9.0\webapps\api] est invalide
at org.apache.catalina.webresources.StandardRoot.createMainResourceSet(StandardRoot.java:749)
at org.apache.catalina.webresources.StandardRoot.startInternal(StandardRoot.java:706)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
... 30 more
I create the webapps\api but no change.
What is happening ?
Why Intellij (running as admin) can't push the artefact to this folder ?
What the hell must I do to make a project that was running perfectly fine run again ?
Thank you in advance for solid help !
No I can't share the project, no it's not the code since Jenkins our CI platform build and runs this Git branch without issue
Please sign in to leave a comment.
You don't need to specify CATALINA_BASE or CATALINA_HOME for IntelliJ IDEA, it works out of the box using Tomcat configuration settings.
What's the artifact output directory? How did you configure the deployment in the run/debug configuration?
Can you run any hello world app on this Tomcat instance?
Please try to create a new default Tomcat installation without any modifications outside of the project directory. Configure this new Tomcat in IntelliJ IDEA. Can you run the same hello world project on this Tomcat instance? Can you run your real project on this new instance? Please change the locale so that the error messages are in English and we can understand them better.
Thanks for your reply. I will do this tomorrow and get back to you with results.
I see no -DoutputDirectory being passed or used in any pom => artefacts are output to the target directories when running mvn install (though I don't know what Intellij does with its builds)
> Deployment : I tried to add either artifacts (Intellij display artifact or external source) or as an external source to module-x/target/module-x.war, made no difference, both ways failed.
See https://www.jetbrains.com/help/idea/artifacts.html. The directory is specified there.
Do you have a repo to such an app ? Is it a Spring MVC, Spring Boot, JavaEE ?
https://www.mkyong.com/intellij/intellij-idea-run-debug-web-application-on-tomcat/
Ok, so I confirm it's the target directory (and apparently target\project_related_name_Intellij_took_from_somewhere\ for exploded war). Looks fine to me.
Yes I got all this right.
I will try to make a Spring MVC application tomorrow and run it on the same current Tomcat instance.
I have tried to make current project run on a C://ProgramsFiles/Apache/Tomcat 9.0 instance but same error.
See https://stackoverflow.com/a/56051875/104891 .
Might be wrong conf/server.xml configuration. Try the new unmodified Tomcat installation and a new web app.
Hello,
Finally got the time to get back to the subject after the holidays :)
I installed a fresh Tomcat instance. To get it to work (SSL connector not defined) I stupidly copied my old server.xml and oh who would have guessed, I met the same issue.
Indeed, there was a Eclipse configuration in the server.xml : Server > Service > Engine > Host > Context :
<Context docBase="api" path="/project-name" reloadable="true" source="org.eclipse.jst.jee.server:api"/>
This threw the catalina out of its tracks.
Removing the line solved the issue.
Debriefing my ordeal :
I appreciate the Intellij IDEA support, thanks for your help !