Logging Hibernate 4.3 queries with P6SPY 2.0.2 using Glassfish 4 (ConnectionPool)DataSource

210 views
Skip to first unread message

Miguel Koscianski Vidal

unread,
May 9, 2014, 7:52:52 AM5/9/14
to p6spy...@googlegroups.com
Hello there,

Thank you very much for your reply on my question at StackOverflow

I tried what you told me to do but with the following error when trying to ping:
Ping Connection Pool failed for MySpyCP. java.lang.reflect.InvocationTargetException-->null Please check the server.log for more details.

This is my server.log:
[2014-05-09T08:28:10.298-0300] [glassfish 4.0] [WARNING] [test.connection.pool.failed] [javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service] [tid: _ThreadID=188 _ThreadName=admin-listener(6)] [timeMillis: 1399634890298] [levelValue: 900] [[
  RAR8054: Exception while creating an unpooled [test] connection for pool [ MySpyCP ], java.lang.reflect.InvocationTargetException-->null]]

The <resources> of my domain.xml is attached, so you can verify whats happening.

My spy.properties are under (...)/glassfish4/glassfish/domains/mydomain/config. Also attached.
The p6spy.jar (renamed from p6spy-2.0.2.jar) are under (...)/glassfish4/glassfish/domains/mydomain/lib/ext

Am I missing something?

How can I verify if P6SPY have loaded the spy.properties?

Thank you very much for your help and attention!

Best regards,

Miguel Koscianski Vidal
domain.xml
spy.properties

butk...@gmail.com

unread,
May 9, 2014, 10:46:53 AM5/9/14
to p6spy users
Hi Miguel,

the trouble might be that I didn't test Glassfish integration with 2.0.2, but 2.0.3-SNAPSHOT (of p6spy).
Could you give it a try with the latest snapshot (https://github.com/p6spy/p6spy/wiki/Download) and let us know if you still have the trouble there?

thanks

Peter Butkovic




--
You received this message because you are subscribed to the Google Groups "p6spy users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to p6spy-users...@googlegroups.com.
To post to this group, send email to p6spy...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/p6spy-users/CAK8XY1WqBjQ1VEPv8ZUSqSnk8z%3DxMFtFcbDu4Sg1BZJo-_K_ZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

butk...@gmail.com

unread,
May 14, 2014, 3:57:40 AM5/14/14
to p6spy users
one more on this one. I've noticed you went for:  res-type="javax.sql.ConnectionPoolDataSource"
This one is for glassfish supported only since 2.0.3 version => make sure to use it (I created the issue to state this in the docs: https://github.com/p6spy/p6spy/issues/236)

Moreover your spy.properties should hold only:
modulelist=com.p6spy.engine.logging.P6LogFactory,com.p6spy.engine.outage.P6OutageFactory,com.p6spy.engine.leak.P6LeakFactory
logfile=C:/MyApp/logs/spy.log

the rest is already configured in your domain.xml



h.mens...@gmail.com

unread,
Aug 8, 2014, 12:57:25 PM8/8/14
to p6spy...@googlegroups.com
Hi!

I stumbled upon this thread while trying to do almost the same thing. If you have any lead on how I could fix the issue, I would greatly appreciate it, I'm slowly going crazy with this ;).

Here is my conf :
  • Glassfish : 3.1.1
  • p6spy : 2.1.0

<jdbc-connection-pool driver-classname="" datasource-classname="oracle.jdbc.pool.OracleDataSource" res-type="javax.sql.DataSource" description="" name="OracleDataSource" ping="true">
     
<property name="URL" value="jdbc:oracle:thin:@dbhost:1569:DEV"></property>
     
<property name="portNumber" value="1569"></property>
     
<property name="serverName" value="dbhost"></property>
     
<property name="user" value="myUser"></property>
     
<property name="password" value="myPwd"></property>
   
</jdbc-connection-pool>
   
<jdbc-resource pool-name="OracleDataSource" description="" jndi-name="jdbc/real_ds"></jdbc-resource>
   
<jdbc-connection-pool datasource-classname="com.p6spy.engine.spy.P6DataSource" res-type="javax.sql.DataSource" name="p6spyPool" ping="true">
     
<property name="User" value="myUser"></property>
     
<property name="realDataSource" value="jdbc/read_ds"></property>
     
<property name="Password" value="myPwd"></property>
   
</jdbc-connection-pool>
   
<jdbc-resource pool-name="p6spyPool" jndi-name="jdbc/ds"></jdbc-resource>

I included the p6spy jar and the spy.properties (left unchanged)

But when I try to ping p6spyPool from the console I have the following exception :

  • Ping Connection Pool for p6spyPool is Failed. Ping failed Exception - java.lang.reflect.InvocationTargetException-->null Please check the server.log for more details. Ping failed Exception - java.lang.reflect.InvocationTargetException-->null

And in the server log :

[#|2014-08-08T18:48:37.827+0200|WARNING|oracle-glassfish3.1.1|javax.enterprise.resource.resourceadapter.com.sun.enterprise.connectors.service|_ThreadID=20;_ThreadName=Thread-2;|RAR8054: Exception while creating an unpooled [test] connection for pool [ p6spyPool ], java.lang.reflect.InvocationTargetException-->null|#]

[#|2014-08-08T18:48:37.831+0200|SEVERE|oracle-glassfish3.1.1|org.glassfish.admingui|_ThreadID=22;_ThreadName=Thread-2;|RestResponse.getResponse() gives FAILURE.  endpoint = 'http://localhost:4848/management/domain/resources/ping-connection-pool.json'; attrs = '{id=p6spyPool}'|#]

Best regards,

Hadrien

Do you have any idea of what I could do to make it work?

butk...@gmail.com

unread,
Aug 11, 2014, 7:12:54 AM8/11/14
to p6spy users
Hi,

it's quite difficult to see the problem here for me. The only thing I'd try, is to follow official docs as much as possible (http://p6spy.github.io/p6spy/2.0/install.html#glassfish).

Honestly I didn't try with non-pooled connection, so would give it a try with pooled one, in your case:

<jdbc-connection-pool datasource-classname="oracle.jdbc.pool.OracleConnectionPoolDataSource" res-type="javax.sql.ConnectionPoolDataSource" name="OracleDataSource" ping="true">

      <property name="URL" value="jdbc:oracle:thin:@dbhost:1569:DEV"></property>
      <property name="portNumber" value="1569"></property>
      <property name="serverName" value="dbhost"></property>
      <property name="user" value="myUser"></property>
      <property name="password" value="myPwd"></property>
    </jdbc-connection-pool>
    <jdbc-resource pool-name="OracleDataSource" description="" jndi-name="jdbc/real_ds"></jdbc-resource>
    <jdbc-connection-pool datasource-classname="com.p6spy.engine.spy.P6DataSource" res-type="javax.sql.ConnectionPoolDataSource" name="p6spyPool" ping="true">

      <property name="User" value="myUser"></property>
      <property name="realDataSource" value="jdbc/read_ds"></property>
      <property name="Password" value="myPwd"></property>
    </jdbc-connection-pool>
    <jdbc-resource pool-name="p6spyPool" jndi-name="jdbc/ds"></jdbc-resource>

moreover, make sure, that the original (no p6spy wirks OK before giving p6spy a try).

does that help?



Reply all
Reply to author
Forward
0 new messages