aspose file tools*
The moose likes JBoss/WildFly and the fly likes Running JBoss Project in Debug Mode Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Running JBoss Project in Debug Mode" Watch "Running JBoss Project in Debug Mode" New topic
Author

Running JBoss Project in Debug Mode

Smith Sh
Greenhorn

Joined: Jan 03, 2008
Posts: 12
Hello Authors and everyone,

Its nice to have you around for answering our queries.

So here goes my two interrelated queries:


1. Is it possible to debug a web application (deployed war file) in JBoss4.0.2 using Netbeans 6.0. I have tried it without much success.

2. Moreover, If its possible then, I would like to run both the front-end and back-end of my application (both deployed in JBoss 4.0.2) together in Debug mode. So that I can test my application and its calls end to end.


Backend of my application (deployed on JBoss 4.0.2 server) is already running in Netbeans Debug mode already.


Best Regards
Sumit
Roberto Lopez Lopez
Greenhorn

Joined: Jun 16, 2008
Posts: 22
I need the same answer, but using Eclipse... I have not found any info that help me to succeed in this task.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10207
    
166

You can start JBoss in debug mode. You have to edit the run.bat file to configure the debug options. This is how i do it for Eclipse:

1) Edit the run.bat file of JBoss to use the following debug options (note the suspend=n option, this tells the server not to wait till the debugger attaches itself to the server ):




2) Start the server from the command line, using the run.bat file.

