Saturday, January 31, 2009

Debugging with the Maven Jetty Plugin in Eclipse

Step 1
Go to the Run/External Tools/External Tools ..." menu item on the "Run" menu bar. Select "Program" and click the "New" button. On the "Main" tab, fill in the "Location:" as the full path to your "mvn" executable. For the "Working Directory:" select the workspace that matches your webapp. For "Arguments:" add jetty:run.

Move to the "Environment" tab and click the "New" button to add a new variable named MAVEN_OPTS with the value:

-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=y

If you supply suspend=n instead of suspend=y you can start immediately without running the debugger and launch the debugger at anytime you really wish to debug.

Step 2

Then, pull up the "Run/Debug/Debug ..." menu item and select "Remote Java Application" and click the "New" button. Fill in the dialog by selecting your webapp project for the "Project:" field, and ensure you are using the same port number as you specified in the address= property above.

Now all you need to do is to Run/External Tools and select the name of the maven tool setup you created in step 1 to start the plugin and then Run/Debug and select the name of the debug setup you setup in step2.

From instructions provided by Rolf Strijdhorst on the Maven mailing list

Stopping Jetty

In order to stop the jetty server the "Allow termination of remote VM" should be checked in debug dialog in Step 2. When you have the jetty server running and the debugger connected you can switch to the debug perspective. In the debug view, right click on the Java HotSpot(TM) Client VM[localhost:4000] and  chose terminate. This will stop the debugger and the jetty server.

Tuesday, January 13, 2009

Jboss tools Visual Editor does not start under Linux

I found this which solves problem. http://www.jboss.org/community/docs/DOC-10862

Q : Visual Editor does not start under Linux

 

A : Linux users may need to do the following to get the visual editor to work correctly on their machines.

 

  • The Visual Page Editor requires the library libstdc+.so.5. This library is contained in the compat-libstdc+-33.i386 package.

 

    • To install this package on Fedora Core or Red Hat Enterprise Linux run the following command:

yum install compat-libstdc++-33.i386

 

    • On any other rpm based distributions download libstdc++.so.5 and run the following command:

rpm -Uvh compat-libstdc++-33.i386

 

    • On Debian and Debian based distributions (e.g. Ubuntu) run the following command:

apt-get install libstdc++5

 

  • In case you have the library installed and you still have issue with starting the visual page editor then close all browser views/editors and leave one visual page editor open and restart eclipse. This should force a load of the right XULRunner viewer.







Tuesday, January 6, 2009

Change SVN log error

I'm using Subversion and needed to change a revision property (in my case, the log message) of a particular revision of the code. When I tried to do it with TortoiseSVN (Show log > Right click on a revision > Edit Log Message), I got the following error message:

DAV request failed; it's possible that the repository's pre-revprop-change hook either failed or is non-existent

Basically, Subversion doesn't allow you to modify log messages because they are unversioned and will be lost permanently. They don't want you screwing things up by accident! Therefore, you have to set up a hook script that the Subversion server will invoke when you try to change the log message in TortoiseSVN. In the case of log messages, you need to set up a pre-revprop-change script. There are other 'hooks' such as post-commit which allows you to run some custom stuff after you've made a commit. These hooks are located in the hooks subdirectory of the Subversion repository directory on your server. Inside that directory, there are a bunch of template scripts (e.g. pre-revprop-change.tmpl) that can be modified to be used for your particular repository. If you're running the Subversion server on UNIX, setting up the pre-revprop-change script (so that log messages are allowed to be modified) can be done like this

  • Go to the hooks directory on your Subversion server (replace ~/svn/reponame with the directory of your repository)

cd ~/svn/reponame/hooks

  • Remove the extension

mv pre-revprop-change.tmpl pre-revprop-change

  • Make it executable (cannot do chmod +x!)

chmod 755 pre-revprop-change

Now try modifying the log message again.

Google+