How to set up JSP/Javabean debugging in Eclipse Java EE for Web Developers [message #507486] |
Wed, 13 January 2010 16:30 |
Eclipse User |
|
|
|
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 #507563 is a reply to message #507557] |
Wed, 13 January 2010 20:36 |
Eclipse User |
|
|
|
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 |
Larry Isaacs Messages: 1354 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 #507586 is a reply to message #507571] |
Wed, 13 January 2010 22:52 |
Eclipse User |
|
|
|
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 #507735 is a reply to message #507597] |
Thu, 14 January 2010 14:06 |
Eclipse User |
|
|
|
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] by Moderator 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 |
Larry Isaacs Messages: 1354 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 |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.04736 seconds