3) Once the server has completely started, i go to my (plain) Eclipse project and create a new "Remote Java Application" debug session (if it's not already created). In the "Port" text box i specify 8787 (the same as what i have in the run.bat). Then click on Debug.

The steps will be the same for NetBeans too (expect for the part where you have to configure NetBeans to listen to the debug port).


[My Blog] [JavaRanch Journal]
Roberto Lopez Lopez
Greenhorn

Joined: Jun 16, 2008
Posts: 22
OK, but at office we use Linux systems... so I change that string into

and insert it at the beginning of run.sh. When I try to start jboss, I get the following output:
=========================================================================

JBoss Bootstrap Environment

JBOSS_HOME: /opt/jboss

JAVA: /usr/lib/java/bin/java

JAVA_OPTS: -Dprogram.name=debug.sh -server -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n -Djava.net.preferIPv4Stack=true

CLASSPATH: /opt/jboss/bin/run.jar:/usr/lib/java/lib/tools.jar

=========================================================================

ERROR: JDWP unable to get necessary JVMTI capabilities. ["debugInit.c",L279]

I have done this before, and I have no idea of what to do now. Any idea? Thanks for the reply...
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10207
    
166

-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n


The debug options are repeated twice and as a result you see that error. The JAVA_OPTS probably has the debug options already set and you need not set it again. Undo the "export" you had done and start JBoss. See if the messages on console show anything about debug options (or you can post the console log here)
Roberto Lopez Lopez
Greenhorn

Joined: Jun 16, 2008
Posts: 22
I removed the final $JAVA_OPTS in the export and now the debug options isn't repeated. Anyway I still can't see any debug info at JBoss start... My debug.sh file script:
Here is the output:
=========================================================================

JBoss Bootstrap Environment

JBOSS_HOME: /opt/jboss

JAVA: /usr/lib/java/bin/java

JAVA_OPTS: -Dprogram.name=debug.sh -server -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n -Djava.net.preferIPv4Stack=true

CLASSPATH: /opt/jboss/bin/run.jar:/usr/lib/java/lib/tools.jar

=========================================================================

Listening for transport dt_socket at address: 8787
09:51:25,391 INFO [Server] Starting JBoss (MX MicroKernel)...
09:51:25,392 INFO [Server] Release ID: JBoss [Trinity] 4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)
09:51:25,394 INFO [Server] Home Dir: /opt/jboss-4.2.2.GA
09:51:25,394 INFO [Server] Home URL: file:/opt/jboss-4.2.2.GA/
09:51:25,396 INFO [Server] Patch URL: null
09:51:25,396 INFO [Server] Server Name: default
09:51:25,396 INFO [Server] Server Home Dir: /opt/jboss-4.2.2.GA/server/default
09:51:25,396 INFO [Server] Server Home URL: file:/opt/jboss-4.2.2.GA/server/default/
09:51:25,396 INFO [Server] Server Log Dir: /opt/jboss-4.2.2.GA/server/default/log
09:51:25,397 INFO [Server] Server Temp Dir: /opt/jboss-4.2.2.GA/server/default/tmp
09:51:25,397 INFO [Server] Root Deployment Filename: jboss-service.xml
09:51:25,925 INFO [ServerInfo] Java version: 1.5.0_09,Sun Microsystems Inc.
09:51:25,926 INFO [ServerInfo] Java VM: Java HotSpot(TM) Server VM 1.5.0_09-b01,Sun Microsystems Inc.
09:51:25,926 INFO [ServerInfo] OS-System: Linux 2.6.24-19-generic,i386
09:51:26,491 INFO [Server] Core system initialized
09:51:31,118 INFO [WebService] Using RMI server codebase: http://127.0.0.1:8083/
09:51:31,121 INFO [Log4jService$URLWatchTimerTask] Configuring from URL: resource:jboss-log4j.xml
09:51:31,775 INFO [TransactionManagerService] JBossTS Transaction Service (JTA version) - JBoss Inc.
09:51:31,776 INFO [TransactionManagerService] Setting up property manager MBean and JMX layer
09:51:32,100 INFO [TransactionManagerService] Starting recovery manager
09:51:32,432 INFO [TransactionManagerService] Recovery manager started
09:51:32,432 INFO [TransactionManagerService] Binding TransactionManager JNDI Reference
09:51:38,936 INFO [EJB3Deployer] Starting java:comp multiplexer
09:51:39,717 INFO [STDOUT] no object for null
09:51:39,720 INFO [STDOUT] no object for null
09:51:39,753 INFO [STDOUT] no object for null
09:51:39,853 INFO [STDOUT] no object for {urn:jboss:bean-deployer}supplyType
09:51:39,877 INFO [STDOUT] no object for {urn:jboss:bean-deployer}dependsType
09:51:44,152 INFO [NativeServerConfig] JBoss Web Services - Native
09:51:44,152 INFO [NativeServerConfig] jbossws-native-2.0.1.SP2 (build=200710210837)
09:51:46,071 INFO [Embedded] Catalina naming disabled
09:51:46,456 INFO [AprLifecycleListener] The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jdk1.5.0_09/jre/lib/i386/server:/usr/lib/jdk1.5.0_09/jre/lib/i386:/usr/lib/jdk1.5.0_09/jre/../lib/i386
09:51:46,708 INFO [Http11Protocol] Inicializando Coyote HTTP/1.1 en puerto http-127.0.0.1-8080
09:51:46,713 INFO [AjpProtocol] Initializing Coyote AJP/1.3 on ajp-127.0.0.1-8009
09:51:46,715 INFO [Catalina] Initialization processed in 644 ms
09:51:46,715 INFO [StandardService] Arrancando servicio jboss.web
09:51:46,718 INFO [StandardEngine] Starting Servlet Engine: JBossWeb/2.0.1.GA
09:51:46,912 INFO [Catalina] Server startup in 196 ms
09:51:47,234 INFO [TomcatDeployer] deploy, ctxPath=/, warUrl=.../deploy/jboss-web.deployer/ROOT.war/
09:51:48,643 INFO [TomcatDeployer] deploy, ctxPath=/invoker, warUrl=.../deploy/http-invoker.sar/invoker.war/
09:51:48,969 INFO [TomcatDeployer] deploy, ctxPath=/jbossws, warUrl=.../deploy/jbossws.sar/jbossws-context.war/
09:51:49,211 INFO [TomcatDeployer] deploy, ctxPath=/jbossmq-httpil, warUrl=.../deploy/jms/jbossmq-httpil.sar/jbossmq-httpil.war/
09:51:51,293 INFO [TomcatDeployer] deploy, ctxPath=/web-console, warUrl=.../deploy/management/console-mgr.sar/web-console.war/
09:51:52,521 INFO [MailService] Mail Service bound to java:/Mail
09:51:52,942 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-ha-local-jdbc.rar
09:51:53,028 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-ha-xa-jdbc.rar
09:51:53,113 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-local-jdbc.rar
09:51:53,196 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jboss-xa-jdbc.rar
09:51:53,420 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/jms/jms-ra.rar
09:51:53,521 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/mail-ra.rar
09:51:53,621 INFO [RARDeployment] Required license terms exist, view META-INF/ra.xml in .../deploy/quartz-ra.rar
09:51:53,673 INFO [QuartzResourceAdapter] start quartz!!!
09:51:53,854 INFO [SimpleThreadPool] Job execution threads will use class loader of thread: main
09:51:54,018 INFO [QuartzScheduler] Quartz Scheduler v.1.5.2 created.
09:51:54,022 INFO [RAMJobStore] RAMJobStore initialized.
09:51:54,023 INFO [StdSchedulerFactory] Quartz scheduler 'DefaultQuartzScheduler' initialized from default resource file in Quartz package: 'quartz.properties'
09:51:54,023 INFO [StdSchedulerFactory] Quartz scheduler version: 1.5.2
09:51:54,040 INFO [QuartzScheduler] Scheduler DefaultQuartzScheduler_$_NON_CLUSTERED started.
09:51:54,375 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
09:51:55,030 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java efaultDS'
09:51:56,154 INFO [A] Bound to JNDI name: queue/A
09:51:56,157 INFO [B] Bound to JNDI name: queue/B
09:51:56,160 INFO [C] Bound to JNDI name: queue/C
09:51:56,163 INFO [D] Bound to JNDI name: queue/D
09:51:56,168 INFO [ex] Bound to JNDI name: queue/ex
09:51:56,199 INFO [testTopic] Bound to JNDI name: topic/testTopic
09:51:56,203 INFO [securedTopic] Bound to JNDI name: topic/securedTopic
09:51:56,209 INFO [testDurableTopic] Bound to JNDI name: topic/testDurableTopic
09:51:56,216 INFO [testQueue] Bound to JNDI name: queue/testQueue
09:51:56,289 INFO [UILServerILService] JBossMQ UIL service available at : /127.0.0.1:8093
09:51:56,338 INFO [DLQ] Bound to JNDI name: queue/DLQ
09:51:56,757 INFO [TomcatDeployer] deploy, ctxPath=/NoLlego, warUrl=.../tmp/deploy/tmp57675NoLlego-exp.war/
09:51:57,080 INFO [ActionServlet] Loading chain catalog from jndi:/localhost/NoLlego/WEB-INF/chain-config.xml
09:51:57,709 INFO [TilesPlugin] Tiles definition factory loaded for module ''.
09:51:57,901 INFO [TomcatDeployer] deploy, ctxPath=/WebApplication1, warUrl=.../tmp/deploy/tmp57676WebApplication1-exp.war/
09:51:58,679 INFO [TilesPlugin] Tiles definition factory loaded for module ''.
09:51:58,686 INFO [ValidatorPlugIn] Loading validation rules file from '/WEB-INF/validator-rules.xml'
09:51:58,686 INFO [ValidatorPlugIn] Loading validation rules file from '/WEB-INF/validation.xml'
09:51:59,035 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
09:51:59,700 INFO [TomcatDeployer] deploy, ctxPath=/struts2-mailreader-2.0.11.1, warUrl=.../tmp/deploy/tmp57677struts2-mailreader-2.0.11.1-exp.war/
09:51:59,855 INFO [ApplicationListener] Initializing memory database plug in from '/WEB-INF/database.xml'
09:52:00,126 INFO [XmlConfigurationProvider] Parsing configuration file [struts-default.xml]
09:52:00,597 INFO [XmlConfigurationProvider] Parsing configuration file [struts-plugin.xml]
09:52:00,681 INFO [XmlConfigurationProvider] Parsing configuration file [struts.xml]
09:52:00,699 WARN [Settings] Settings: Could not parse struts.locale setting, substituting default VM locale
09:52:00,746 INFO [DefaultConfiguration] Overriding property struts.i18n.reload - old value: false new value: true
09:52:00,747 INFO [DefaultConfiguration] Overriding property struts.configuration.xml.reload - old value: false new value: true
09:52:01,309 INFO [ObjectTypeDeterminerFactory] Setting DefaultObjectTypeDeterminer as default ...
09:52:01,510 INFO [Http11Protocol] Arrancando Coyote HTTP/1.1 en puerto http-127.0.0.1-8080
09:52:01,539 INFO [AjpProtocol] Starting Coyote AJP/1.3 on ajp-127.0.0.1-8009
09:52:01,560 INFO [Server] JBoss (MX MicroKernel) [4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)] Started in 36s:160ms
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10207
    
