How to configure p6spy to work with Websphere?

1,034 views
Skip to first unread message

Shizhong Yuan

unread,
Nov 30, 2013, 11:53:55 PM11/30/13
to p6spy-de...@googlegroups.com
Hello everyone,

My name is Roy Yuan. A java developer at Camilion. I have been struggling with configuring p6spy to work with websphere for many days. I would appreciate if you could send me some instructions.

I also tried the latest p6spy-2.0-alpha-1.jar, and got two exceptions(pls. see the attached log). Copied the appender folder from p6spy.jar v1.3  to p6spy-2.0-alpha-1.jar, the second exception still persists.

Thanks in advance,

Roy

p6spy.log

butk...@gmail.com

unread,
Dec 1, 2013, 2:00:29 AM12/1/13
to p6spy Developers on behalf of Shizhong Yuan
just for the curiosity, you claim to try with websphere, but from logs it sounds like jboss. So which one are you interested in?


--
You received this message because you are subscribed to the Google Groups "p6spy Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to p6spy-develope...@googlegroups.com.
To post to this group, send email to p6spy-de...@googlegroups.com.
Visit this group at http://groups.google.com/group/p6spy-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/p6spy-developers/3d6df3d7-1a0a-4cfd-be02-e86045f41040%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Shizhong Yuan

unread,
Dec 1, 2013, 11:43:20 AM12/1/13
to p6spy-de...@googlegroups.com
Hi Peter,

My final goal is make p6spy work with websphere. For some reasons the p6spy 1.3 doesn't work with my websphere 7. I know version 1.3 is pretty old, so found p6spy-2.0-alpha-1.jar. Before try it with websphere, I tested it with JBoss and got the exceptions attached.  My JBoss works fine with version 1.3. 

In 1.3, I noticed that there are two classes (P6SpyManager and P6SpyManagerMBean) for JBoss, but no similar code for websphere. I am pretty new to p6spy, could you please give me more details on how to configure it with websphere?

Thanks a lot,
Roy


On Sunday, December 1, 2013 2:00:29 AM UTC-5, Peter Butkovic wrote:
just for the curiosity, you claim to try with websphere, but from logs it sounds like jboss. So which one are you interested in?

Quinton McCombs

unread,
Dec 1, 2013, 5:58:25 PM12/1/13
to p6spy Developers on behalf of Shizhong Yuan
Using 1.3 - 
For configuring P6Spy 1.3 with WebSphere, we have some instructions at http://p6spy.github.io/p6spy/1.3/install.html.  They are a bit outdated but they could be helpful.  The JMX support for specific to JBoss in 1.3.

Could you post some information about how you have tried to configure it in WebSphere along with a copy of the spy.properties file?

Using 2.0 - 
The settings in spy.properties have changed a bit.  This is why you got 'java.lang.ClassNotFoundException: com.p6spy.engine.logging.appender.FileLogger'.  Try starting off with the spy.properties included with the distribution (http://search.maven.org/remotecontent?filepath=p6spy/p6spy/2.0-alpha-1/p6spy-2.0-alpha-1.tar.gz).

The way that you configure P6Spy has also changed a bit as well.  We don't have updated instructions of WebSphere with 2.0 yet.  However, the generic instuctions at http://p6spy.github.io/p6spy/2.0/install.html have a section on using a data source.



butk...@gmail.com

unread,
Dec 2, 2013, 10:33:26 AM12/2/13
to p6spy Developers on behalf of Quinton McCombs
well, as far as I can see, the 2.0 needs to get to shape before it's usable with app servers. You should probably stick with 1.3 for now.


Shizhong Yuan

unread,
Dec 4, 2013, 1:05:43 PM12/4/13
to p6spy-de...@googlegroups.com

Hi 

Sorry for my late reply. I just got a new WAS 7 instance for testing. and created a new JDBC provider and a datasource referenced to the existing oracle datasource. As Peter suggested, I am using 1.3

I saw an empty spy.log and got the following DSRA8101E error:
[12/4/13 11:00:19:725 EST] 00000034 SystemErr     R java.sql.SQLException: DSRA8101E: DataSource class cannot be used as one-phase: ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource cannot be cast to javax.sql.ConnectionPoolDataSource
at com.ibm.ws.rsadapter.AdapterUtil.toSQLException(AdapterUtil.java:1544)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:685)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:635)
at com.camilion.env.AppEnvironment.getJDBCConnection(AppEnvironment.java:585)

