Generally, Java EE applicationsProgramIn the development process, everyone is used to using
Tomcat serves as the debugging server, corresponding to
Debugging tomcat in IDE is also very easy. You can download the tomcateclipse plug-in to easily debug applications in IDE (see
Com. sysdeo. Eclipse. Tomcat ).
However, if the application is enterprise-level and requires EJB container deployment, Tomcat will be powerless. At this time, we can select JBoss as the debugging server.
How to automatically build and deploy the application to the deploy directory of JBoss is not the focus here. The project generated by JBoss Seam-gen contains the ant script for automatic building and deployment in eclipse, for more information, see.
To debug JBoss in IDE, we need to first check how JBoss is started: Take JBoss 4.2.x as an example, run. bat has the following two statements:
"% Java %"
% Java_opts % ^
-Djava. endorsed. dirs =
"% Jboss_endorsed_dirs %"
^
-Classpath
"% Jboss_classpath %"
^
Org. JBoss. Main % *
Find outVariable % jboss_endorsed_dirs % = jboss_home/lib/endorsed,
% Jboss_classpath % is better understood.
Jboss_home/lib and the classpath required by the application.
Now that you understand the principle, set a launch in eclipse, open the launch definition window through "Open Run dialog...", and create it.
In "Main class", enter org. JBoss. Main.
Of course, you need to add the jboss-system.jar to the classpath of the project. Then in arguments-> VM arguments
-Djava. endorsed. dirs = D:/jboss-4.2.3.GA/lib/endorsed
In this way, you can run this launch to start the JBoss application server in the IDE.
Finally, do not forget to set it in sourcecodeSource codeDirectory to facilitate debugging.