JSP debug with Tomcat HOWTO

Hello,

Here's a brief description of how to configure JSP source-level debugging
with Tomcat.

1. First create a WebApp run configuration in "File | Project Properties |
Run/Debug"

2. The parameters available:
- WebApplication: a web application to be debugged. The combobox contains
a list of applications that are configured in "Project Properties | Web"
- ApplicationServer: a server to be used to debug the web application
(currently only Tomcat server is available)
- debuggee host: a host at which the app server runs (for Tomcat this is
"localhost" and the field is not editable)
- debuggee port: a port at which the debuggee will listen to the
connection from a debugger

Tomcat-specific options:
- Catalina home: the home directory where the Tomcat is installed
- Path to Catalina configs: a directory where all Tomcat configuration
files can be found (server.xml, web.xml etc), defaults to
"CATALINA_HOME/config"
- Application context path: a context path to be used for the debugged
web application (IDEA suggests to choose one of the paths configured in the
server.xml)
- VM parameters: additional VM parameters to be used when starting Tomcat
- Include project classpath: if checked, the project classpath will be
exposed to Tomcat, otherwise Tomcat searches for the classes in the default
locations

When the WebApp configuration is started, IDEA starts Tomcat and configures
it to run the WebApplication specified in the run configuration. All
breakpoints set in JSP files should work as well as expression evaluation
and value tooltips.

Any questions and bugreports are welcome.

--

Best regards,
Eugene Zhuravlev
JetBrains, Inc, http://www.intellij.com
"Develop with pleasure!"


22 comments
Comment actions Permalink

- Application context path: a context path to be used for the debugged
web application (IDEA suggests to choose one of the paths configured in

the

server.xml)


I only have one context configured which is / (""), or the root of the
server. When I click on the ... for context paths, I get only an empty drop
down box with a single line through it. -


So I just leave the field
blank.

But, when I start up IDEA, I get an error, saying I need to configure the
context path.

How can I debug an application in the root context?

Ian.


0
Comment actions Permalink

Hi Ian,

Looks like you are using outdated build. This has been fixed in 644.

--

Best regards,
Eugene Zhuravlev
JetBrains, Inc, http://www.intellij.com
"Develop with pleasure!"

"Ian Zabel" <izabel@cirqit.com> wrote in message
news:al7v49$mlv$1@is.intellij.net...

- Application context path: a context path to be used for the

debugged

web application (IDEA suggests to choose one of the paths configured in

the

server.xml)

>

I only have one context configured which is / (""), or the root of the
server. When I click on the ... for context paths, I get only an empty

drop

down box with a single line through it. -------- So I just leave the field
blank.

>

But, when I start up IDEA, I get an error, saying I need to configure the
context path.

>

How can I debug an application in the root context?

>

Ian.

>
>


0
Comment actions Permalink

Hi I have build 644 and it will not recognize my root context? i.e. it does not show context if I click on the elipse, only my other two contexts which are the standard /manager and /examples

build 644 1.4.1 JDK win2k

Andy

0
Comment actions Permalink

This should work in the latest build (648 currently). Please try it

0
Comment actions Permalink

I am unable to get IntelliJ to stop in the JSP. I also cannot get IntelliJ to compile the JSP (maybe there is a relation). I am able to stop in the class file after launching Tomcat 4.04 through IntelliJ.

The error I get is:
This absoute uri (http://taglibserver/tag.jar) cannot be resolved in either web.xml or the jar files deployed with this application

The tag.jar file is in my project classpath.

Thanks.

-Ross

0
Comment actions Permalink

We'll check the problem, thanks!

--

Best regards,
Eugene Zhuravlev
JetBrains, Inc, http://www.intellij.com
"Develop with pleasure!"

"Ross L. Owen" <ross.owen@octanner.com> wrote in message
news:2081597.1032910946628.JavaMail.jrun@is.intellij.net...

I am unable to get IntelliJ to stop in the JSP. I also cannot get

IntelliJ to compile the JSP (maybe there is a relation). I am able to stop
in the class file after launching Tomcat 4.04 through IntelliJ.
>

The error I get is:
This absoute uri (http://taglibserver/tag.jar) cannot be resolved in

either web.xml or the jar files deployed with this application
>

The tag.jar file is in my project classpath.

>

Thanks.

>

-Ross



0
Comment actions Permalink

Where can I get tomcat configuration files?

I'm using build 662. I extracted tomcatIntegration.jar and put it under the plugins directory. But when I try to run a web application I get a message about an internal IDEA error.

I don't know where should I get Tomcat's server.conf and web.xml files from.

Thanks,

--Amos

0
Comment actions Permalink

Hi Amos,

Could you please post the stacktrace of the internal error?
For Tomcat configuration issues please read tomcat documentation.

--

Best regards,
Eugene Zhuravlev
JetBrains, Inc, http://www.intellij.com
"Develop with pleasure!"


"Amos Shapira" <jiveadmin@intellij.net> wrote in message
news:6602014.1035294497728.JavaMail.jrun@is.intellij.net...

Where can I get tomcat configuration files?

>

I'm using build 662. I extracted tomcatIntegration.jar and put it under

the plugins directory. But when I try to run a web application I get a
message about an internal IDEA error.
>

I don't know where should I get Tomcat's server.conf and web.xml files

from.
>

Thanks,

>

--Amos

>


0
Comment actions Permalink

There is no stack trace, just a warning message.

Meanwhile, I downloaded Tomcat 4.0.6 from the Jakarta site and copied over its entire conf/ directory. I also added a web application tag for my application, like this:

]]>

