cancel
Showing results for 
Search instead for 
Did you mean: 

Remote Debugging with Eclipse

ghernando
Champ in-the-making
Champ in-the-making
What must I set in the development environment to enable remote debugging of the server code in Eclipse?

Thanks!
31 REPLIES 31

rivetlogic
Champ on-the-rise
Champ on-the-rise
Hey there,

To configure Eclipse to debug alfresco you need to do the following:

Assumption: You're using Tomcat to run Alfresco.

In Eclipse click on Run -> Debug

Under Java Application add a New Configuration and call it Tomcat or something.

Main Tab:
Under Main class put org.apache.catalina.startup.Bootstrap

Arguments Tab:
Under Program arguments put start
Under VM arguments put
-Xms128m -Xmx512m -Dfile.encoding=UTF8 -Duser.timezone=GMT
-Djava.security.auth.login.config=PATH_TO_TOMCAT/conf/jaas.config
-Djava.endorsed.dirs=PATH_TO_TOMCAT/common/endorsed
-Dcatalina.base=PATH_TO_TOMCAT
-Dcatalina.home=PATH_TO_TOMCAT
Make sure to replace PATH_TO_TOMCAT with the full path to your tomcat installation
Under Working directory choose Other and put the path to your tomcat installation

Classpath Tab:
Under Classpath delete everything under User Entries and click on Add External JARs then browse to your tomcat/bin folder and choose bootstrap.jar
Also click on Add Projects and add the project you want to debug (e.g. repository, or your extension project)

Source Tab:
Under Source Lookup Path click on Add -> Java Project and add the project(s) you're trying to debug

Click Apply then Debug and you should be good to go.

Please note that these steps are how I work and are by no means the exact steps to configure all development environments.

Hope this helps,

–Aladdin

ribz33
Champ on-the-rise
Champ on-the-rise
Hi,

Thx for this post its very helpful !

I have just a question, it seems that when i run tomcat with eclipse, alfresco dont read config files in extension directory !
But if run tomcat in standalone its working well i have my extension working.

Have you same problem ?

Thx in advance

rivetlogic
Champ on-the-rise
Champ on-the-rise
Hi,

I'm not facing this issue. I have extensions in <TOMCAT_HOME>/shared/classes/alfresco/extension and everything in there is being picked up by Alfresco.

Is that where you placed your extensions?

You could also package your extensions inside a JAR file and deploy that in the WEB-INF/lib folder inside alfresco.war. An example on how to do that is illustrated in the samples that come with the Alfresco SDK.

Hope this helps.

–Aladdin

renga
Champ in-the-making
Champ in-the-making
Hi RivetLogic,

By any chance do you have similar steps for JBoss.

Thanks!

rivetlogic
Champ on-the-rise
Champ on-the-rise
Hi,

For JBoss your best bet would be to download the JBoss IDE Eclipse plugin:

http://docs.jboss.com/jbosside/install/build/en/html/installation.html

Then follow these instructions to add your appserver and the source you want to debug:

http://docs.jboss.com/jbosside/tutorial/build/en/html/jboss.config.html

Hope this helps.

–Aladdin

mzafer
Champ in-the-making
Champ in-the-making
Hi Ribz33

How did u fix this issue, I am facing the same problem

Thanks
Mohamed


Hi,

Thx for this post its very helpful !

I have just a question, it seems that when i run tomcat with eclipse, alfresco dont read config files in extension directory !
But if run tomcat in standalone its working well i have my extension working.

Have you same problem ?

Thx in advance

dgenard
Champ on-the-rise
Champ on-the-rise
Hi,

I have experienced problems when debugging Alfresco with your configurations.
All spaces with some accents (é, è, à, …) in their name are unaccessible in CIFS (although still accessible in web UI).

Remove the following VM argument from your launch configuration for correct behaviour (at least on Windows XP).
-Dfile.encoding=UTF8 

Denis

kwantm
Confirmed Champ
Confirmed Champ
Hi,

I am not sure if this is what you want, but maybe it will give you some insights.

I myself have an standalone deployment of alfresco upon a tomcat server (the default you can download).

When I create/modify java files I package these with ant and deploy them to the server.

To debug this, I have added the following arguments to my alfresco startup file (either your alf_start.bat or alfresco.sh)

JAVA_OPTS='-Xms128m -Xmx512m -server -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044'

This ensures that you will be able to remotely suspend/debug the tomcat instance.

As client in my debugging, I use Eclipse. I have imported all projects from the repository so that I can see in all detail possible what is going on side by side with the code.

To enable debugging remotely in Eclipse you should do the following:

1. in the menu -> run -> open debug dialog.
2. click om "remote java application".
3. create a new entry here.
4. selecteer als project "web-client"
5. server = localhost
6. port 1044

Now you can start debugging from withing Eclipse upon your remote Alfresco installation.

regards,

Marc
http://www.wowww.nl

kwantm
Confirmed Champ
Confirmed Champ
in addition to remotely debugging the virtual tomcat, you can ad the same JAVA_OPT param to the virtual_alf.sh.
Dont forget to alter the portnumber otherwise it will conflict with your other debug setting.

Kind regards,

Marc
http://www.wowww.nl