Eclipse 3.4 + Tomcat 6.0 + Remote Debugging with Console Output - eclipse

I'm using this configuration:
Eclipse 3.4 + Tomcat 6.0 + Remote Debugging
It's working great, I can debug a servlet and so on, no problems.
But, my servlet console output is going to $CATALINA_HOME/logs/catalina.out.
Is that possible to redirect to the Eclipse console window?
I use Log4J in my project but every entry goes to catalina.out and not my console window. It's really annoying.
Thanks.

I'd recommend getting the LogFile Tools plugin for eclipse: http://sourceforge.net/projects/logfiletools/
It gives you a new log file view that you can add word-based highlighting and essentially tail any file (such as the tomcat log). I usually have it highlight errors in red, for example so they pop out when viewing the log.
The other alternative is to actually start tomcat from within eclipse. You can do this via the eclipse web tools (a bit heavy) or the sysdeo tomcat launcher plugin (lightweight but doesn't do much but launch and update contexts)
Hope this helps!

Related

Can I use Tomcat 8.0 in Eclipse Indigo 3.7.2?

I'm doing a project right now, and I'm using Tomcat 7.0 running in Indigo Eclipse IDE, but I need to use Tomcat 8.0 because it supports servlet 2.4...
Well, I searched (and researched) a lot, but I only found answers and advice for others versions of Eclipse, like Luna, Sun, and stuff xD... but no Indigo was there.
When I tried to configure my server in Eclipse, it only showed the 7.0 version of Tomcat.
I'm starting with this, so I don't remember all of Eclipse's vocabulary...
Please help me. Thank you very much !
The Sysdeo Eclipse Tomcat Launcher plugin maybe what you want. You point it to an external Tomcat installation and it provides everything you'll need:
ability to configure JVM Options (-D command line switches)
a start/stop button in the Eclipse UI
console output from Tomcat inside Eclipse
debugging bindings so you can breakpoint a running Tomcat app
I've use it for years, works on all versions:
http://www.eclipsetotale.com/tomcatPlugin.html

Debug a remote JBoss's GWT App in Eclipse

It works to debug Java code running on a remote JBoss server on Linus, Eclipse runs on Windows. The code is can be traced with Eclipse's debugger and JDT. The ear is maven built.
Now I try to debug also the GWT Java code with Eclipse remote debug. Do I understand right, that this should be possible with com.google.gwt.dev.DevMode ? I do not want to use Superdev and Javascript, I very much prefer to debug Java in the Eclipse Debugger.
Has anybody tried this?
If you use GWT 2.7, the DevMode is deprecsted and should no longer be used.
The debug way is the SuperDev Mode, you debug with the browsers builtin javascript debugger and a sourcemap that translates to the cirrent java line. The jboss is out of scope here, because everything happens in your browser.
Excellent support for sourcemaps is in chrome.
I got it to work with the help of this: Is it possible to debug GWT client code on a REMOTE server using IntelliJ 9 Community Edition?
Chrome 41 as browser with GWT Developer Plugin,
URL for the appp is http://linux:8080/myapp/?gwt.codesvr=127.0.0.1:9997
add -nosuperDevMode to the launch config,
add javaee.jar from Glassfish 4.1 to the top of its classpath

How to customize the console colors of GlassFish's errors in Eclipse IDE

I've came to a point where the console log's colors of GlassFish in Eclipse are annoying me.
Unlike Tomcat that prints errors in red and stacktraces in blue with the possibility to click on a stacktrace element, GlassFish prints everything in black (very ugly formatting).
This of course makes it difficult to quickly debug, it's actually a headache.
So I'm wondering whether there's a way to make the output of GlassFish errors in the Eclipse console look more "beautiful" or at least look like Tomcat's errors.
p.s: I'm using Eclipse Java EE Juno and GlassFish 3.1.2 (server adapter tools installed)
The following should work to 'colorize' any Console log in eclipse.
There is a plugin called Grep Console which highlights or colors Console log based on string patterns in the output.
Update Sites
Grep Console 2
http://eclipse.musgit.com
(requires Eclipse 3.4 (Ganymede) or higher and Java 5.0 or higher)
Grep Console 3
http://eclipse.schedenig.name
(requires Eclipse 3.7 (Indigo) or higher and Java 6.0 or higher)
Usage
Once you have installed the plugin using the Update Site, you should see an icon in the console view which should allow you to add Expressions (regular expressions) against which output in the Console is matched and formatting that you choose (backgroud color, foreground color etc.) is applied.
Screencast
Please see this screencast which shows the whole process.
New version (3.x) released.
I received a comment from the creator of the Grep Console plugin. He mentioned that Grep console 3 is has been released. I have added the link to the update site above (take a look at the requirements; if you are on an Eclipse version < 3.7 then you'll need to used v2.x of the Grep Console)

How do I debug Lift applications in Eclipse?

I come from a background in C++, Python, and Django and I'm trying to expand my horizons and learn Scala and Lift. However, I'm having a really hard time figuring out how to debug Lift applications using eclipse.
I can create projects using some of the lift sbt templates and run them no problem. However, I haven't been able to start the application from within Eclipse because it can't find Jetty, and as a result, I'm not able to use the debugger to step through the Lift code. Weeks of googling haven't helped much.
Could someone share their methods or suggestions? I'm also new to the jvm, so feel free to share best practices or point out important differences that I may be missing.
Ok, I've gotten this figured out.
So I'm not actually launching the application from the Eclipse debugger. I'm starting the application through sbt, and then connecting the Eclipse remote debugger to the sbt vm that's running the webapp.
Here's what I did:
Assuming you have sbt-launch.jar in /bin:
Create the file /bin/sbt_debug with permission to execute and containing this line:
java -Xmx512M -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 -jar /bin/sbt-launch.jar "$#"
What this script is doing is starting sbt and instructing the jvm to allow debugging on port 5005
Go to your lift project directory in your terminal and enter sbt_debug. Once you're in the sbt console enter container:start / container:update or ~jetty:start / ~jetty:update depending on which version of sbt you're using.
Next go to Eclipse, click the debug icon and select "Debug Configurations..."
On the left column, click "Remote Java Application" and create a new debug configuration. Set the Port to 5005.
Hit the Debug button and the Eclipse debugger should now be debugging the sbt process you started earlier
Note: This is the first method that has worked for me. If you have one that is better, please share
I've found the most useful tools to be the SBT Eclipse Plugin and the RunJettyRun plugin for Eclipse. The former will allow you to generate Eclipse config files based on your SBT setup and the latter will launch Jetty from Eclipse with the debugger attached. An added bonus is that generating your Eclipse config using "eclipse with-source=true" from the SBT prompt will download and attach src jars as well so you can step through Lift and any other 3rd party libraries you depend on as well as your own code.

Debugging a tomcat project in Eclipse 3.4.2

I downloaded eclipse 3.4.2 and tried installing tomcat plugin (version 3.2.1)for eclipse from sysdeo (http://www.eclipsetotale.com/tomcatPlugin.html)
I have followed installation instructions but when is start tomcat from eclipse toolbar i got the following error
java.lang.NoClassDefFoundError: org/apache/tomcat/util/log/SystemLogHandler
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
at java.lang.Class.getConstructor0(Class.java:2671)
at java.lang.Class.newInstance0(Class.java:321)
at java.lang.Class.newInstance(Class.java:303)
at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:205)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:390)
I did follow troubleshoot instructions but no success.
I tried to putting plugin in dropin directory too but still got the same error.
This was working fine in eclipse 3.2 and 3.3
Then I tried using standard inbuilt WTP to set up my tomcat server. I am not sure how it will pick my server.xml in conf directory of tomcat, it seems it is not picking as of now.
How do I associate my eclipse project with this setup. I am able to start the server but when i browse the tomcat start page, it does not show anything.
I would appreciate if someone can provide some ways to fix this.
Thanks in advance.
-Dipesh
After trying out few things I was able to debug tomcat project in eclipse 3.4.2
To debug tomcat application/project using eclipse 3.4.2 use WTP plugins which are installed along with it.
Go to Window --> Show View --> Others --> Server
In this view create a new server, please select tomcat installation directory and version information.
Then double click on Tomcat VX.X Server at local host, it opens up configuration settings page
In the Server Locations Section select "Use Tomcat Installation (takes control of Tomcat Installation) and enter deploy path.
In the publishing section select Never Publish automatically and uncheck update context path checkbox.
Voila!! All set to debug tomcat project in eclipse 3.4.2
There is no need to download and copy any extra plugin.
Thanks Juri. Hope this helps.
I'm using Tomcat with Eclipse Java EE version with WTP and it works perfectly. I have Ant scripts which deploy my web app to the tomcat webapp folder. In order to debug, you have to open the Server view in Eclipse, add a new server and choose the correct Tomcat version. Once that's done, open the configuration of Tomcat within eclipse by double-clicking on the server entry in the Eclipse server view you just created. On the left-middle side of the confguration page you should see something like "let Eclipse control the native Tomcat installation", I don't remember the exact text now. You have to choose that. Then you can set a breakpoint in your source code and then start Tomcat in debug mode from within Eclipse's server view.
Hope that helped.
If you are using the Sysdeo plugin, then you don't want to also be using the standard Eclipse WTP servers. To use the Sysdeo plugin, you need to have already downloaded and extracted a standard zipped tomcat directory. Make sure to define CATALINA_HOME in your path. Then, assuming you've correctly installed the sysdeo plugin, go into Eclipse->Windows->Prefs->Tomcat (this is Sysdeo's Tomcat settings, and not the WTP settings). You need to tell the plugin where you've extracted your Tomcat directory, and set it to use Context files.
Now create a new Dynamic web project. Right click it, and go into its properties->Tomcat.
Check it as a 'Tomcat Project'. Give it a context name, and also tell it the directory which would be the base of your war (by default, Eclipse has named this WebContent, I believe). Apply it and close the Window. Right click again your project, and go to the Tomcat section. Add the 'Tomcat Libraries to Build Path' so you can use the Servlet/JSP classes. Finally, click on 'Update Context'. If you go into your Tomcat directory under Conf, you'll see that the plugin has created a context for you that points to your Eclipse workspace. No need for deploying the app to the Tomcat directory. Now, you should be able to click on the Sysdeo Tomcat 'start' button, and your app should be able to connect to your app at localhost:8080/context_name.
HTH,
Bill
Using the excellent Findjar web page for:
org/apache/tomcat/util/log/SystemLogHandler
gives the following:
Information on class org.apache.tomcat.util.log.SystemLogHandler:
Containing JAR files:
jbossweb.jar
gwt-dev-windows.jar
tomcat-util-3.3.2.jar
tomcat-util-4.0.6.jar
tomcat-util-4.1.31.jar
tomcat-util-4.1.34.jar
tomcat-util-4.1.36.jar
tomcat-util-5.0.16.jar
tomcat-util-5.0.18.jar
tomcat-util-5.0.28.jar
tomcat-util-5.5.12.jar
tomcat-util-5.5.15.jar
tomcat-util-5.5.23.jar
tomcat-util-5.5.4.jar
tomcat-util-5.5.7.jar
tomcat-util-5.5.9.jar
tomcat-util-5.5.7-alpha.jar
tomcat-util-5.5.8-alpha.jar
tomcat-util-5.5.9-alpha.jar
Ensure the appropriate jar file is in your CLASSPATH.