Tomcat Integration

Hello,
I am trying to get Tomcat 4.0.6 to work with Idea 3.0 (build 676) to work using the Tomcat 4.0.6 integration shipped with the release (my machine is a Compaq laptop Evo N600c with 1 Gig

RAM and plenty of hard disk space to spare off a 20 Gig disk, the operating system is Windows 2000 Professional). For some reason, the debugger never stops at the break point that I

have set up. Here is how I have set-up and example project:

1. The Plugins folder under IDEA_HOME has the "tomcatintegration" folder, which, in turn, has "doc" and "lib" folders (I didn't do this the install program did this). The "docs" folder

has nothing in it whereas the "lib" folder contains the "tomcatIntegration.jar.". I guess that I am using the third method of Idea's Plugins documentation which states that any jar files

found in the lib folder will automatically be added to the classpath.

2. I set up a project call "apress" which is out of James Goodwill's "Apache Jakarta-Tomcat" book in chapter two. This a basic "web" app that displays a "login.jsp" and upon the user

typing in the username and passwords displays a welcome message in "welcome.jsp." The project is set up in the "apress" folder which is under the "webapps" folder. The "webapps"

folder exists under "Tomcat406" folder off the root. Therefore its complete path is "C:\Tomcat406\webapps\apress".

3. My idea is configured to use jdk 1.3.1_03 which is shipped with BEA's WebLogic version 7.0 (you can see where I am headed, ultimately, I would love to use IDEA 3.0 with BEA

WebLogic 7.0, right now, I will be satisfied with Tomcat and Idea). Weblogic 7.0 is installed in the BEA folder off the root drive "C:\" by default and the JDK lives in the jdk131_03 folder

