Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] com.ibm.ws.rsadapter.jdbc.WSJdbcConnection incompatible with oracle.jdbc.OracleConnection

The arguments to the getNativeConnection method are wrong, they must include
WSJdbcConnection.class.  Please log a bug for this.



dmitryerkin wrote:
> 
> Hi
> I implemented the class which is inherited from the WebSphere_6_1_Platform
> class.
> Through this class I can set the value of
> WebSpherePlatform.websphereUtilClass:
> 
> 
> package custom;
> 
> public class WebSphere_6_1_Platform_Customizer extends
> WebSphere_6_1_Platform {
> 	
>     public WebSphere_6_1_Platform_Customizer(DatabaseSession
> newDatabaseSession) {
>         super(newDatabaseSession);
>         setWebsphereUtilClass(com.ibm.ws.rsadapter.jdbc.WSJdbcUtil.class);
>     }
>     
>     public void setWebsphereUtilClass(Class clazz){
>     	super.websphereUtilClass = clazz;    		
>     }
>     
>     public Class getWebsphereUtilClass(){
>     	return super.websphereUtilClass;
>     }
> }
> 
> 
> 
> Here is my persistence.xml:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence";
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> ../../../eclipselink/src/xsd/persistence_1_0.xsd ">
> 	<persistence-unit name="oebsEJB">
> 		<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
> 		<jta-data-source>jdbc/oebs_oci</jta-data-source>
> 		<properties>
> 			<property name="eclipselink.server.platform.class.name"
> value="custom.WebSphere_6_1_Platform_Customizer"/>			
> 	        <property name="eclipselink.jdbc.driver"
> value="oracle.jdbc.OracleDriver"/>
> 	        <property name="eclipselink.target-database"
> value="org.eclipse.persistence.platform.database.oracle.Oracle10Platform"/>            
> 	        <property name="eclipselink.weaving" value="false"/>
> 	        <property name="eclipselink.session-name"
> value="default-session"/>            
> 			<property name="eclipselink.session.customizer"
> value="custom.OebsSessionCustomizer"/>
> 	        <property name="eclipselink.logging.level" value="FINEST"/>
> 	        <property name="eclipselink.jdbc.read-connections.shared"
> value="true"/>
> 	        <property name="eclipselink.jdbc.write-connections.min"
> value="3"/>
> 	        <property name="eclipselink.jdbc.write-connections.max"
> value="8"/>
> 	        <property name="eclipselink.jdbc.read-connections.min"
> value="3"/>
> 	        <property name="eclipselink.jdbc.read-connections.max"
> value="3"/>
> 	        <property name="eclipselink.cache.size.default" value="500"/>
> 	        <property name="eclipselink.cache.type.default" value="Full"/>
> 	        <property name="eclipselink.orm.throw.exceptions" value="false"/>
> 		</properties>
> 	</persistence-unit>
> </persistence>
> 
> 
> 
> 
> Here is my SessionCustomizer:
> 
> public class OebsSessionCustomizer implements SessionCustomizer {
> 	
> 	public static final String JNDI_DATASOURCE_NAME = "jdbc/oebs_oci";
> 
> 	public void customize(Session session) throws Exception {    
> 		
> 		Server server = (Server)session;
> 		WebSphere_6_1_Platform_Customizer serverPlatform =
> (WebSphere_6_1_Platform_Customizer)server.getServerPlatform();    	
> 	
> serverPlatform.setWebsphereUtilClass(com.ibm.ws.rsadapter.jdbc.WSJdbcUtil.class);
> 		
> 	}
> }
> 
> 
> But the error still happens:
> 
> [12.08.08 16:32:40:140 MSD] 00000056 SystemOut     O [EL Warning]:
> 2008.08.12 16:32:40.140--Thread(Thread[WebContainer :
> 3,5,main])--java.lang.NoSuchMethodException:
> com.ibm.ws.rsadapter.jdbc.WSJdbcUtil.getNativeConnection()
> [12.08.08 16:32:40:218 MSD] 00000056 SystemOut     O [EL Warning]:
> 2008.08.12 16:32:40.218--UnitOfWork(663758736)--Thread(Thread[WebContainer
> : 3,5,main])--java.lang.ClassCastException:
> com.ibm.ws.rsadapter.jdbc.WSJdbcConnection incompatible with
> oracle.jdbc.OracleConnection
> 
> 
> I think that the reason for this error is that the getWebsphereUtilClass()
> method can not find the websphereUtilClass value.
> 
> 
>     protected Method getVendorConnectionMethod() {
>         if ((this.vendorConnectionMethod == null) &&
> (!getWebsphereUtilClass().equals(void.class))) {
>             try {
>                 Class args[] = new Class[1];
>                 args[0] = getWebsphereConnectionClass();
>                 this.vendorConnectionMethod =
> PrivilegedAccessHelper.getDeclaredMethod(getWebsphereUtilClass(),
> "getNativeConnection", new Class[0]);
>             } catch (NoSuchMethodException exception) {
>                
> getDatabaseSession().getSessionLog().logThrowable(SessionLog.WARNING,
> exception);
>             }
>         }
> 
>         return this.vendorConnectionMethod;
>     }
> 
> Regards
> Dmitry
> 
> 


-----
---
http://wiki.eclipse.org/User:James.sutherland.oracle.com James Sutherland 
http://www.eclipse.org/eclipselink/
 EclipseLink ,  http://www.oracle.com/technology/products/ias/toplink/
TopLink 
Wiki:  http://wiki.eclipse.org/EclipseLink EclipseLink , 
http://wiki.oracle.com/page/TopLink TopLink 
Forums:  http://forums.oracle.com/forums/forum.jspa?forumID=48 TopLink , 
http://www.nabble.com/EclipseLink-f26430.html EclipseLink 
Book:  http://en.wikibooks.org/wiki/Java_Persistence Java Persistence 
-- 
View this message in context: http://www.nabble.com/com.ibm.ws.rsadapter.jdbc.WSJdbcConnection-incompatible-with-oracle.jdbc.OracleConnection-tp18938778p18944449.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top