Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
 
Go Back   Zimbra - Forums > Zimbra Collaboration Suite > Developers

Welcome to the Zimbra - Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-10-2006, 05:54 PM
Zimbra Employee
 
Posts: 77
Default Remote debugging info

Here are the steps required to connect a remote debugger to the ZCS server. On the server:
Code:
zmlocalconfig tomcat_java_options
This returns the current JVM options that we pass to Tomcat.
Code:
zmlocalconfig -e tomcat_java_options="<current JVM options> -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n"
(Remove spaces before "suspend=n". I have no idea why the forum app puts them there).

If you need to debug code that runs during server startup, specify suspend=y instead. Note that if you do this, server startup will hang until a remote debugging session attaches to it. Feel free to use a different port number if you like.

Restart the server and make sure you're still able to read mail.

On the client:
  • Make sure that your source is synced to the same timestamp as the server build.
  • In Eclipse, choose the Run / Debug... menu option.
  • Choose Remote Java Application and click the New button.
  • Set Name to "Remote", Host to the hostname and Port to 8000.
  • Click Close.
Now if you ever need to debug the server, click on the down arrow next to the bug icon and choose "Remote". If you don't want to use Eclipse, connect to the server on port 8000 using any standard JDWP debugger.

Last edited by bburtin : 01-11-2006 at 11:51 AM. Reason: Typo in zmlocalconfig example
Reply With Quote
  #2 (permalink)  
Old 01-11-2006, 12:34 PM
Zimbra Employee
 
Posts: 77
Default

I just realized that our tomcat launcher is rejecting the -Xdebug JVM option, so the directions above will not work. I'll post a followup message once I figure out an elegant way around this.
Reply With Quote
  #3 (permalink)  
Old 05-24-2006, 02:35 AM
ljm ljm is offline
Project Contributor
 
Posts: 70
Arrow

If you follow the instructions above, an error message appears in catalina.out:
zmtomcatstart: error: JVM option: -Xdebug: not allowed

As a workaround, you can:
1. edit ZimbraNative/src/launcher/zmtomcatstart.c
2. add -Xdebug and -Xrunjdwp to the AllowedJVMArgs array
3. rebuild and install zmtomcatstart

tomcat then listens on port 8000 and you are happily debugging.
Reply With Quote
  #4 (permalink)  
Old 10-16-2006, 02:43 PM
Senior Member
 
Posts: 54
Default Another way

If you don't want to recompile C source, you can start tomcat with these parameters and also attach remotely. (This is for 3.1.4 BTW)

C

Code:
/opt/zimbra/jdk1.5.0_06/bin/java -Xms303m -Xmx303m  -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -client -XX:NewRatio=2 -Dcatalina.base=/opt/zimbra/apache-tomcat-5.5.15 -Dcatalina.home=/opt/zimbra/apache-tomcat-5.5.15 -Djava.io.tmpdir=/opt/zimbra/apache-tomcat-5.5.15/temp -Djava.library.path=/opt/zimbra/lib/jars -Djava.endorsed.dirs=/opt/zimbra/apache-tomcat-5.5.15/common/endorsed -classpath /opt/zimbra/apache-tomcat-5.5.15/bin/bootstrap.jar:/opt/zimbra/apache-tomcat-5.5.15/bin/commons-logging-api.jar org.apache.catalina.startup.Bootstrap start
Reply With Quote
Reply


Thread Tools
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

Zimbrablog.com




 

Search Engine Optimization by vBSEO 3.1.0