debugging/running with Tomcat 4.1.12

Hi,

I have recently started trying out IDEA's web support. I must say that I am rather disappointed about the difficulty to set it up (havent been able to use it yet, see below). The docs are very meager in this area - mostly pictures, which only duplicate the GUI.

First, I did not find any mentioning that I am required to install tomcat prior to using the web support. Anyway, I went ahead and installed it - just to find out, that the plugins will not work with the current stable version of tomcat (4.1.12). There is a small hint that this is so, because the plugin specifies "4.0.x", but this is nothing more than a hint. IMO, it should be made explicit that it is THIS version that needs to be installed.

The "launch server before debuggee attaches" options is not explained anywhere.

With 4.1.12 I get different errors, depending on which target JDK I use. Under JDK 1.3, tomcat startup fails with a "java.lang.NoClassDefFoundError: org/xml/sax/InputSource". Under JDK 1.4, Tomcat throws a NullPointerException while tring to parse the config file/setting up the logger.

Of course, I chose 4.1.12 for a reason and want/need to use it. It seems that the problems I've seen so far are mostly caused by insufficient or wrong invocation parameters from the plugin.

Is there any chance that I will be able to configure IDEA to support tomcat 4.1.12? If there is no other resort, can anybody give me hints what could be adapted in the tomcat plugin to make it work? Is this underway anwhere else (it should!)?

thanks,
Christian Sell

11 comments
Comment actions Permalink

Hi,

First, I did not find any mentioning that I am required to install tomcat

prior to using the web support. Anyway, I went ahead and installed it - just
to find out, that the plugins will not work with the current stable version
of tomcat (4.1.12). There is a small hint that this is so, because the
plugin specifies "4.0.x", but this is nothing more than a hint. IMO, it
should be made explicit that it is THIS version that needs to be installed.

it is mentioned somewhere afaik. I use tomcat4.1.12 as a production server
and 4.0.6 on my dev machine. 4.1.12 is fully compatible with 4.0.6. you can
simply debug inside 4.0.6 and deploy to production on 4.1.12

The "launch server before debuggee attaches" options is not explained

anywhere.

true

With 4.1.12 I get different errors, depending on which target JDK I use.

Under JDK 1.3, tomcat startup fails with a "java.lang.NoClassDefFoundError:
org/xml/sax/InputSource". Under JDK 1.4, Tomcat throws a
NullPointerException while tring to parse the config file/setting up the
logger.

i guess you are using tomcat-4.1.12LE. LE is meant for jdk1.4 ONLY cause
jdk1.4 includes the missing xml parser. when u want to use tomcat with a jdk
< 1.4 then you have to use full tomcat release not the leightweight edition.
the NullPointerException must be a configuration fault of tomcat, it has
northing to do with IDEA.

Of course, I chose 4.1.12 for a reason and want/need to use it. It seems

that the problems I've seen so far are mostly caused by insufficient or
wrong invocation parameters from the plugin.

Tomcat4.1.x introduced a new parser/generator (Jasper) for jsp files. they
did a complete rewrite but the plugin requires the "old" release. I hope
there will be support for 4.1.12 out soon but until then 4.0.6 just does the
trick. (I have setup 4.0.6 and 4.1.12 on one machine using both the some
webapp-root. works pretty fine for me)

hth,
Thomas


0
Comment actions Permalink

>i guess you are using tomcat-4.1.12LE.

no I am not. Outside IDEA, Tomcat starts up without problems under JDK 1.3.

>the NullPointerException must be a configuration fault >of tomcat, it has northing to do with IDEA.

again - no problem running tomcat outside IDEA

>(I have setup 4.0.6 and 4.1.12 on one machine using both >the some webapp-root. works pretty fine for me)

my point was that this dependency on a specific version is intransparent, and bound to cause annoyance, because most people will download 4.1.12

regards,
Christian

0
Comment actions Permalink


"Christian Sell" <christian.sell@netcologne.de> schrieb im Newsbeitrag
news:2509555.1038920767570.JavaMail.jrun@is.intellij.net...

>i guess you are using tomcat-4.1.12LE.

>

no I am not. Outside IDEA, Tomcat starts up without problems under JDK 1.3.

>

>the NullPointerException must be a configuration fault
>of tomcat, it has northing to do with IDEA.

>

again - no problem running tomcat outside IDEA

>

>(I have setup 4.0.6 and 4.1.12 on one machine using both
>the some webapp-root. works pretty fine for me)

>

my point was that this dependency on a specific version is intransparent, and
bound to cause annoyance, because most people will download 4.1.12


The problem is that since Tomcat 4.1.x there is is no line number information
in the generated .java files for the original .jsp file. Because of that, jsp source
level debugging is unlikely to work with any 4.1.x version.
I think I read somewhere that with Tomcat 5 this will be possible again.

Sascha


0
Comment actions Permalink

