File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes How to debug Struts program in Eclipse? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to debug Struts program in Eclipse?" Watch "How to debug Struts program in Eclipse?" New topic
Author

How to debug Struts program in Eclipse?

David Li
Ranch Hand

Joined: Aug 12, 2002
Posts: 41
Somebody tell me that Eclipse can debug the Struts program.
But I can't start up the Tomcat server in Eclipse.
Can somebody give me a hint?
or any other method to debug the Struts program?


David,<br />SCJP - 94% (2002-7-6)
Doug Wang
Ranch Hand

Joined: Oct 05, 2001
Posts: 445
I guess what you want is to debug Servlet/JSP from within the Eclipse IDE.
If your web app runs inside WAS, I would recommend you the following article to aid you on how to debug:
http://www7b.boulder.ibm.com/wsdd/techjournal/0110_winchester/winchester.html
HTH.


Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep
Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

David,
Assuming that you're developing your struts app in Tomcat; then I have the answer for you. To debug a struts webapp, you should follow the instructions on setting up the sysdeo Tomcat plugin within eclipse. Check the following url:
tomcat in eclipse
Then follow the instructions as described by a user called johan in the eclipse newsgroup:-
You don't need to make a war file to debug your webapplication!! Just make a context entry in yourserver.xml (the plugin can do that for you)that points to the htdocs dir of you webapp structure (inside youre project in eclipse)
Then include that project into the tomcat classpath you can do that in 2 way's:
1> preferences->tomcat->select the project
2> use de dev-loader-> properties of the project->tomcat and select all libs and output dirs
i prefer 2 because this makes it a reall webapp inside tomcat with the right classpaths..
johan

I got it working yesterday and it's really cool. There's also a patch to debug your JSPs!!
Cheers,
Pho


Regards,

Pho
Danl Thompson
Ranch Hand

Joined: Apr 04, 2001
Posts: 93
Wait a second. You can debug a J2EE program? Arggg! I've been settling for print statements. Shoot me now.
Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

Bang! Bang!
Budong Li
Greenhorn

Joined: Nov 20, 2002
Posts: 9
Why your guys don't use Websphere studio?
David Li
Ranch Hand

Joined: Aug 12, 2002
Posts: 41
Hi,
Thank you all for your reply!
I'm sorry for that I haven't explain my problem very clear.
But Pho Tek have got my point so accurate!
Thanks Pho again, you are very helpful!
The sysdeo Tomcat plugin has been installed on my computer.
As the result, you know, the plugin will add 3 buttons on the Eclipse's toolbar:
1, Start Tomcat
2, Stop Tomcat
3, Restart Tomcat
Actually, my question is:
When I click the "Start Tomcat" button which is added by sysdeo Tomcat plugin,
I got errors and the Tomcat server can't be started.

Then, please tell me, how can I start the Tomcat server in Eclipse?
Thank you all in advance!
David Li
Ranch Hand

Joined: Aug 12, 2002
Posts: 41
Hi, Pho!
The document you provided is very great!
But I still got the errors:

!ENTRY com.sysdeo.eclipse.tomcat 4 4 鍗佷簩鏈?04, 2002 10:24:18.955
!MESSAGE Starting Tomcat...
!ENTRY com.sysdeo.eclipse.tomcat 4 4 鍗佷簩鏈?04, 2002 10:24:39.935
!MESSAGE Impossible to start Tomcat
Check home directory setup in Tomcat preference page/n
!ENTRY com.sysdeo.eclipse.tomcat 4 4 鍗佷簩鏈?04, 2002 10:24:39.935
!MESSAGE org.eclipse.core.runtime.CoreException[116]: java.net.SocketTimeoutException: Accept timed out
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:343)
at java.net.ServerSocket.implAccept(ServerSocket.java:438)
at java.net.ServerSocket.accept(ServerSocket.java:409)
at org.eclipse.jdi.internal.connect.SocketTransportImpl.accept(SocketTransportImpl.java:77)
at org.eclipse.jdi.internal.connect.SocketListeningConnectorImpl.accept(SocketListeningConnectorImpl.java:118)
at org.eclipse.jdt.internal.launching.StandardVMDebugger.run(StandardVMDebugger.java:144)
at com.sysdeo.eclipse.tomcat.VMLauncherUtility.runVM(VMLauncherUtility.java:81)
at com.sysdeo.eclipse.tomcat.TomcatBootstrap.runTomcatBootsrap(TomcatBootstrap.java:107)
at com.sysdeo.eclipse.tomcat.TomcatBootstrap.start(TomcatBootstrap.java:65)
at com.sysdeo.eclipse.tomcat.actions.StartActionDelegate.run(StartActionDelegate.java:37)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:210)
at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:180)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:407)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent(ActionContributionItem.java:361)
at org.eclipse.jface.action.ActionContributionItem.access$0(ActionContributionItem.java:352)
at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent(ActionContributionItem.java:47)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:827)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1529)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1291)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1343)
at org.eclipse.ui.internal.Workbench.run(Workbench.java:1326)
at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:831)
at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.eclipse.core.launcher.Main.basicRun(Main.java:247)
at org.eclipse.core.launcher.Main.run(Main.java:703)
at org.eclipse.core.launcher.Main.main(Main.java:539)

