Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » How to set up JSP/Javabean debugging in Eclipse Java EE for Web Developers(breakpoints and values not active with JSP debugging )
How to set up JSP/Javabean debugging in Eclipse Java EE for Web Developers [message #507486] Wed, 13 January 2010 16:30 Go to next message
MB  is currently offline MB Friend
Messages: 17
Registered: January 2010
Junior Member
I have downloaded and installed "Eclipse Java EE for Web Developers" with WTP 1.1.3. I have set up my MySQL 5.x with the Data tools and I have sucessfully made a db connection in a simple jsp file so I know my database is valid and working. I can also reach the MySQL database from the Datasource explorer.

However, even after setting up Tomcat under "Debug Configurations" with the information found under "How can I debug with the Java source that Tomcat creates for a JSP?" in the WTP Tomcat FAQ: http://wiki.eclipse.org/WTP_Tomcat_FAQ and setting breakpoints only with within the JSP tags: <% and %>, the execution still doesn't stop at my set breakpoints nor can I see any variable values or ArrayLists values. This is making it hard for me to see where in the process my problem lies. Currently this is an IndexOutOfBoundsException.

I have tried to halt the VM and not and also tried to set the environment variables JPDA_ADDRESS=8000 and JPDA_TRANSPORT=dt_socket and then start up tomcat using "catalina jpda start" as said in the Tomcat Wiki. about "remote debugging" which I suppose is my case even if I'm on the same machine. With this I got errors during startup but Tomcat executed my pages (with the same errors obviously)  

How do I set up Tomcat 5.5.x so that my breakpoints are active and so that I can see my variables?

I'm on Mac OS X 10.5.8 with JVM1.5.0.
Re: How to set up JSP/Javabean debugging in Eclipse Java EE for Web Developers [message #507557 is a reply to message #507486] Wed, 13 January 2010 19:41 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1313
Registered: July 2009
Senior Member
I'm not at all familiar with a Mac and what might be different from the
Linux and Windows systems I work with where I don't see this problem.
Is the Tomcat you installed one downloaded from Apache and have any
configuration changes been made?

Note that you can set a Java Exception breakpoint for
IndexOutOfBoundsException so execution breaks when one is thrown. In
the Breakpoints view click on the icon containing the exclamation point.

Cheers,
Larry


MB wrote:
> I have downloaded and installed "Eclipse Java EE for Web Developers"
> with WTP 1.1.3. I have set up my MySQL 5.x with the Data tools and I
> have sucessfully made a db connection in a simple jsp file so I know my
> database is valid and working. I can also reach the MySQL database from
> the Datasource explorer.
>
> However, even after setting up Tomcat under "Debug Configurations" with
> the information found under "How can I debug with the Java source that
> Tomcat creates for a JSP?" in the WTP Tomcat FAQ:
> http://wiki.eclipse.org/WTP_Tomcat_FAQ and setting breakpoints only with
> within the JSP tags: <% and %>, the execution still doesn't stop at my
> set breakpoints nor can I see any variable values or ArrayLists values.
> This is making it hard for me to see where in the process my problem
> lies. Currently this is an IndexOutOfBoundsException.
>
> I have tried to halt the VM and not and also tried to set the
> environment variables JPDA_ADDRESS=8000 and JPDA_TRANSPORT=dt_socket and
> then start up tomcat using "catalina jpda start" as said in
> http://wiki.apache.org/tomcat/FAQ/Developing about "remote debugging"
> which I suppose is my case even if I'm on the same machine. With this I
> got errors during startup but Tomcat executed my pages (with the same
> errors obviously)
>
> How do I set up Tomcat 5.5.x so that my breakpoints are active and so
> that I can see my variables?
>
> I'm on Mac OS X 10.5.8 with JVM1.5.0.
Re: How to set up JSP/Javabean debugging in Eclipse Java EE for Web Developers [message #507560 is a reply to message #507486] Wed, 13 January 2010 20:29 Go to previous messageGo to next message
MB  is currently offline MB Friend
Messages: 17
Registered: January 2010
Junior Member
I can add now that I have followed the 6 steps in the help files under "Debugging a JSP file on a server" in the Using the server tools chapter. It doesn't work for me as described there either.

My main mission is to be able to step trough the code and see variable values. Even better if one could see the object states while stepping.
Re: How to set up JSP/Javabean debugging in Eclipse Java EE for Web Developers [message #507563 is a reply to message #507557] Wed, 13 January 2010 20:36 Go to previous messageGo to next message
MB  is currently offline MB Friend
Messages: 17
Registered: January 2010
Junior Member
Thanks for you response Larry.

Yes, the Tomcat comes directly from the Apache download page and I have not changed anything in the installation folder, only pointed Eclipse to it. My other project runs fine without errors, but also there I can't step trough the code even if I set a simple breakpoint within JSP code marks.

I suspect there must be something I've been doing wrong on the way with the Eclipse configuration of the server, so I'm redoing that. I do not think I made any errors first time, but I want to try something at least.

Am I right to understand that debug stepping should work in JSP and javabean files should work with minimal Eclipse configuration of the server instance used if I use WTP 1.1.3 in Eclipse Java EE for Web Developers?
Re: How to set up JSP/Javabean debugging in Eclipse Java EE for Web Developers [message #507571 is a reply to message #507563] Wed, 13 January 2010 21:02 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1313
Registered: July 2009
Senior Member
MB wrote:
> Thanks for you response Larry.
> Yes, the Tomcat comes directly from the Apache download page and I have
> not changed anything in the installation folder, only pointed Eclipse to
> it. My other project runs fine without errors, but also there I can't
> step trough the code even if I set a simple breakpoint within JSP code
> marks.
>
> I suspect there must be something I've been doing wrong on the way with
> the Eclipse configuration of the server, so I'm redoing that. I do not
> think I made any errors first time, but I want to try something at least.
>
> Am I right to understand that debug stepping should work in JSP and
> javabean files should work with minimal Eclipse configuration of the
> server instance used if I use WTP 1.1.3 in Eclipse Java EE for Web
> Developers?

Nothing special is required beyond using Debug On Server or starting the
server in debug mode. Tomcat can be configured to not generate "debug"
info during JSP compilation, but that is not the default. The more
important question at this point is whether you can set a breakpoint in
a servlet and have it work. If that isn't working, JSPs aren't going to
do any better.

One other shot in the dark is to verify what JVM Tomcat is running with.
It can be different from what Eclipse is running on. There was a bug
in Sun JVMs 1.6.0_14, and I believe 1.6.0_15, that has this symptom.

Cheers,
Larry

P.S. I assume you mean WTP 3.1.1.
Re: How to set up JSP/Javabean debugging in Eclipse Java EE for Web Developers [message #507582 is a reply to message #507571] Wed, 13 January 2010 22:11 Go to previous messageGo to next message
MB  is currently offline MB Friend
Messages: 17
Registered: January 2010
Junior Member
I'm using your input to find a solution. Useful thoughts all of it. Thank you.

Yes, I meant WTP 3.1.1. Build 20090917225226 to be overspecific. I did update some part of the plugins regarding MySQL support I think via the Eclipse builtin update mechanism, so I'm not sure if that could be involved as well in my problems.
Re: How to set up JSP/Javabean debugging in Eclipse Java EE for Web Developers [message #507586 is a reply to message #507571] Wed, 13 January 2010 22:52 Go to previous messageGo to next message
MB  is currently offline MB Friend
Messages: 17
Registered: January 2010
Junior Member
I made a simple servlet and debugging seems to work fine in the old Eclipse config of my Tomcat 5.5.28 installation. JSP still refuses to work with debug.

I wonder if it can be involved that I have set my projects Default output folder to "/WebContent/WEB-INF/classes". I thought that was where a java web application expects to find its classes?

Eclipse have bewildered me because it choose the build folder by default for my dynamic web project, but the class files there was not visible from Eclipse. I had to copy them by hand to the folder I output to now. That seemed to work, so I changed the output folder accordingly. Could this affect my problem?

Even now nor the class files or the folder structure are visible in Eclipse, though they are there in the file system with the correct time stamp and everything.

This not showing the build is a preference I've missed somewhere?
Re: How to set up JSP/Javabean debugging in Eclipse Java EE for Web Developers [message #507597 is a reply to message #507586] Thu, 14 January 2010 01:25 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin DahyabhaiFriend
Messages: 2341
Registered: July 2009
Senior Member
WTP's built-in Tomcat support is expected to assemble your application
into the right layout for debugging with the server.

> JSP still refuses to work with debug.
Can you elaborate on that, and how you set the breakpoints (they show up
in the Breakpoints view, yes?)?

--
---
Nitin Dahyabhai
Eclipse WTP Source Editing
IBM Rational


---
Nitin Dahyabhai
Eclipse WTP, IBM
Re: How to set up JSP/Javabean debugging in Eclipse Java EE for Web Developers [message #507643 is a reply to message #507597] Thu, 14 January 2010 09:03 Go to previous messageGo to next message
MB  is currently offline MB Friend
Messages: 17
Registered: January 2010
Junior Member
Yes I also had those expectations, but surely the proper build folder is the "Webcontent/WEBINF/classes" folder, no?
Re: How to set up JSP/Javabean debugging in Eclipse Java EE for Web Developers [message #507735 is a reply to message #507597] Thu, 14 January 2010 14:06 Go to previous messageGo to next message
MB  is currently offline MB Friend
Messages: 17
Registered: January 2010
Junior Member
Update
I have now cleaned my OS X cache and removed the .plist file in my Preferences folder, which most likely was the culprit as I discovered it originally was created under an earlier installation of another version of Eclipse, and also reinstalled Eclipse Java EE for Web Developers. I added the same Tomcat 5.5.28 installation as before as my Server and made a really simple JSP file.
Debugging now seem to work, I'm glad to say, but I must recreate my earlier JSP/Javabean project and see if debugging will continue to work also with that. I'll post my results.

Do I have the proper approach setting the final build output for my classes to "/WebContent/WEBINF/classes" or is Eclipse actually reliably telling Tomcat where they are, so I don't have to think about this? If I want them in WEBINF shouldn't I have the opportunity to tell Eclipse to put my build there? Is putting folders elsewhere but default actually going to break anything?

[Updated on: Thu, 14 January 2010 14:08]

Report message to a moderator

Re: How to set up JSP/Javabean debugging in Eclipse Java EE for Web Developers [message #507766 is a reply to message #507735] Thu, 14 January 2010 10:36 Go to previous messageGo to next message
Larry Isaacs is currently offline Larry IsaacsFriend
Messages: 1313
Registered: July 2009
Senior Member
MB wrote:
> Update
> I have now cleaned my OS X cache and removed the .plist file in my
> Preferences folder, which most likely was the culprit as I doscovered it
> originally was created under an earlier installation of another version
> of Eclipse, and also reinstalled Eclipse Java EE for Web Developers. I
> added the same Tomcat 5.5.28 installation as before as my Server and
> made a really simple JSP file. Debugging now seem to work, I'm glad to
> say, but I must recreate my earlier JSP/Javabean project and see if
> debugging will continue to work also with that. I'll post my results.
>
> Do I have the proper approach setting the final build output for my
> classes to "/WebContent/WEBINF/classes" or is Eclipse actually reliably
> telling Tomcat where they are, so I don't have to think about this? If I
> want them in WEBINF shouldn't I have the opportunity to tell Eclipse to
> put my build there? Is putting folders elsewhere but default actually
> going to break anything?

No. Doing this has to potential to confuse things. Eclipse fully
supports the separation of source, such as Java files and JSPs, from
artifacts, such as compiled Java class files. In a default Dynamic Web
Project, Java source will go under a folder called "src" and will be
built to a Java output folder called "build/classes". During
publishing, the content of "build/classes" will be copied to the
"WEB-INF/classes" folder of the deployed webapp. Try using this default
structure in your project and see if it affects the JSP breakpoint
behavior. I'm not sure if it will, but it might. Even if it doesn't, I
don't recommend using "WebContent/WEB-INF/classes" as a Java output
folder if you don't have a real reason for doing so.

Cheers,
Larry
Re: How to set up JSP/Javabean debugging in Eclipse Java EE for Web Developers [message #508096 is a reply to message #507766] Fri, 15 January 2010 21:35 Go to previous message
MB  is currently offline MB Friend
Messages: 17
Registered: January 2010
Junior Member
Indeed, I left the classes in the default "build" folder and they are referenced as well and running. Debugging from a breakpoint in the JSP now seem to work fine and I can see the values of my variables and arrays.

I'm a bit overwhelmed by the plethora of objects used for a simple connection and population, but it's very cool and insightful to see the details. One big reason for an IDE.

The only problems now is that Tomcat keeps nagging me about load timeout - I'll find the setting for that - and that my javabean is acting up with my ResultSet object. But now I have Eclipse working on my side at least.
Previous Topic:Can multiple contexts be associated with a single Dynamic Web Project?
Next Topic:web sphere directory structure
Goto Forum:
  


Current Time: Sat Dec 20 04:27:55 GMT 2014

Powered by FUDForum. Page generated in 0.01948 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software