The best place to ask programming/development questions, imo. UPDATE: stackoverflow is the *worst* place to *ask* questions (if your first question/comment doesn't get any up-rating/response, then u can't ask anymore questions--ridiculously unrealistic), but a great reference for finding answers.

My Music (Nickleus)


how to configure eclipse to run jboss in debug mode using jsf 1.2, richfaces 3.3, seam 2 and ejb3

i'm developing a java ee project in eclipse indigo using the following technologies:
jsf 1.2
richfaces 3.3
seam 2
a mix of ejb2 and ejb3
jboss trinity 4.2.2.GA
sun java 1.6.0_26 (64-bit)
ubuntu linux 12.04

NOTE: you do not have to install jboss tools or any additional plugins after a clean install of eclipse in order to debug your project on jboss in eclipse, however you might want to install additional useful plugins like JRebel and JBoss JSF support

all you have to do in order to start your server in debug mode in eclipse is to configure your jboss server in eclipse:
find the Servers tab
new > server > jboss v4.2 > finish

UPDATE for Eclipse Juno

new > server > jboss v4.2 > next

set the Application Server Directory value:



now double click your new server JBoss v4.2 at localhost.
i increased the Timeouts > Start (in seconds) from 50 to 120 (just in case) and the Stop (in seconds) from 15 to 30.

i set Server Properties > Address to so other people on the network can connect to my server.

set the correct port, e.g. for my project i use8080

if you've installed the JRebel plugin, then check the box that says "Enable JRebel agent"

click the Runtime Environment link and set the Application Server Directory to your jboss home, e.g. mine is /usr/jboss

click the Open launch configuration link and choose the Arguments tab. i got the values for Program arguments and VM arguments by first running jboss the normal way, from the console in the /usr/jboss/bin folder (outside of eclipse):
cd /usr/jboss/bin
./ is just a personalized version of, in the same folder, and looks like this:

echo "deleting log files..."
rm -rf /usr/jboss/server/mydomain/conf/my-config/logs/*
echo "deleting temp files in mydomain..."
rm -rf /usr/jboss/server/mydomain/log/*
rm -rf /usr/jboss/server/mydomain/tmp/*
rm -rf /usr/jboss/server/mydomain/work/*
rm -rf /usr/jboss/server/mydomain/data/*
/usr/jboss/bin/ -b -c mydomain

then i grep java processes in another terminal to get the correct/working java options:
ps aux|grep java

which gives an output like this:
/usr/lib/jvm/java-6-sun/bin/java -server -Xms128m -Xmx512m -XX:MaxPermSize=128m -XX:PermSize=128m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dorg.jboss.logging.Log4jService.catchSystemOut=false -Djava.endorsed.dirs=/usr/jboss/lib/endorsed -classpath /usr/jboss/bin/run.jar:/usr/lib/jvm/java-6-sun/lib/tools.jar org.jboss.Main -b -c mydomain

so the value for Program arguments in Open launch configuration > Arguments:
-c mydomain -b

and VM arguments: -server -Xms128m -Xmx512m -XX:MaxPermSize=128m -XX:PermSize=128m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dorg.jboss.logging.Log4jService.catchSystemOut=false -Djava.endorsed.dirs=/usr/jboss/lib/endorsed -classpath /usr/jboss/bin/run.jar:/usr/lib/jvm/java-6-sun/lib/tools.jar org.jboss.Main

in the Source tab, add your project:
Add > Java Project > select your project, OK

in the JRE tab, make sure the JRE is correct, e.g. java-6-sun-

click OK then ctrl-s in the server configuration window (if it has a star by the name in the tab), i.e. if the tab looks like this: *JBoss v4.2 at localhost

(NOTE: build your project if you haven't already)

now in the Servers tab choose Debug.
now you're up and running (debugging) =)

No comments:

Post a Comment