My spy.properties is attached for your reference.

Thanks for your help,
Roy

spy.properties

Quinton McCombs

unread,
Dec 4, 2013, 1:58:07 PM12/4/13
to p6spy Developers on behalf of Shizhong Yuan

Shizhong Yuan

unread,
Dec 6, 2013, 4:04:14 PM12/6/13
to p6spy-de...@googlegroups.com
Yes, I set enable2Phase to false as you said, and got the same class casting error:

DSRA8101E: DataSource class cannot be used as one-phase: ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource cannot be cast to javax.sql.ConnectionPoolDataSourcejava.sql.SQLException: DSRA8101E: DataSource class cannot be used as one-phase: ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource cannot be cast to javax.sql.ConnectionPoolDataSource

So, I decompiled involved classes as below:

                   public class WSJdbcDataSource extends WSJdbcWrapper implements WSDataSource, Referenceable, Serializable, FFDCSelfIntrospectable, WSOptimizedDataSource
    
                   public abstract class WSJdbcWrapper implements InvocationHandler, Wrapper

                   public interface WSDataSource extends DataSource

                   public interface WSOptimizedDataSource extends DataSource
                   public interface DataSource

Classes listed above are from com.ibm.ws.runtime.jar and the following is from j2ee.jar:
                  public interface ConnectionPoolDataSource 

Please note interface ConnectionPoolDataSource is not extended from DataSource. So, WSJdbcDataSource, which eventually implements the DataSource interface, can not be cast to ConnectionPoolDataSource.


Thanks,
Roy



On Wednesday, December 4, 2013 1:58:07 PM UTC-5, Quinton McCombs wrote:

Quinton McCombs

unread,
Dec 8, 2013, 5:43:42 PM12/8/13
to p6spy Developers on behalf of Shizhong Yuan
Try using P6DataSource instead of P6ConnectionPoolDataSource.


butk...@gmail.com

unread,
Dec 12, 2013, 3:51:33 AM12/12/13
to p6spy Developers on behalf of Quinton McCombs
Hi Roy,

Since you shown your interest, we've started to setup integration build to see how well p6spy 2.0.0-SNAPSHOT can play with various app servers. Unfortunatelly, websphere is not included. Still quite some already work fine (see: https://travis-ci.org/p6spy/p6spy-it).