off the BEA folder. Therefore its complete path is "C:\bea\jdk131_03". My project ".ipr" file, i.e. apress.ipr is stored in the \apress folder (complete path is

C:\Tomcat406\webapps\apress\apress.ipr"). The compiler output path is set to point to "C:\Tomcat406\webapps\WEB-INF\classes" this is where the project package is stored.

4. My project path is set to "C:\Tomcat406\webapps\apress"

5. My source path shows the two entries: C:\Tomcat406\webapps\apress\WEB-INF\classes and another entry as . I have not downloaded the source for the JDK therefore this entry doesn't have anything in it (I plan on doing that later once I have this basic set-up working). 6. My classpath shows the entry "C:\Tomcat406\webapps\WEB-INF\classes" under the folder. The following JAR files under the JDK folder (automatically added when I chose this JDK): C:\jdk131_03\jre\lib\i18n.jar, C:\jdk131_03\jre\lib\jaws.jar, C:\jdk131_03\jre\lib\rt.jar, C:\jdk131_03\jre\lib\sunrsasign.jar. I have added weblogic.jar with the path C:\bea\weblogic700\server\lib\weblogic.jar (the reason that I had to add this is because all javax J2EE packages are found in the weblogic.jar file and since WebLogic is my primary server, I like to stay with its JDK and JARs as much as possible). 7. I configured a web application in the folder "C:\Tomcat406\webapps\apress" with the name "apress" and with "Enable Web application support" check-box "checked." 8. Next, I selected "Project Properties" selection from the "File" menu and chose "Run/Debug" off it. Next I clicked on the "WebApp" tab. I have the following settings in the resulting dialog box: I chose "apress" as the name. I chose "apress" in the Web Application drop-down that I had configured in step 7 above. Debuggee Host is "localhost" by default. Debuggee port is 5050 by default. I have the "Launch server before debugger attaches" check-box checked. Catalina Home is set to "C:\Tomcat406" which automatically set "Path to Catalina Configs" to "C:\Tomcat406\conf". Next I picked "/apress" from the "Application Context Path" drop-down. I should point out the I had edited the "server.xml" file in the folder "C:\Tomcat406\conf" and added the following entry within the element with the name "localhost": ]]>. I

don't have anything in the VM parameters box. I have the "Include Project classpath" check-box checked. Finally, "Display settings before running/debugging" and "Make project before

running/debugging" check-boxes are both checked.

9. I opened the "login.java" servlet file open in my editor which extends HttpServlet class in the javax.servlet.http.* package. This servlet overrides the doPost method. With doPost,

there is a call to a private method getUser which takes username and password parameters and returns a string. I set the break-point by clicking on the editor bar to the left of this line.

This shows a small "Red" circle next to it with this line of source code (String user = getUser(username, password);) highlighted in a dull red color.

10. I launch my project by clicking the "Run" button (same as shift+F10). This dutifully shows the dialog box "Run - apress" with all my previous settings as described in the step 8

above. Clicking on the "Run" button launches the Tomcat server correctly which shows the following output in the "Run - apress" window:

C:\bea\jdk131_03\bin\javaw.exe -Djava.endorsed.dirs=C:\Tomcat406\bin;C:\Tomcat406\common\lib -Dcatalina.base=C:\Documents and

Settings\BRuparel\.IntelliJIdea\system\tomcat_apress_33dd9932 -Dcatalina.home=C:\Tomcat406 -Djava.io.tmpdir=C:\Tomcat406\temp -classpath

C:\bea\jdk131_03\lib\tools.jar;C:\Tomcat406\bin\bootstrap.jar;C:\Tomcat406\common\lib\activation.jar;C:\Tomcat406\common\lib\jdbc2_0-stdext.jar;C:\Tomcat406\common\lib\jndi.jar;C:\T

omcat406\common\lib\jta-spec1_0_1.jar;C:\Tomcat406\common\lib\mail.jar;C:\Tomcat406\common\lib\naming-common.jar;C:\Tomcat406\common\lib\naming-resources.jar;C:\Tomcat406\c

ommon\lib\servlet.jar;C:\Tomcat406\common\lib\tools.jar;C:\Tomcat406\common\lib\tyrex-0.9.7.0.jar;C:\Tomcat406\common\lib\xerces.jar;C:\Tomcat406\server\lib\catalina.jar;C:\Tomcat406

\server\lib\commons-logging.jar;C:\Tomcat406\server\lib\jakarta-regexp-1.2.jar;C:\Tomcat406\server\lib\servlets-common.jar;C:\Tomcat406\server\lib\servlets-default.jar;C:\Tomcat406\serv

er\lib\servlets-invoker.jar;C:\Tomcat406\server\lib\servlets-manager.jar;C:\Tomcat406\server\lib\servlets-webdav.jar;C:\Tomcat406\server\lib\tomcat-ajp.jar;C:\Tomcat406\server\lib\tomcat-

coyote.jar;C:\Tomcat406\server\lib\tomcat-http11.jar;C:\Tomcat406\server\lib\tomcat-util.jar;C:\Tomcat406\server\lib\warp.jar;C:\Tomcat406\webapps\apress\WEB-INF\classes;C:\bea\jdk1

31_03\jre\lib\i18n.jar;C:\bea\jdk131_03\jre\lib\jaws.jar;C:\bea\jdk131_03\jre\lib\rt.jar;C:\bea\jdk131_03\jre\lib\sunrsasign.jar;C:\bea\weblogic700\server\lib\weblogic.jar

org.apache.catalina.startup.Bootstrap start
Starting service Tomcat-Standalone
Apache Tomcat/4.0.6
Starting service Tomcat-Apache
Apache Tomcat/4.0.6

11. Next, I start my browser and type in the following line in the Address box: http://localhost:8080/apress/login.jsp. This correctly brings up the login.jsp form. The form is called

"loginForm" with the attributes method="post" and action="servlet/chapter2.login". This form simply presents username and login text boxes and has a submit button. So far so good.

12. After filling in the user name and password text boxes, when I click on the submit button, the program merrily marches on to the welcome.jsp page! In other words, it does not break

any my break-point and simply runs through my doPost method. I know that it is executing the login.java servlet since I have added to "System.out.println()" calls before and after the line

where I have set the break point. This two comments show up the the message window correctly!

13 I know I am so close but yet not there!!!!!

Any help will be greatly appreciated.

4 comments
Comment actions Permalink

Man, that's gotta be one of the best posts i've ever seen! What incredible
detail! :D

I'm sorry that I can't provide anything even close to a solution (i've never
tried the Tomcat integration), but after a (admittedly VERY brief) scanning
of your post it sounds similar to the problem discussed here:

http://www.intellij.net/forums/thread.jsp?forum=4&thread=17474

You might tune into that thread--maybe your (fantastic!) details can help
shed some light on the problem and lead to a solution?

Good luck.

chris


"Bharat Ruparel" <itnadmin@jetbrains.com> wrote in message
news:5966790.1037825822504.JavaMail.jrun@is.intellij.net...
>

>

For some reason, the debugger never stops at the break point that I
have set up.

>

>


0
Comment actions Permalink

Hi Bharat,

Did the breakpoint change its icon after you started Tomcat and invoked the
application? What kind of icon the breakpoint had?

--

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


0
Comment actions Permalink

I assume you should be using the Debug button instead of Run in 10?

Eugene Belyaev
JetBrains, Inc


"Bharat Ruparel" <itnadmin@jetbrains.com> wrote in message
news:5966790.1037825822504.JavaMail.jrun@is.intellij.net...

Hello,
I am trying to get Tomcat 4.0.6 to work with Idea 3.0 (build 676) to work

using the Tomcat 4.0.6 integration shipped with the release (my machine is a
Compaq laptop Evo N600c with 1 Gig
>

RAM and plenty of hard disk space to spare off a 20 Gig disk, the

operating system is Windows 2000 Professional). For some reason, the
debugger never stops at the break point that I
>

have set up. Here is how I have set-up and example project:

>

1. The Plugins folder under IDEA_HOME has the "tomcatintegration" folder,

which, in turn, has "doc" and "lib" folders (I didn't do this the install
program did this). The "docs" folder
>

has nothing in it whereas the "lib" folder contains the

"tomcatIntegration.jar.". I guess that I am using the third method of
Idea's Plugins documentation which states that any jar files
>

found in the lib folder will automatically be added to the classpath.

>

2. I set up a project call "apress" which is out of James Goodwill's

"Apache Jakarta-Tomcat" book in chapter two. This a basic "web" app that
displays a "login.jsp" and upon the user
>

typing in the username and passwords displays a welcome message in

"welcome.jsp." The project is set up in the "apress" folder which is under
the "webapps" folder. The "webapps"
>

folder exists under "Tomcat406" folder off the root. Therefore its

complete path is "C:\Tomcat406\webapps\apress".
>

3. My idea is configured to use jdk 1.3.1_03 which is shipped with BEA's

WebLogic version 7.0 (you can see where I am headed, ultimately, I would
love to use IDEA 3.0 with BEA
>

WebLogic 7.0, right now, I will be satisfied with Tomcat and Idea).

Weblogic 7.0 is installed in the BEA folder off the root drive "C:\" by
default and the JDK lives in the jdk131_03 folder
>

off the BEA folder. Therefore its complete path is "C:\bea\jdk131_03".

My project ".ipr" file, i.e. apress.ipr is stored in the \apress folder
(complete path is
>

C:\Tomcat406\webapps\apress\apress.ipr"). The compiler output path is set

to point to "C:\Tomcat406\webapps\WEB-INF\classes" this is where the project
package is stored.
>

4. My project path is set to "C:\Tomcat406\webapps\apress"

>

5. My source path shows the two entries:

C:\Tomcat406\webapps\apress\WEB-INF\classes and another entry as . I have not downloaded the source for the JDK therefore this >]]>