Sascha and Thomas correctly mentioned that bundled plugin will only work
with the Tomcat 4.0.x versions. As already been discussed many times in this
and j2ee newsgroups, it is impossible to support JSP source-level debugging
for Tomcat 4.1.x versions because new Jasper does not generate comments the
plugin relies on. Tomcat guys are working on JSR45 support for JSP debugging
in Tomcat 5.0 According to them, this is the nearest Tomcat version that
will support the standard debugging extension.

If you are still interested in modifying the plugin so that it is able to
run Tomcat 4.1.x, make sure that "%BASEDIR%\common\endorsed" directory is
added as an endorsed directory instead of "%BASEDIR%\common\lib": see
TomcatStartupParameters class


--

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


0
Comment actions Permalink

>If you are still interested in modifying the plugin

doesnt sound very promising, does it? I guess I'll stay with 4.0.6 for debugging - and switch over to the J2EE forum..

regards
Christian

0
Comment actions Permalink

doesnt sound very promising, does it?


No, it doesn't. But in your initial post you asked for a hint of how to
modify the plugin :)

--

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

"Christian Sell" <christian.sell@netcologne.de> wrote in message
news:6721481.1038928207657.JavaMail.jrun@is.intellij.net...

>If you are still interested in modifying the plugin

>

doesnt sound very promising, does it? I guess I'll stay with 4.0.6 for

debugging - and switch over to the J2EE forum..
>

regards
Christian



0
Comment actions Permalink

You also don't have to use the Tomcat plugin, if you go to www.intellij.org you will see a slew of plugins, one of which is for JBoss/Jetty the other for Resin. I use both and they work just fine, though the one for Resin is better right now.

0
Comment actions Permalink

First of all, you're right that this is a confusing issue. Setting up a web application in IDEA is a bit cumbersome if you haven't done it before.

I stopped trying to get to work Tomcat 4.1.12 with IDEA's Tomcat 4.0.x plugin. The reason for the NullPointerException has to do something with the different Tomcat startup procedure. IDEA doesn't use catalina.bat but builds the classpath itself and starts Tomcat directly. I tried to figure out the exact reason but gave up after 30 minutes.

An easy way around this is setting up Tomcat 4.1.12 Run/Debug/Stop commands as external tools. With such a configuration, you get output and exceptions in IDEA's clickable log window. Of course, you have to set up your server.xml manually to mount your project web roots, but this isn't a hassle if you just switch between 2 projects, like I currently do.

BTW I did the same with Resin 2.1.6. Resin Run and Resin Debug are enough in this case, as Resin provides its own Start/Stop window.

Finally, you need to set up server.xml resp. resin.conf manually anyway, as even with the Tomcat 4.0.x plugin, IDEA is just able to change the root directory of a preexisting web application. Especially if your application uses JNDI resources, IDEA's "Run WebApp" is basically just an alternative way of setting up a web container - only slightly less effort than configuring it as an external tool.

"Debug WebApp" is more valuable: You do not need 2 manual steps for starting up the debuggee process and connecting the debugger to it. And of course, you can set breakpoints in JSPs with it. But for many cases, I don't need the latter - then, an external Resin Debug process is fine with me, optionally with mounted WEB-INF/work directory for debugging Resin's generated JSP servlets.

Juergen

0
Comment actions Permalink

Ok, I did a little more research. The plugin is easilly fixable of course, the issue was debugging JSP. It IS possible with a slight change in the Tomcat 4.1.x libs. What I did was simply copy the jasperruntime and jaspercompiler jar files from the 4.0.x build into the common/lib directory of the 4.1 build. It works like a charm and provides debugging info as IDEA expects it.

0
Comment actions Permalink

What you're doing here is using Jasper 1 instead of Jasper 2, of course. This does work with IDEA, but you're losing a major improvement of Tomcat 4.1. The question is: Why not stick to standard Tomcat 4.0 in this case?

A possible answer might be another major improvement in Tomcat 4.1: resource management. Handling JNDI resources is much nicer in 4.1, either with Commons DBCP or Tyrex 1.0.

For your reference, from the Tomcat 4.1.12 release notes:

]]>
It is possible to use Jasper 1 (included in Tomcat 4.0.x) with Tomcat 4.1, as
it has the same API and supports the same JSP API.

To use Jasper 1 instead of Jasper 2, copy the two following JARs to
$CATALINA_HOME/common/lib (overwriting the two existing JARs):

  • $TOMCAT40_HOME/lib/jasper-runtime.jar

  • $TOMCAT40_HOME/lib/jasper-compiler.jar


However, users are urged to use the version of Jasper included with Tomcat 4.1
(Jasper 2), as it has much higher performance and scalability than Jasper 1.
</quote>

0
Comment actions Permalink

Juergen, I completely agree with you. There IS no SIGNIFICANT advantage, and the only one there really is is the one you mentioned. Performance of JSP while debugging and working with the app is not a requirement of mine, I don't know many people who can tell me there is a huge difference when you're running 4.0.6 and 4.1 inside IDEA and debugging.

The original post was looking for a solution, and was complaining that he could not use Tomcat 4.1.x. So, the solution is drop jasper1 in and modify the plugin, and now they can use 4.1.x and be happy :)

0

Please sign in to leave a comment.