Catch up on stories from the past week (and beyond) at the Slashdot story archive

 



Forgot your password?
typodupeerror
×
Programming IT Technology

Developing (and Debugging) Java Servlets on Linux. 9

Bryan asks: "What do you use to develop, debug and test java servlets on Linux? I am especially interested in debugging tools and techniques, especially those that use Apache+mod_jserv." I've just started using mod_jserv recently and am very happy with it. Something like this could sure help my development activities and I'm sure others are looking for something like this as well.
This discussion has been archived. No new comments can be posted.

Developing (and Debugging) Java Servlets on Linux.

Comments Filter:
  • I've done several servlets all with vi and Makefiles, which (as you've probably found) doesn't lend itself to easy debugging in some cases. For simple servlets I've found that either printing to the server log or to HTML comments in the output work pretty well. This assumes that you know roughly where the problem(s) might be. Normally I enable debug output with a query parameter, and if you put all this into comments the page looks the same, just view the source for the debug information.

    For more complex debugging IBM's VisualAge for Java [ibm.com] can run a servlet engine (Tomcat [apache.org]) inside itself and allows stepping though servlets with all the windowed debugger features that you'd expect. I'm sorry, but I can't find the directions for setting this up.

    I'd imagine that other Java IDEs have some kind of support for running servlets so they can be debugged, however IBM's VA is the only one I've seen do this.

    I still tend to use debug output in HTML comments, I find it works best for me. Although I often build a simple test harness for each class so I can test it by itself. Means I do less debugging once everything is put together and running as a servlet.

  • I just finished doing a servlet under IBM VAJ and Apache JServ, and aside from from classpath issues, it went well. Make sure you specify all your JAR files in the JServ setup, and check the server log when you have problems. I didn't try running Tomcat in VAJ, but I did read where that can be done. It would certainly be easier, and VAJ is available for anyone.
  • by Xamot ( 924 ) on Thursday March 02, 2000 @12:50PM (#1230397)
    I was just meaning to look up how to do this. I found this [sun.com].

    To summerize, if you can start the servlet engine's VM in debug mode you can then connect to it with a remote debugger like jdb. You have to get the password from wherever the VM's standard out goes. The page I listed up above gives directions on how to do this with the JSDK's Java Web Server.

    As far as other developement. I've been using iPlanet [iplanet.com]'s iWS 4.1 beta. It works pretty good. I haven't tried setting Tomcat up yet, but on the Tomcat [apache.org] mailing list they are getting together a beta for version 3.1 which is VERY close to meeting the Servlet 2.2 specs and will be the reference implementation once it is done. The beta release canidate 1 should be up today.

    As somebody else mentioned standard out and the servlet response are also good places to send information especially if you don't want to run your VM in debug mode or can't. One thing about iWS 4.1, I don't think the standard out and standard error are directed to a file by default. I had to open my own servlet logging files and redirect System.out and System.err to them myself from within a servlet.

    For developement I use JBuilder on NT, and vim occasionally under linux. I have had no platform problems with moving my Java class files from NT to linux. On linux I am using the latest blackdown release of the JDK. In fact for one application I have the web server (iWS 4.1 beta) running under linux and it loads pre-compiled servlets that exist on an SMB mounted directory that exists on an NT machine. It hasn't acted any different from the web server running on NT with JRun as the servlet engine. (well I had some JSP problems, but that was a difference in implementation of the JSP specs between iWS and JRun)

    --

  • is no way at all. simply use pico to edit yer files, write an automated script to compile and use System.out.println to write out debugging info. use a tail -f /var/log/httpd/errorlog or whatever to view the info in real time.
  • I just started using the newest version of JBuilder for linux [borland.com] and I have to say I'm pretty disappointed. I've used an older version in Windows before and it was pretty decent. Of course, it was also the first time I used an IDE instead of Emacs.

    Jbuilder for Linux is quite unstable (using JDK 1.2.2) and has other annoyances (like I can't copy/paste to other X apps). And it's pretty darn slow on my PII-266 (even with 160MB memory) too.

    I think I'm going back to emacs...


  • Here's the link [ibm.com] for the info on VisAge servlet development.

  • I've just spent about three months doing java servlet work.

    I've been using JBuilder, which works great for debugging, but it's on win95 (ugh). Someone else said that the linux port is horribly slow, unfortunately.

    I'm just going to give you a little advice, vaguely related to what you asked.

    tail -f the logs. In your jserv/logs directory there are three relevant logs -- mod_jserv.log, error.log, and jserv.log. I think there may even be hooks in the language to write to the logs from your program, or make your own logs. Logs are very nice.

    (offtopic, but not really) I've found the best place to find answers about problems is probably the sun java developers forums. The apache project has some pretty cool stuff too.

  • Here [sun.com] is a more information about debugging java programs. It also has a list of applications that use the JDPA. Some of them being stand alone debuggers.

    I tried one out last friday, JSwat. I thought it was ok, but still needs quite a bit of work and is more geared toward loading the class itself and debugging locally then attaching to a running VM. But it can do that.

    --

Real Programmers don't eat quiche. They eat Twinkies and Szechwan food.

Working...