entry doesn't have anything in it (I plan on doing that later once I have

this basic set-up working).
>

6. My classpath shows the entry "C:\Tomcat406\webapps\WEB-INF\classes"

under the folder. The following JAR files under the JDK folder (automatically added when I chose >]]>

this JDK): C:\jdk131_03\jre\lib\i18n.jar, C:\jdk131_03\jre\lib\jaws.jar,

C:\jdk131_03\jre\lib\rt.jar, C:\jdk131_03\jre\lib\sunrsasign.jar. I have
added weblogic.jar with the path
>

C:\bea\weblogic700\server\lib\weblogic.jar (the reason that I had to add

this is because all javax J2EE packages are found in the weblogic.jar file
and since WebLogic is my primary server, I
>

like to stay with its JDK and JARs as much as possible).

>

7. I configured a web application in the folder

"C:\Tomcat406\webapps\apress" with the name "apress" and with "Enable Web
application support" check-box "checked."
>

8. Next, I selected "Project Properties" selection from the "File" menu

and chose "Run/Debug" off it. Next I clicked on the "WebApp" tab. I have
the following settings in the resulting
>

dialog box: I chose "apress" as the name. I chose "apress" in the Web

Application drop-down that I had configured in step 7 above. Debuggee Host
is "localhost" by default. Debuggee
>

port is 5050 by default. I have the "Launch server before debugger

attaches" check-box checked. Catalina Home is set to "C:\Tomcat406" which
automatically set "Path to Catalina
>

Configs" to "C:\Tomcat406\conf". Next I picked "/apress" from the

"Application Context Path" drop-down. I should point out the I had edited
the "server.xml" file in the folder
>

"C:\Tomcat406\conf" and added the following entry within the <Host>

element with the name "localhost": . I >]]>

don't have anything in the VM parameters box. I have the "Include Project

classpath" check-box checked. Finally, "Display settings before
running/debugging" and "Make project before
>

running/debugging" check-boxes are both checked.

>