Where "W:\site" is the parent directory for WEB-INF.

But now I get:

java.lang.NoClassDefFoundError: org/apache/catalina/startup/Bootstrap
Exception in thread "main"

Where is the official documentation which describes how to make it work?

Thanks,

--Amos

0
Comment actions Permalink

You should install tomcat plugin and configure webApp run configuration in
Run/Debug configurations.
Please check our help and this newsgroup for reference.

--

Best regards,
Eugene Zhuravlev
JetBrains, Inc, http://www.intellij.com
"Develop with pleasure!"


"Amos Shapira" <jiveadmin@intellij.net> wrote in message
news:4014142.1035297438395.JavaMail.jrun@is.intellij.net...

There is no stack trace, just a warning message.

>

Meanwhile, I downloaded Tomcat 4.0.6 from the Jakarta site and copied over

its entire conf/ directory. I also added a web application tag for my
application, like this:
>

<Context path="/providercenter" docBase="W:\site" debug="1"

privileged="true"/>
>

Where "W:\site" is the parent directory for WEB-INF.

>

But now I get:

>

java.lang.NoClassDefFoundError: org/apache/catalina/startup/Bootstrap
Exception in thread "main"

>

Where is the official documentation which describes how to make it work?

>

Thanks,

>

--Amos

>


0
Comment actions Permalink

I've done that already.

Installed the plugin as per an explenation I found in this forum. Configured the Run/Debug in the Project Properties as much as I could understand.

Looking up info in the help didn't find anything (not having a searchable index doesn't help here).

Maybe a sample tomcat server.xml file would help?

Thanks,

--Amos

0
Comment actions Permalink

Amos Shapira wrote:

There is no stack trace, just a warning message.

Meanwhile, I downloaded Tomcat 4.0.6 from the Jakarta site and copied over its entire conf/ directory. I also added a web application tag for my application, like this:

<Context path="/providercenter" docBase="W:\site" debug="1" privileged="true"/>

Where "W:\site" is the parent directory for WEB-INF.

But now I get:

java.lang.NoClassDefFoundError: org/apache/catalina/startup/Bootstrap
Exception in thread "main"

Where is the official documentation which describes how to make it work?

Thanks,

--Amos



I have the same effect. It worked with 657 as it is documented, but does
not work with 662. You have to place %CATALINA_HOME%/bin/bootstrap.jar
into your projects classpath. I do not know wht the difference is between
run and debug. Do not forget to check include project classpath.
run works without bootstrap.jar, debug does not.

Stefan

0
Comment actions Permalink

Hello Stefan,

Please check that WebApp run configuration for Tomcat is set up properly.
There should be a path to catalina home.
Looks like the paths specified is wrong, because the bootstrap.jar is
searched at <catalina-home>/bin/ directory.
Everything works ok here.
BTW, there's build 663 already available, please check it out.

--

Best regards,
Eugene Zhuravlev
JetBrains, Inc, http://www.intellij.com
"Develop with pleasure!"


"Stefan Mainz" <Stefan.Mainz@Dynaware.de> wrote in message
news:ap5mkn$jvg$1@is.intellij.net...

Amos Shapira wrote:

There is no stack trace, just a warning message.

>

Meanwhile, I downloaded Tomcat 4.0.6 from the Jakarta site and copied

over its entire conf/ directory. I also added a web application tag for my
application, like this:

>

<Context path="/providercenter" docBase="W:\site" debug="1"

privileged="true"/>

>

Where "W:\site" is the parent directory for WEB-INF.

>

But now I get:

>

java.lang.NoClassDefFoundError: org/apache/catalina/startup/Bootstrap
Exception in thread "main"

