problem running local tomcat configuration 关注
I would like to debug a large Tomcat-based application in IntelliJ IDEA, using
'Local Tomcat' configuration; however, I can't get it to work.
I have a Tomcat installation with my application already
deployed (in webapps) and it works fine (I can start it with
catalina.sh start from command line). Remote debugging of
that installation (with catalina.sh jpda start) works fine as well.
However, when I configure a local Tomcat in IntelliJ IDEA, using
my installation as the Tomcat server, the Tomcat starts, but
then it can't initialize a database resource in JNDI and
the application does not work.
What IntelliJ IDEA does when I tell it to run the local session is the following:
- it creates a Tomcat base directory $HOME/.IntelliJIdeaXX/system/tomcat_XXX
which contains conf, work, temp, and logs. The conf seems to be copied
from $CATALINA_HOME with the following modifications:
1. conf/server.xml: Host's appBase points to the original webapps
2. conf/Catalina/localhost/ROOT.xml: Context's docBase points
to the exploded directory of the web module (my project is
setup so that the content of the exploded directory is the
same as the webapps directory of a working installation, plus
the WEB-INF directory created by IntelliJ IDEA with classes and libraries
belonging to my module--supposedly these override the classes
already present in the jar)
- it then starts Tomcat with CATALINA_BASE pointing to that base directory,
and I get a dead Tomcat instance.
I did some experiments and discovered the following:
If I run Tomcat manually from the command line with
CATALINA_BASE pointing to the base directory as created by IntelliJ IDEA,
I get the same error I get as when I run from within IntelliJ IDEA.
My application starts running fine from the command line
with CATALINA_BASE pointing to the base directory created by IntelliJ IDEA
if I do the following modifications to the base directory:
- change conf/server.xml so Host's appBase points to the exploded
- delete the work subdirectory
(I also discovered that Tomcat doesn't like appBase to point
to the original webapps in CATALINA_HOME for some reason when
run with different CATALINA_BASE.)
Does this make any sense to Tomcat gurus out there?
Any ideas how I can tweak IntelliJ IDEA setup to make this work?
I am using Tomcat 5.5.17; IntelliJ IDEA 7.0M1b (6.0 didn't work
either), and I am trying to debug a project based on Liferay Portal 4.2.2
with minor customizations.
have you managed to do this ? I am very interested because I've got the same problem...
Please also have a look at https://youtrack.jetbrains.com/issue/IDEA-161286