Closed GoogleCodeExporter closed 9 years ago
I don't see the picture so here it is in a link :
http://i.stack.imgur.com/0jXij.png
Question on Stackoverflow :
http://stackoverflow.com/questions/24803719/java-melody-proxyobject-need-to-call
-method-of-proxyd-object-or-get-underlying-o
Original comment by filip.co...@gmail.com
on 17 Jul 2014 at 1:46
here is the picture
Original comment by evernat@free.fr
on 18 Jul 2014 at 11:45
Attachments:
If you want to cast to OracleConnection like this, you are supposed to call the
Connection.unwrap method first.
It was created for that in the java.sql API
http://docs.oracle.com/javase/6/docs/api/java/sql/Wrapper.html#unwrap%28java.lan
g.Class%29
For example:
Connection unwrappedConnection = connection.unwrap(Connection.class)
OracleConnection oConn = null;
if (unwrappedConnection instanceof OracleConnection) {
oConn = (OracleConnection) unwrappedConnection;
}
Original comment by evernat@free.fr
on 18 Jul 2014 at 12:01
Is it OK and can we close this issue?
Original comment by evernat@free.fr
on 18 Jul 2014 at 12:02
Sorry, forto's to say in originaliteit thread that the unwrap throws
abstractmethoderror on wrappedconnecton.class and oracleconnection.class.
Original comment by filip.co...@gmail.com
on 19 Jul 2014 at 9:54
I don't understand at the moment why you have an abstractmethoderror for unwrap
on the wrapped connection.
Can you give the stack-trace of the error to clarify that?
Original comment by evernat@free.fr
on 19 Jul 2014 at 12:02
I can give you that in a couple days. Need to be back at work in around 60
hours.
Original comment by filip.co...@gmail.com
on 19 Jul 2014 at 10:32
Caused by: java.lang.AbstractMethodError:
org.jboss.resource.adapter.jdbc.WrappedConnection.isWrapperFor(Ljava/lang/Class;
)Z
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at net.bull.javamelody.JdbcWrapper$ConnectionInvocationHandler.invoke(JdbcWrapper.java:180)
at net.bull.javamelody.JdbcWrapper$DelegatingInvocationHandler.invoke(JdbcWrapper.java:277)
at $Proxy64.isWrapperFor(Unknown Source)
at be.mil.cccis.auditing.OracleClientInfoProvider.enrichConnection(OracleClientInfoProvider.java:35)
at be.mil.cccis.auditing.ClientInfoProvider.setClientInfo(ClientInfoProvider.java:25)
at be.mil.cccis.auditing.AuditableDataSource.enrichConnection(AuditableDataSource.java:49)
at be.mil.cccis.auditing.AuditableDataSource.getConnection(AuditableDataSource.java:39)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at net.bull.javamelody.JdbcWrapper$3.invoke(JdbcWrapper.java:748)
at net.bull.javamelody.JdbcWrapper$DelegatingInvocationHandler.invoke(JdbcWrapper.java:277)
at $Proxy63.getConnection(Unknown Source)
at org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider.getConnection(InjectedDataSourceConnectionProvider.java:70)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcServicesImpl.java:242)
at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:117)
at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:76)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:160)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:132)
at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1825)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1783)
at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:96)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899)
at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:76)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:290)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:310)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1571)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1509)
This is with is code : connection.isWrapperFor(WrappedConnection.class);
Original comment by filip.co...@gmail.com
on 22 Jul 2014 at 6:11
Ah ok. You have said that you use JBoss 4.0.5.
That's very, very old and that's of the JDK 5 era. Said otherwise the JBoss
4.0.5 jdbc resource adapter are not compatible with the changes of the java.sql
api in the JDK 6. So you can not call Connection.isWrapperFor/unwrap with the
JBoss 4.0.5 jdbc resource adapter.
And so you can not get the wrapped connection with unwrap and cannot cast to
OracleConnection.
I suggest to upgrade your age-old JBoss version, otherwise you will probably
not be able to have both oracle clientInfo/endToEndMetrics and javamelody sql
monitoring, at the same time.
For javamelody concerns, getting the wrapped connection to use driver specific
classes is not supported with JBoss 4.0.5 jdbc resource adapter. So this issue
is invalid/won't fix, sorry.
Original comment by evernat@free.fr
on 23 Jul 2014 at 11:15
Thx for the answer, the upgrade to Jboss 7 is in the pipeline so I'll have to
wait till then.
Original comment by filip.co...@gmail.com
on 25 Jul 2014 at 7:14
Original issue reported on code.google.com by
filip.co...@gmail.com
on 17 Jul 2014 at 1:43