>

Where is the official documentation which describes how to make it work?

>

Thanks,

>

--Amos

>

>
>

I have the same effect. It worked with 657 as it is documented, but does
not work with 662. You have to place %CATALINA_HOME%/bin/bootstrap.jar
into your projects classpath. I do not know wht the difference is between
run and debug. Do not forget to check include project classpath.
run works without bootstrap.jar, debug does not.

>

Stefan

>


0
Comment actions Permalink

Hi Eugene,

i am pretty sure that the CATALINA_PATH is configured correctly. It worked in
657 both with run and debug and it works in 662 with run, but not debug.
Adding bootstrap.jar to the project classpath solved the problem for
debugging.

I have not checked with 663.

Stefan

Eugene Zhuravlev wrote:

Hello Stefan,

Please check that WebApp run configuration for Tomcat is set up properly.
There should be a path to catalina home.
Looks like the paths specified is wrong, because the bootstrap.jar is
searched at <catalina-home>/bin/ directory.
Everything works ok here.
BTW, there's build 663 already available, please check it out.

--

Best regards,
Eugene Zhuravlev
JetBrains, Inc, http://www.intellij.com
"Develop with pleasure!"


"Stefan Mainz" <Stefan.Mainz@Dynaware.de> wrote in message
news:ap5mkn$jvg$1@is.intellij.net...

>>Amos Shapira wrote:
>>
>>>There is no stack trace, just a warning message.
>>>
>>>Meanwhile, I downloaded Tomcat 4.0.6 from the Jakarta site and copied
>>

over its entire conf/ directory. I also added a web application tag for my
application, like this:

>>>>]]>

privileged="true"/>

>>>Where "W:\site" is the parent directory for WEB-INF.
>>>
>>>But now I get:
>>>
>>>java.lang.NoClassDefFoundError: org/apache/catalina/startup/Bootstrap
>>>Exception in thread "main"
>>>
>>>Where is the official documentation which describes how to make it work?
>>>
>>>Thanks,
>>>
>>>--Amos
>>>
>>
>>
>>I have the same effect. It worked with 657 as it is documented, but does
>>not work with 662. You have to place %CATALINA_HOME%/bin/bootstrap.jar
>>into your projects classpath. I do not know wht the difference is between
>>run and debug. Do not forget to check include project classpath.
>>run works without bootstrap.jar, debug does not.
>>
>>Stefan
>>



0
Comment actions Permalink

Thank you all for your input.

It turned out that I haven't configured the Tomcat config directory correctly, should have pointed to Tomcat Home (wherever I opened its zip file) and not to IDEA home.

I now can run and debug a web application under IntelliJ. (but the application bombs due to other configuration problems, not related to IDEA).

I'm still a bit confused about how IntelliJ copies over the config files, and whether I can provide a per-project "server.xml" file.

--Amos

0
Comment actions Permalink

Hi,

When i selected "Application server" my select is empty. I can't selected anything. why ?

Regards,

0
Comment actions Permalink

I do not often reply to myself, but sometimes this proves necessary:
Not having a Space in the path where you installed tomcat (this is CATILINA_HOME)
helps a lot.

Here is a short guide of how to set up tomcat with IDEA:

1) Extract %IDEA_HOME%/tomcatIntegation_plugin/tomcatIntegration.zip
and copy tomcatIntegration.jar to %IDEA_HOME%/plugins
2) Install Tomcat 4.0.6 (do not use tomcat 4.1.x, it will not work)
into a directory. Make sure the path to this directory does not contain
a space character. This is the directory which will be called CATALINA_HOME.
3) copy the files
%CATALINA_HOME%/conf/catalina.policy
%CATALINA_HOME%/conf/server.xml
%CATALINA_HOME%/conf/tomcat-users.xml
%CATALINA_HOME%/conf/web.xml
into a directory called tomcat-conf in your project directory.
4) Change the files mentioned above to fit your needs.
5) Start IDEA and open your project.
6) Configure a web application in Project Properties / Web
7) In Project Properties -> Run / Debug -> WebApp
create an new configuration called Tomcat. The to use are:
. Web application: The web application you configured in 6)
. Application Server: Choose Tomcat 4.0.x Server
. Debuggee host: localhost
. Debuggee port: leave at 5050
. Check Lauch server before start
. Catalina home: The directory you installed tomcat to.
. Path to Catilina configs: path to your project/tomcat-conf
(you did create in in step 3)
. Application context path: Choose one which is configured in
server.xml. The simples configuration which works for me
is: ]]>
. VM parameters: leave empty
. Check Include project classpath
8) OK

