Tag Archives: jboss

JBoss remote debug

jboss_logo
To connect to JBoss application server remotely you should perform next action:

open run.conf.bat (for windows) or run.conf (for linux) file in JBoss bin folder
and add the following java argument:

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

If you miss -Xdebug parameter you can enter to debug mode but after timeout (a few minutes) you’ll be disconnected and JBoss restart occurred!
Read more at http://stackoverflow.com/questions/18182666/eclipse-remote-debugging-with-jboss.

Thanx to http://stackoverflow.com/a/18211332

JBoss Server restart in BATCH

When JBoss is restarting, it is useful to delete all temporary files. Here the script do it:

@echo off
setlocal enableextensions enabledelayedexpansion

sc stop JBoss
timeout /T 60

set pathJBossProfile=D:\jboss-5.1.0.GA\server\default

set pathDirToClear=
set pathDirToClear=%pathDirToClear%, %pathJBossProfile%\tmp
set pathDirToClear=%pathDirToClear%, %pathJBossProfile%\work\jboss.web

for /d %%A in (%pathDirToClear%) do (
	if exist %%A (
		REM echo %%A
		del /F /Q %%A\*
		for /d %%B in (%%A\*) do (
			rd /S /Q %%B
		)
	)
)

sc start JBoss

[2012-12-10]
New impoved version:

@echo off
setlocal enableextensions enabledelayedexpansion

set checkTimeInterval=5
set svcName=JBoss
set pathJBossProfile=D:\jboss-5.1.0.GA\server\default

for /F "tokens=3 delims=: " %%H in ('sc query %svcName% ^| findstr "        STATE"') do (
	if /I "%%H" EQU "RUNNING" (
		echo Stopping %svcName% service...
		sc stop %svcName%
	)
)

:checkStop
for /F "tokens=3 delims=: " %%H in ('sc query %svcName% ^| findstr "        STATE"') do (
	if /I "%%H" NEQ "STOPPED" (
		timeout /T %checkTimeInterval%
		goto :checkStop
	)
)

set pathDirToClear=
set pathDirToClear=%pathDirToClear%, %pathJBossProfile%\tmp
set pathDirToClear=%pathDirToClear%, %pathJBossProfile%\work\jboss.web

for /d %%A in (%pathDirToClear%) do (
	del /F /Q %%A\*
	for /d %%B in (%%A\*) do (
		echo Deleting: %%B
		rd /S /Q %%B
	)
)

echo Starting %svcName% service...
sc start JBoss