Need help setting up a (Tomcat) web app in Eclipse for debugging - eclipse

I've been using both eclipse and tomcat for years but have always deployed my web apps externally and never had a problem. Now I'd like to use eclipse to debug my web app and I can't figure out how to make it work. I started by trying to get my existing web app to deploy through eclipse but after hours of trying different things I decided to start fresh. Unfortunately, I didn't get much further. I'm hoping if I can figure out how things work with a fresh webapp I can get things to work on my existing. Sorry, this will be long, but here are the steps I tried on the latest eclipse (Juno):
Installed new version of tomcat 7.0.34 at /usr/java.
In eclipse, used "servers" view to add server, pointing to the new install (I didn't add any resources because there weren't any available yet). Starting the server worked and got a 404 as expected at http://localhost:8080/ ... then I stopped it.
Created a new "dynamic web project", named it TomcatDebug, set the location to ~/tomcat-debug, chose the server just created above (the only one), chose default config, tomcat-debug is empty so chose defaults for build paths, defaults for module settings and had it generate web.xml.
In the "tomcat-debug" folder it creates WebContent, build, and src. I throw a sample "hello, world" index.html into WebContent.
Now the project TomcatDebug is created so I try to run it, tell it to "run on server", and it goes to http://localhost:8080/TomcatDebug/ but gives a 404. I even try to add index.html but it still gives a 404.
This is about as basic as it can possibly get so what did I do wrong?
Continuing to try and figure this out I stop the server, change the server setting to "use tomcat installation", but still get a 404 in the same way when I restart. I tried changing my module context path and still 404.
I'm completely stumped. I believe I followed all the wizards as basically as possible. Where did I go wrong?
Thanks for taking a look.

