JBoss

Show Hibernate queries with parameters – When Jboss 7.1 logging module is enabled

Edit JBOSS_HOME\standalone\configuration\standalone.xml:

Add these lines under logging module;

<logger category=”org.hibernate.SQL”>
     <level name=”DEBUG”/>
</logger>
<logger category=”org.hibernate.type”>
     <level name=”TRACE”/>
</logger>
<logger category=”org.hibernate.hql.ast.AST”>
     <level name=”INFO”/>
</logger>
<logger category=”org.hibernate.tool.hbm2ddl”>
     <level name=”WARN”/>
</logger>
<logger category=”org.hibernate.hql”>
     <level name=”DEBUG”/>
</logger>
<logger category=”org.hibernate.cache”>
     <level name=”INFO”/>
</logger>
<logger category=”org.hibernate.jdbc”>
     <level name=”DEBUG”/>
</logger>

Eclipse, Java, JBoss

How to remotely debug application on JVM through Eclipse

What is spoken flies what is written never dies. So I started to blogging again.

First of all, we will add JVM parameters for debug. (operative for java 5 or above)

-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=192.168.9.48:8787

We use Jboss AS 7.1.1Final as application server. For this example open file

for Windows; JBOSS_HOME\bin\standalone.conf.bat

for Linux; JBOSS_HOME\bin\standalone.conf

After java options lines, add this line;

set "JAVA_OPTS=%JAVA_OPTS% -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=192.168.9.48:8787"

Replace your 192.168.9.48 with your server IP . JVM will listen port 8787 for connection.

Before you proceed, make sure your server is reachable for remote connection.(firewall issue etc.)

1

Start your server. When server ready to go, you can check port’s status by typing netstat -ao to adminstrative console.

Let’s configure our Eclipse. Open your eclipse that has the source code of your web application that is currently deployed on the remote server.

Click Run->Debug Configurations.

2

Right-click on Remote Java Application -> New. Type your server IP as hostname and type your port.

Click Apply + Debug to start connection.

3

Use debug perspective to get to work!