Introduction
I'm assuming that the alfresco 4.0.2 installed
with inbuilt tomcat and in c:\alfresco folder.
Configure the tomcat the
jpda start option. Go to the following directory
in the command window.
c:\alfresco\tomcat\bin directory and create the following environment variables.
(Adjust the memory to overcome permGen memory
issue.)
set CATALINA_OPTS=-server -Xmx384m -XX:MaxPermSize=192m
set JPDA_ADDRESS=8000 and press enter
set JPDA_TRANSPORT=dt_socket and press enter
Now we need to start tomcat in debug mode.
c:\alfresco\tomcat\bin>catalina.bat jpda
start
Now open Eclipse and open your project.
Go to Run menu -->Debug configuration-->Remote Java application-->New Launch
Configuration-->Select your Projecthere--> [Don't do anything apart from this]
check the box marked "Allow termination of remote JVM" --> Click Apply--> Click
Debug button.
Now, the eclipse will the window perspective to Debug perspective and if you have the
breakpoints in your code, the debugger will hit it.
Please find the original blog here.