Now tomcat can be started for debugging.

Have fun Stefan


Stefan Mainz wrote:

Hi Eugene,

i am pretty sure that the CATALINA_PATH is configured correctly. It
worked in
657 both with run and debug and it works in 662 with run, but not debug.
Adding bootstrap.jar to the project classpath solved the problem for
debugging.

I have not checked with 663.

Stefan

Eugene Zhuravlev wrote:

>> Hello Stefan,
>>
>> Please check that WebApp run configuration for Tomcat is set up properly.
>> There should be a path to catalina home.
>> Looks like the paths specified is wrong, because the bootstrap.jar is
>> searched at /bin/ directory. >> Everything works ok here. >> BTW, there's build 663 already available, please check it out. >> >> -- >> >> Best regards, >> Eugene Zhuravlev >> JetBrains, Inc, http://www.intellij.com >> "Develop with pleasure!" >> >> >> "Stefan Mainz" wrote in message >> news:ap5mkn$jvg$1@is.intellij.net... >> >>> Amos Shapira wrote: >>> >>>> There is no stack trace, just a warning message. >>>> >>>> Meanwhile, I downloaded Tomcat 4.0.6 from the Jakarta site and copied >>> >>> >> over its entire conf/ directory. I also added a web application tag >> for my >> application, like this: >> >>>> >> >>> >> privileged="true"/> >> >>>> Where "W:\site" is the parent directory for WEB-INF. >>>> >>>> But now I get: >>>> >>>> java.lang.NoClassDefFoundError: org/apache/catalina/startup/Bootstrap >>>> Exception in thread "main" >>>> >>>> Where is the official documentation which describes how to make it >>>> work? >>>> >>>> Thanks, >>>> >>>> --Amos >>>> >>> >>> >>> I have the same effect. It worked with 657 as it is documented, but does >>> not work with 662. You have to place %CATALINA_HOME%/bin/bootstrap.jar >>> into your projects classpath. I do not know wht the difference is >>> between >>> run and debug. Do not forget to check include project classpath. >>> run works without bootstrap.jar, debug does not. >>> >>> Stefan >>> >> >> >>]]>


0
Comment actions Permalink

You should install tomcatIntegration plugin. Just copy tomcatIntegration.jar
to "plugins" directory

--

Best regards,
Eugene Zhuravlev
JetBrains, Inc, http://www.intellij.com
"Develop with pleasure!"


"Esteban" <etrigos@btobfactory.com> wrote in message
news:3816987.1035382751855.JavaMail.jrun@is.intellij.net...

Hi,

>

When i selected "Application server" my select is empty. I can't selected

anything. why ?
>

Regards,

>
>


0
Comment actions Permalink

On Wed, 4 Sep 2002 16:09:22 +0400, "Eugene Zhuravlev"
<jeka@intellij.com> wrote:

>
>Here's a brief description of how to configure JSP source-level debugging
>with Tomcat.

Hi,

This guide applies to which version of Tomcat ?

0
Comment actions Permalink

It applies to Tomcat 4.0.x versions

--

Best regards,
Eugene Zhuravlev
JetBrains, Inc, http://www.intellij.com
"Develop with pleasure!"


"Gabriel Augusto Monteiro" <nomail@hotmail.com> wrote in message
news:roodrugce6d711nl155sl2gntpa1g9okqd@4ax.com...

On Wed, 4 Sep 2002 16:09:22 +0400, "Eugene Zhuravlev"
<jeka@intellij.com> wrote:

>

>
>Here's a brief description of how to configure JSP source-level debugging
>with Tomcat.

>

Hi,

>

This guide applies to which version of Tomcat ?



0
Comment actions Permalink

I can't seem to get intelliJ to step into a jsp included page. It will break at a top level jsp page no problem, but how do I get it to debug the jsp referenced by, say, <jsp:include page="<%= another.jsp %>?

Using IntelliJ 9.0.2 Ultimate w/JDK 1.6.0_17 64 bit VM on Vista 7 64.

Thanks

0
Comment actions Permalink

Do you mean breakpoints in another.jsp doesn't work?

I can't seem to get intelliJ to step into a jsp included page. It will break at a top level jsp page no problem, but how do I get it to debug the jsp referenced by, say,<jsp:include page="<%= another.jsp %>?

>

Using IntelliJ 9.0.2 Ultimate w/JDK 1.6.0_17 64 bit VM on Vista 7 64.

>

Thanks

>

---
Original message URL: http://devnet.jetbrains.net/message/5269324#5269324



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

0

Please sign in to leave a comment.