Btw, JBoss errors you faced have been resolved in the meantime (see: https://github.com/p6spy/p6spy/issues/168 and https://github.com/p6spy/p6spy/issues/170).

I think it would be beneficial to share your experience, if you are stuck with 1.3 you might give a try to 2.0.0-SNAPSHOT (https://oss.sonatype.org/index.html#nexus-search;quick~p6spy), where in case of super-simple config only the adoption of jdbc URL + adding p6spy.jar would be needed.

Thanks.



Quinton McCombs

unread,
Dec 16, 2013, 1:10:18 PM12/16/13
to p6spy Developers

Roy,
    I think that your classcast exception is being encountered inside of P6ConnectionPoolDataSource.  The way that this class works is that it performs a JNDI lookup of the real data source and then proxies it.  After the lookup is performed, it casts the object returned from JDNI to ConnectionPoolDataSource.  Perhaps your real data source is not an instance of ConnectionPoolDataSource?  Did you set enable2Phase to false of the real data source as well?

BTW - I would really like to try this out myself on WebSphere.  I have WAS 8 installed but so far I have not been able to get our test application at http://github.com/p6spy/p6spy-it.git to work in it.  I think that it is just a problem with the WAS configuration.  If you could email me the steps to configure WAS without p6spy (either instructions for the web interface or command line), I can figure out the exact steps to configure p6spy for you.

Quinton McCombs

unread,
Dec 20, 2013, 5:52:58 PM12/20/13
to p6spy-de...@googlegroups.com
I finally got WebSphere up and running so that I could try to figure out the cause of this issue.  It looks like there was a change made in WebSphere in the 5.X version which broke p6spy.  The only ways that I have found to make either 1.3 or 2.0 work with WebSphere 5.1+ is to create a subclass of the vendor data source class (oracle.jdbc.pool.OracleConnectionPoolDataSource) and override the getPooledConnection() methods.  Inside the overloaded method, you just need to wrap in an instance of P6PooledConnection (See source of P6ConnectionPoolDataSource for example).  It doesn't look like there is any way to get the proxy mechanism to work properly.

I created issue #186 to track this problem.


On Monday, December 16, 2013 12:10:18 PM UTC-6, Quinton McCombs wrote:

Roy,
    I think that your classcast exception is being encountered inside of P6ConnectionPoolDataSource.  The way that this class works is that it performs a JNDI lookup of the real data source and then proxies it.  After the lookup is performed, it casts the object returned from JDNI to ConnectionPoolDataSource.  Perhaps your real data source is not an instance of ConnectionPoolDataSource?  Did you set enable2Phase to false of the real data source as well?

BTW - I would really like to try this out myself on WebSphere.  I have WAS 8 installed but so far I have not been able to get our test application at http://github.com/p6spy/p6spy-it.git to work in it.  I think that it is just a problem with the WAS configuration.  If you could email me the steps to configure WAS without p6spy (either instructions for the web interface or command line), I can figure out the exact steps to configure p6spy for you.

To unsubscribe from this group and stop receiving emails from it, send an email to p6spy-developers+unsubscribe@googlegroups.com.
To post to this group, send email to p6spy-developers@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "p6spy Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to p6spy-developers+unsubscribe@googlegroups.com.
To post to this group, send email to p6spy-developers@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "p6spy Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to p6spy-developers+unsubscribe@googlegroups.com.
To post to this group, send email to p6spy-developers@googlegroups.com.

Peter Butkovic

unread,
Sep 11, 2016, 6:04:55 PM9/11/16
to p6spy Developers
Hey guys,

I've got some fresh news here.
I did some testing with websphere liberty proflie 16.0.0.2 (https://github.com/p6spy/p6spy-it/commit/c7e3fe83d0fc84f1bde851605d8c4fa0beb33a6e).

Btw, I've noticed, that p6spy-it are sometimes showing OK build, even if deployment fails (opened new issue here: https://github.com/p6spy/p6spy/issues/351)

The good news is, that there seems to be datasource proxying on websphere liberty progile over p6spy possible, we just need to do some design decisions here.

The only way it worked for me is using P6spyDatasource, that refers to real DS (via realDataSource). However, it works only for the case of having: javax.sql.DataSource - extending class.
If we try to extend: ConnectionPoolDataSource or XADataSource (as we do currently in P6spyDatasource), unwrapping of the real datasource comes to play (using com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource) and trouble starts, as .getPooledConnection() call in the P6spyDatasource.getPooledConnection() or similarly: getXAConnection() call in the P6spyDatasource.getXAConnection() throws error (websphere: com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource implementation, seems to be really restrictive, once trying to call wrapped datasource).

So, what I did for simple test, was copy/pasted: P6spyDatasource which extended neither ConnectionPoolDataSource nor XADataSource and refered to it from the server.xml (see: com.p6spy.engine.spy.P6DataSourceCore in the https://github.com/p6spy/p6spy-it/blob/0864a4a66ebc77ec9b571b0fd5639186336547e6/src/test/container/wlp16x/usr/servers/myserver/server.xml)

The bad news here is, that we won't support neither pooling nor XA datasources, but some support seems better like none to me.

So what I'd need feedback to is how to name the new class here. Would P6DataSourceCore work for you?

I'd be happy to submit the fix.
Moreover, if we decide our way to go for documentation, I can submit the docs updates as well.

Kind regards,
Peter B.


Dňa piatok, 20. decembra 2013 23:52:58 UTC+1 Quinton McCombs napísal(-a):
Reply all
Reply to author
Forward
0 new messages