How to monitor the data source connections and sql queries in jboss
Tech-Today

How to monitor the data source connections and sql queries in jboss


To allow us to debug our jboss server for possible connection leaks, wrong sql queries normally we do 2 changes:

1.) In persistence.xml, set hibernate.show_sql to true

2.) In jboss's standalone.xml, we set the hibernate logger to DEBUG
<logger category="org.hibernate">
<level name="DEBUG"/>
</logger>

But there's another not so popular way I guess, enabling spy setting in jboss's datasource.
1.) In your datasource setting add spy="true", example:
<datasource jta="true" jndi-name="java:jboss/datasources/czetsuyaDS" pool-name="czetsuyaPool" enabled="true" use-java-context="true" spy="true" use-ccm="true">

2.) Add jboss.jdbc.spy logger in the logging section of jboss
<logger category="jboss.jdbc.spy">
<level name="TRACE"/>
</logger>

After that restart jboss and you should see logs similar to:
19:43:40,006 DEBUG [jboss.jdbc.spy] (ServerService Thread Pool -- 64) java:jboss/datasources/czetsuyaDS [Connection] getMetaData()
19:43:40,041 DEBUG [jboss.jdbc.spy] (ServerService Thread Pool -- 64) java:jboss/datasources/czetsuyaDS [Connection] getCatalog()
19:43:40,041 DEBUG [jboss.jdbc.spy] (ServerService Thread Pool -- 64) java:jboss/datasources/czetsuyaDS [Connection] getMetaData()
19:43:40,041 DEBUG [jboss.jdbc.spy] (ServerService Thread Pool -- 64) java:jboss/datasources/czetsuyaDS [Connection] createClob()
19:43:40,042 DEBUG [jboss.jdbc.spy] (ServerService Thread Pool -- 64) java:jboss/datasources/czetsuyaDS [Connection] close()
19:43:41,256 DEBUG [jboss.jdbc.spy] (ServerService Thread Pool -- 64) java:jboss/datasources/czetsuyaDS [Connection] getAutoCommit()
19:43:41,256 DEBUG [jboss.jdbc.spy] (ServerService Thread Pool -- 64) java:jboss/datasources/czetsuyaDS [Connection] getMetaData()
19:43:41,256 DEBUG [jboss.jdbc.spy] (ServerService Thread Pool -- 64) java:jboss/datasources/czetsuyaDS [Connection] createStatement()
19:43:41,257 DEBUG [jboss.jdbc.spy] (ServerService Thread Pool -- 64) java:jboss/datasources/czetsuyaDS [Statement] executeQuery(select relname from pg_class where relkind='S')
19:43:41,257 DEBUG [jboss.jdbc.spy] (ServerService Thread Pool -- 64) java:jboss/datasources/czetsuyaDS [ResultSet] next()
19:43:41,258 DEBUG [jboss.jdbc.spy] (ServerService Thread Pool -- 64) java:jboss/datasources/czetsuyaDS [ResultSet] close()
19:43:41,258 DEBUG [jboss.jdbc.spy] (ServerService Thread Pool -- 64) java:jboss/datasources/czetsuyaDS [Statement] close()
19:43:41,258 DEBUG [jboss.jdbc.spy] (ServerService Thread Pool -- 64) java:jboss/datasources/czetsuyaDS [Connection] createStatement()
...
executeUpdate(...)
...




- How To Use Mariadb And Liquibase Together With Maven On Jboss
First you must define the needed dependency in your pom file. <profile> <id>mariadb</id> <activation> <property> <name>env</name> <value>mariadb</value> </property> </activation> <properties>...

- Jboss Datasource Configuration Settings
The following are sample configurations for different database (it's in the file standalone.xml subsystem=datasources): H2, postgresql, mysql <datasources> <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true"...

- Things To Remember In Creating Jbpm With Seam
This writing will reference the TODO example from seam: http://docs.jboss.org/seam/latest/reference/en-US/html/tutorial.html#registration-example Note that I used seam-gen to generate the project. File you should have: +views +login.xhtml +todo.xhtml...

- Javax.ejb Cannot Be Resolve Eclipse Helios
If you're having the above error, it means the javaee.jar is not included in your project. In my case I'm using a JBoss application server. To solve the issue simply add the jboss-javaee.jar in your project's build path. The javaee jar for...

- Create A New Seam Web Project In Eclipse-helios
In this exercise we will be building seam web project in eclipse. It's long so stay focus :-D. What you need (The following should be installed correctly): Note: in parentheses is where I installed mine. 1.) Jboss seam 2.2.1 (C:\jboss-seam-2.2.1)...



Tech-Today








.