166

JAVA_OPTS: -Dprogram.name=debug.sh -server -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n -Djava.net.preferIPv4Stack=true


Listening for transport dt_socket at address: 8787


This shows that JBoss has been started in debug mode. Now all that you have to do is configure Eclipse to listen on this port (as explained in my earlier post) and set breakpoints in your application.
Roberto Lopez Lopez
Greenhorn

Joined: Jun 16, 2008
Posts: 22
Ehhhhh you're right Jaikiran! Now I can debug my apps in debug mode. I even can't understand why I didn't succeed before

Thank you!!!
[ July 01, 2008: Message edited by: Roberto L�pez L�pez ]
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

Sumit, you might want to ask your debugging question in a NetBeans forum. In the book, we do not cover any IDE for two reasons. First, the book is more about configuration than about development. Second, the IDEs are moving so fast that by the time a book would be published, no one would be using that version of the IDE any more. As an example, when we stared the book, Eclipse was a 3.1. And the Eclipse foundation just release 3.4.


JBoss In Action
Smith Sh
Greenhorn

Joined: Jan 03, 2008
Posts: 12
Thanks Jaikiran and Peter

My problem is apparently solved for now and Debugging is working end to end

will do some more R&D on the same soon


Sumit
 
 
subject: Running JBoss Project in Debug Mode