I haven't run tomcat through eclipse in a while, so can't answer that aspect of the question. But, to get at the heart of what you're trying to do (debug a webapp in eclipse through tomcat), you shouldn't necessarily need to. This may serve you instead:
EDIT: Eh, look here for instructions ("Debugging" section). The below is how I did it (JUNO and TC 7) and has an annoying quirk in point #1.
edit the startup.sh (assuming *NIX/OS X) - the last line will probably be
exec "$PRGDIR"/"$EXECUTABLE" start "$#"
change this to
exec "$PRGDIR"/"$EXECUTABLE" jpda start "$#"
to activate debugging. (there are other ways to do this that may be better - i think tomcat/the VM may pause for listeners before proceeding, so when you aren't debugging this is not ideal)
Create a Debug Configuration in eclipse, under the "Remote Java Application" set. Default port should be fine, and presumably host. Choose your project.
Add sources of relevance to your debugging in the Source tab.
Start server and run your new debug configuration. App should stop at breakpoints you've set.

Right Click your index.html Run As -> Run On Server you will see Tomcat will automatically run the page.

Related

WebSphere Debugger not stopping at breakpoints in Eclipse

I have deployed my application on WAS 8 as debug. The server status is [Debugging, Synchronized]. When I put breakpoints and start the application, it doesn't stop at the breakpoints. I don't see the debugger thread start either.
I am using RAD 8.0.4 and JDK 1.6.0_31. I have tried cleaning the project and re-deploying but it still doesn't work.
I was able to get it working via a complete clean install of my app. Then removing it from the server via add remove. Clearing cache from the websphere/profiles/myprofile directory. and clearing all bits of my app from the profiles folder via a search for its containing file aka (myproject-folder). Then re-installed the app via add remove on the server and it worked for me.
Best guess I have is something was actually out of sync even though the server though everything was A okay.
WebSphere is a PITA and seems to get out of state too easily.
I'd restart the server and perhaps do a clean on the server (right click on the server, click "Clean...". If that doesn't work, you'll have to take a careful look at the location of your break points. They might not be on code that's getting executed. Place a break point further upstream if necessary, follow it down just to confirm the flow.

Could not find or load main class in both Tomcat and Workspace

I have been tasked with adding some new features in a project I worked on a while back. It's been given some new features since I last worked on it, and the development environment has changed. I'm having a lot of troubles bringing my environment up to date with all the dependencies and external folders.
After solving a host of problems, when running the Tomcat 7 Server in Eclipse I was coming across a message:
Error: Could not find or load main class Path\To\Workspace\.metadata\plugins\cont
I tried deleted the Tomcat Server and then recreating it with the same settings, as well as deleting my .metadata folder from the workspace. Now I can't even get Tomcat to configure right:
Error: Could not find or load main class Files\ApacheSoftwareFoundation\apache-tomcat-7.0.26.
Why isn't this working? It worked before I added a couple of needed subdirectories but I'm stumped now.
Just was searching for the same problem in Eclipse("Could not find or load main class").
It turned out in my case that there was an extra space in launch configuration arguments tab. (In Java EE perspective go to Servers, click on Tomcat server, in Overview window select 'Open launch configuration' and then go to Arguments tab). Arguments are listed as
-Dx.y.z=1 -Da.b.c=2 ...
and so on, but as the dialog itself is small and arguments go across multiple lines it's not always clear where there is a space and where there is a new line. In my case it was
-Dx.y.z =1 -Da.b.c=2 ...
(there is a space before =1) which confused Tomcat and I got "Could not find or load main class" error.
It's not necessarily your case but somebody else can come across this and find it to be the answer.
In the .metadata folder eclipse saves it's internal configuration, so you should not affect it manually. The errors give you the clue to get that resource it's looking is not accessible what ever it exists or not. Try to find it manually to check if it exists, then try to make it accessible, fix the path, change permissions, etc. May be you have classpath issue, who knows.
In Eclipse I added a Tomcat Server and it was working fine. I stopped the server to alter the settings. Specifically, I checked the 'Enable security' box. When I tried to start, I got this error. So I unchecked the box and tried to restart the server - same error. This thread led me to check the launch configuration VM arguments. Sure enough, Eclipse had not handled the checkbox (and unchecking it) correctly. The VM arguments had two places where it repeated strings without quotes. Check there to see if it has been malformed.

Cannot load anything on Tomcat 7 : configuration issue

I'm currently developing a web project running on Tomcat 7 and I cannot see anything who's suppose to be on Tomcat (blank page when I do a HTTP request in my browser).
My Modus Operandi:
I launch a new instance of server in locahost (apache-tomcat-7.0.34) within Eclipse (I work with Indigo and tried with Juno as well)
Tomcat's ROOT folder has been pasted in the 'wtpwebapps' folder of all my servers in my Workspace
I add a simple web project on this server instance and try to access it from a HTTP request and I get a blank page. If I try to run a .html file of this web project on this server, I get a 'HTTP 404 Not Found' Error.
What I tried:
I tried to build the whole configuration from scratch (new Eclipse, new Apache-Tomcat) and I still get the same result. But when I do that from my personal computer at home, everything's working fine!!
I tried to put an old version of my code or a tutorial project, but nothing can be launched (therefore, it must be a configuration issue).
I checked the server.xml and web.xml files and nothing looks suspicious (I can paste them if you want but those are the same than those who worked at home)
The only thing I can think of is that I changed the internet connection (and the IP address) of the computer I'm working on, but I don't think it could make any difference when trying to reach localhost, right?
When I follow the steps of the very good tutorial, I do get a blank page on the 'Run Tomcat' topic, but I don't get the Tomcat welcome page once I copied the ROOT folder into "wtpwebapps".
Does someone have any idea where it could come from?
Ok guys, finally got the solution.
I was about to format my computer when i realize that the port 8009 was actually used by another process.
I thought that's the kind of things who are checked when you launch a Tomcat server within Eclipse but it didn't show any error.
The HTTP request went through the port 80, but as the default AJP port is already in use, Apache could not forward this request to Tomcat, therefore a blank page was returned.
At least that's my understanding of this situation...
Hopefully this may help someone who'd run into a similar situation.
Thanks for your help.

Google App Engine Eclipse Launch Local Host Multiple App Conflict?

I have two GAE projects created through pydev in eclipse 4.2 (windows 7) and the first one I had no issues running the localhost:8080 but when I created a second project, I duplicated the Run Configuration for local run adn just changed the project name to the new one.
However- when I run that config the inital HelloWorld project shows up[ in my browser, I tried completely removing the first project, but then it just ocmplains it cant fint app.yaml in the old directory (because the old directory isnt where it was).
So clearly I'm missing some setting in the launch procedure where it sets the root path.
The run config is a PyDeb Google App Run, main module points to
C:\program files (x86)\google\google_appengine\dev_appserver.py
And the arguments are
${project_loc}\src
Everything else is on the default settings.
Any help would be greatly appreciated as pushing to Google (which works fine for both) for every little debug iteration is driving me a bit crazy.
Thanks!
*EDIT: Forgot to mention I have already tried to delete all runconfigs and remake.
Have you tried Run as : PyDev Google App Engine Run, to create a new runconfig?
Turns out I'm just a bit silly. In eclipse, I wasn't properly turning off (not sure on the correct term there) the LocalHost for the first project before starting the second. To fix, I needed to go Into eclipses console window, and select "display selected console" and choose the project I wanted to stop and hit the stop all button. Then it runs fine.
Hope this helps someone in the future, that is as determined as me that "It can't be my fault".
Cheers.

ColdFusion debugging problem in Eclipse (Break points not hit)

I am trying to get the debugger (CF extension for Eclipse) working for last few hours. And struck in strange situation.
My settings are listed below
ColdFusion 8
Eclipse 3.4
I set up the RDS & modified the JVM.config settings and verified the connection & debugger, both returns successful in test run. But When i attach a debugger to the site, breakpoints are not hit.
My Eclipse workbench & site virtual directory pointing to the same path. It is in a remote server.
I left Eclipse-CF mapping blank since both pointing the same remote path.
And i am using WYSE thin client emulator.. does it anything to do with this..?
Can someone help me to resolve this problem?
Cheers
If your eclipse configuration is ok, could be that something is not confgured right on server side. Check if Line Debugger Settings > Allow Line Debugging feature is enabled and that Debugger Port (5005) is opened and accessible form client machine.
Articles that should walk you through proper setup:
http://eclipse.sys-con.com/node/382427
http://www.adobe.com/devnet/coldfusion/articles/debugger.html
Also you could try using CF Builder and/or FusionDebug http://www.fusion-debug.com/fd/ .
You do need to specify at least one mapping. Eclipse needs to know what folder in your project maps to the http root. Even if the mapping is / -> /, you need to specify that. The only time you can leave mapping blank is when the CF server is on the same machine as Eclipse.