9. I opened the "login.java" servlet file open in my editor which extends

HttpServlet class in the javax.servlet.http.* package. This servlet
overrides the doPost method. With doPost,
>

there is a call to a private method getUser which takes username and

password parameters and returns a string. I set the break-point by clicking
on the editor bar to the left of this line.
>

This shows a small "Red" circle next to it with this line of source code

(String user = getUser(username, password);) highlighted in a dull red
color.
>

10. I launch my project by clicking the "Run" button (same as shift+F10).

This dutifully shows the dialog box "Run - apress" with all my previous
settings as described in the step 8
>

above. Clicking on the "Run" button launches the Tomcat server correctly

which shows the following output in the "Run - apress" window:
>
>
C:\bea\jdk131_03\bin\javaw.exe -Djava.endorsed.dirs=C:\Tomcat406\bin;C:\Tomc
at406\common\lib -Dcatalina.base=C:\Documents and
>
>
Settings\BRuparel\.IntelliJIdea\system\tomcat_apress_33dd9932 -Dcatalina.hom
e=C:\Tomcat406 -Djava.io.tmpdir=C:\Tomcat406\temp -classpath
>
>
C:\bea\jdk131_03\lib\tools.jar;C:\Tomcat406\bin\bootstrap.jar;C:\Tomcat406\c
ommon\lib\activation.jar;C:\Tomcat406\common\lib\jdbc2_0-stdext.jar;C:\Tomca
t406\common\lib\jndi.jar;C:\T
>
>
omcat406\common\lib\jta-spec1_0_1.jar;C:\Tomcat406\common\lib\mail.jar;C:\To
mcat406\common\lib\naming-common.jar;C:\Tomcat406\common\lib\naming-resource
s.jar;C:\Tomcat406\c
>
>
ommon\lib\servlet.jar;C:\Tomcat406\common\lib\tools.jar;C:\Tomcat406\common\
lib\tyrex-0.9.7.0.jar;C:\Tomcat406\common\lib\xerces.jar;C:\Tomcat406\server
\lib\catalina.jar;C:\Tomcat406
>
>
\server\lib\commons-logging.jar;C:\Tomcat406\server\lib\jakarta-regexp-1.2.j
ar;C:\Tomcat406\server\lib\servlets-common.jar;C:\Tomcat406\server\lib\servl
ets-default.jar;C:\Tomcat406\serv
>
>
er\lib\servlets-invoker.jar;C:\Tomcat406\server\lib\servlets-manager.jar;C:\
Tomcat406\server\lib\servlets-webdav.jar;C:\Tomcat406\server\lib\tomcat-ajp.
jar;C:\Tomcat406\server\lib\tomcat-
>
>
coyote.jar;C:\Tomcat406\server\lib\tomcat-http11.jar;C:\Tomcat406\server\lib
\tomcat-util.jar;C:\Tomcat406\server\lib\warp.jar;C:\Tomcat406\webapps\apres
s\WEB-INF\classes;C:\bea\jdk1
>
>
31_03\jre\lib\i18n.jar;C:\bea\jdk131_03\jre\lib\jaws.jar;C:\bea\jdk131_03\jr
e\lib\rt.jar;C:\bea\jdk131_03\jre\lib\sunrsasign.jar;C:\bea\weblogic700\serv
er\lib\weblogic.jar
>

org.apache.catalina.startup.Bootstrap start
Starting service Tomcat-Standalone
Apache Tomcat/4.0.6
Starting service Tomcat-Apache
Apache Tomcat/4.0.6

>

11. Next, I start my browser and type in the following line in the

Address box: http://localhost:8080/apress/login.jsp. This correctly brings
up the login.jsp form. The form is called
>

"loginForm" with the attributes method="post" and

action="servlet/chapter2.login". This form simply presents username and
login text boxes and has a submit button. So far so good.
>

12. After filling in the user name and password text boxes, when I click

on the submit button, the program merrily marches on to the welcome.jsp
page! In other words, it does not break
>

any my break-point and simply runs through my doPost method. I know that

it is executing the login.java servlet since I have added to
"System.out.println()" calls before and after the line
>

where I have set the break point. This two comments show up the the

message window correctly!
>

13 I know I am so close but yet not there!!!!!

>

Any help will be greatly appreciated.



0
Comment actions Permalink

Yes! As Eugene pointed out. I was simply making the mistake of clicking on Run Icon instead of Debug. I posted this on the JGuru forum, but forgot to post it here. It seems like this is a better place to get quick answers?
Thank you all.
Regards.
Bharat

0

Please sign in to leave a comment.