Pho Tek
Ranch Hand

Joined: Nov 05, 2000
Posts: 761

David,
Have you done these in eclipse:
(a) Make sure you set the TOMCAT_HOME variable in Window > Preferences > Java > Classpath variables
(b) Then set the Tomcat server versions and home dir in Window > Preferences > Tomcat
(c) Voila!
Pho
David Li
Ranch Hand

Joined: Aug 12, 2002
Posts: 41
Pho,
"Voila", very vivid!
I can see the smile on your face!

I can confirm that the problem must be in my Tomcat_home path.
But I have tried every possibility to set my Tomcat_home variable in the Eclipse IDE or edit the "pref_store.ini" under the workspace\.metadata\.plugins directory, and I still get the same error message:

!ENTRY com.sysdeo.eclipse.tomcat 4 4 Dec. 05, 2002 13:19:21.76
!MESSAGE Starting Tomcat...
!ENTRY com.sysdeo.eclipse.tomcat 4 4 Dec. 05, 2002 13:19:42.868
!MESSAGE Impossible to start Tomcat
Check home directory setup in Tomcat preference page/n
!ENTRY com.sysdeo.eclipse.tomcat 4 4 Dec. 05, 2002 13:19:42.908
!MESSAGE org.eclipse.core.runtime.CoreException[116]: java.net.SocketTimeoutException: Accept timed out
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:343)
at java.net.ServerSocket.implAccept(ServerSocket.java:438)
at java.net.ServerSocket.accept(ServerSocket.java:409)
at org.eclipse.jdi.internal.connect.SocketTransportImpl.accept(SocketTransportImpl.java:77)
at org.eclipse.jdi.internal.connect.SocketListeningConnectorImpl.accept(SocketListeningConnectorImpl.java:118)
at org.eclipse.jdt.internal.launching.StandardVMDebugger.run(StandardVMDebugger.java:144)
at com.sysdeo.eclipse.tomcat.VMLauncherUtility.runVM(VMLauncherUtility.java:81)
at com.sysdeo.eclipse.tomcat.TomcatBootstrap.runTomcatBootsrap(TomcatBootstrap.java:107)
at com.sysdeo.eclipse.tomcat.TomcatBootstrap.start(TomcatBootstrap.java:65)
at com.sysdeo.eclipse.tomcat.actions.StartActionDelegate.run(StartActionDelegate.java:37)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:210)
at org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:180)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:407)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent(ActionContributionItem.java:361)
at org.eclipse.jface.action.ActionContributionItem.access$0(ActionContributionItem.java:352)
at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent(ActionContributionItem.java:47)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:827)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1529)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1291)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1343)
at org.eclipse.ui.internal.Workbench.run(Workbench.java:1326)
at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:831)
at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.eclipse.core.launcher.Main.basicRun(Main.java:247)
at org.eclipse.core.launcher.Main.run(Main.java:703)
at org.eclipse.core.launcher.Main.main(Main.java:539)

Maybe there is a low-grade and stupid error on my computer, but I can't find it just now.
I have to give up.

Alternatively, I set up JBuilder to debug Struts programs such as Java class, JSP and taglibs.
Thank you very much for your kindly reply!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to debug Struts program in Eclipse?
 
Similar Threads
Debugging Web Project in Eclipse
Debugging JSP, struts
Tomcat and Eclipse
Remote debugging app in Weblogic using Eclipse
Debug JSP