Web-Project META-INF/context.xml in Tomcat 5.5

Hello!

I have problems running Tomcat in IntelliJ using the web-application META-INF/context.xml
When I copy the WAR-file from %PROJECT_HOME%/out/Web.war to %CATALINA_HOME%/webapps and running standalone, it works!
I searched and found some threads with the same topic, but don't find an answer :(

Any help, advice, anything?

Using:
- IntelliJ IDEA 7.0.2 (#7590)
- Apache Jakarta Tomcat 5.5.25

Tomcat Standalone creates:
- Manual copy from %PROJECT_HOME%/out/Web.war to %CATALINA_HOME%/webapps/Web.war
- %CATALINA_HOME% = C:\Java\bin\apache-tomcat-5.5.25
- %CATALINA_HOME%/webapps/Web/* (extract from Web.jar)
- %CATALINA_HOME%/conf/Catalina/localhost/Web.xml (1:1 to META-INF/context.xml)
- %CATALINA_HOME%/work/Catalina/localhost/Web/* (temp files and directories)

Tomcat IntelliJ creates:
- Automatic copy from %PROJECT_HOME%/out/Web.war to %CATALINA_HOME%/webapps/ROOT
- %CATALINA_BASE% = %HOME%/.IntelliJIdea70/system/tomcat_Unnamed_Galleryc9249198
- %CATALINA_BASE%/conf/server.xml (IntelliJ server.xml)
- %CATALINA_BASE%/conf/Catalina/localhost/ROOT.xml (IntelliJ context.xml ==> ROOT.xml)
- %CATALINA_BASE%/work/Catalina/localhost/_/* (temp files and directories)

=== Project META-INF/context.xml ===
=== IntelliJ conf/server.xml === === IntelliJ conf/Catalina/localhost/ROOT.xml === ]]>

=== Tomcat Standalone Log ===
30.01.2008 18:35:46 org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
30.01.2008 18:35:46 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 359 ms
30.01.2008 18:35:46 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
30.01.2008 18:35:46 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.25
30.01.2008 18:35:46 org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
30.01.2008 18:35:46 org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive Web.war
30.01.2008 18:35:48 org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
30.01.2008 18:35:48 org.apache.catalina.startup.Catalina start
INFO: Server startup in 1953 ms

=== Tomcat IntelliJ Log ===
30.01.2008 18:50:36 org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
30.01.2008 18:50:36 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 375 ms
30.01.2008 18:50:36 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
30.01.2008 18:50:36 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.25
30.01.2008 18:50:36 org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
30.01.2008 18:50:38 org.apache.coyote.http11.Http11BaseProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
30.01.2008 18:50:38 org.apache.catalina.startup.Catalina start
INFO: Server startup in 2032 ms

6 comments
Comment actions Permalink

Yesterday, I was tired cause I tryed to get META-INF/context.xml in IntelliJ to work... so my description was not very detailed.

When I'm running Tomcat standalone, everything is fine.
Tomcat extracts the WAR-file and using the META-INF/context.xml (copies to %CATALINA_HOME%/conf/Catalina/localhost/<WAR-file-name>.xml).
But I must copy the WAR-file every time when I build my project :(
Probably I could create a Ant-build-script or something to automate the process, but the IDE should do it by itself, without manual scripting.

When I'm using IntelliJ and running Tomcat inside, IntelliJ/Tomcat doesn't use META-INF/context.xml (<WAR-file-name>.xml)).
IntelliJ has ONLY it's own very small server.xml and context.xml (ROOT.xml).
In the past, there are several quirks/bypasses/tricks to don't use these two IntelliJ-created files:
- Overwrite environment variable CATALINA_BASE to the same as in CATALINA_HOME
But this quirk doesn't work anymore in the 7.x branch :(

So, what to do?
How can I use META-INF/context.xml in IntelliJ?

Heeelp! ;)

0
Comment actions Permalink

Is context.xml registered in Web Facet settings -> Deployment descriptors?

Yesterday, I was tired cause I tryed to get META-INF/context.xml in IntelliJ to work... so my description was not very detailed.

When I'm running Tomcat standalone, everything is fine.
Tomcat extracts the WAR-file and using the META-INF/context.xml (copies to %CATALINA_HOME%/conf/Catalina/localhost/<WAR-file-name>.xml).
But I must copy the WAR-file every time when I build my project :(
Probably I could create a Ant-build-script or something to automate the process, but the IDE should do it by itself, without manual scripting.

When I'm using IntelliJ and running Tomcat inside, IntelliJ/Tomcat doesn't use META-INF/context.xml (<WAR-file-name>.xml)).
IntelliJ has ONLY it's own very small server.xml and context.xml (ROOT.xml).
In the past, there are several quirks/bypasses/tricks to don't use these two IntelliJ-created files:
- Overwrite environment variable CATALINA_BASE to the same as in CATALINA_HOME
But this quirk doesn't work anymore in the 7.x branch :(

So, what to do?
How can I use META-INF/context.xml in IntelliJ?

Heeelp! ;)



--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

I don't know if this is right... I attached a screenshot.
I created the context.xml in the "Deployment descriptors" --> "Add"
I haven't had the context.xml before, it was created after clicking on the "Add" button



Attachment(s):
web-facet.gif
0
Comment actions Permalink

Are you using war-file as a deployment source in Tomcat run
configuration? If that's the case try to change "Deployment source" in
the run configuration to "exploded".

I don't know if this is right... I attached a screenshot.
I created the context.xml in the "Deployment descriptors" --> "Add"
I haven't had the context.xml before, it was created after clicking on the "Add" button


------------------------------------------------------------------------



--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

0
Comment actions Permalink

Oh... I had a similiar configuration and it didn't work. Strange!
Now, it's working.

IntelliJ creates these two files, too, but also puts the content of the META-INF/context.xml inside of ROOT.xml

Thank you!

0
Comment actions Permalink

Nikolay,

thanks for comment: changing from "war" to "exploded" also solved my problem with the same issue (Intellij Idea 7.0.4).

Just out of curiosity : Is this a bug in Idea or what's the reason why the context.xml obviously misses the ]]> when deployed to Tomcat in a war file?

Regards,
Alex

0

Please sign in to leave a comment.