Bug 225621 - wls, was, ... server platforms do not work, missing code
Summary: wls, was, ... server platforms do not work, missing code
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 major with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Andrei Ilitchev CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 227635 227636 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-04-03 14:40 EDT by James Sutherland CLA
Modified: 2022-06-09 10:10 EDT (History)
7 users (show)

See Also:


Attachments
WLS Platform example og un-wrapping a connection (4.95 KB, text/plain)
2008-06-11 19:54 EDT, Doug Clarke CLA
no flags Details
patch (103.71 KB, patch)
2008-06-19 13:59 EDT, James Sutherland CLA
no flags Details | Diff
WAS unwrapConnection patch (1.46 KB, patch)
2008-11-21 11:07 EST, Andrei Ilitchev CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Sutherland CLA 2008-04-03 14:40:23 EDT
The server platforms and transaction controllers were no migrated correctly the eclipselink, their code was either commented out or removed.

It needs to be added back,

WLS
- connection unwrapped removed
- version commented out, throws error
- server log removed
WAS
- unwrap connection commented out, throws error

- ucp platform removed

- oc4j 11 platform removed
-- mbean, log, version, unwrap
- oc4j 1013 platform removed
-- version
Comment 1 James Sutherland CLA 2008-04-09 10:47:52 EDT
I fixed the WLS version issue, so it at least runs, but unwrap and log are still missing.
Comment 2 Peter Krogh CLA 2008-05-07 13:19:20 EDT
*** Bug 227635 has been marked as a duplicate of this bug. ***
Comment 3 Doug Clarke CLA 2008-06-11 19:54:18 EDT
Created attachment 104591 [details]
WLS Platform example og un-wrapping a connection

Based on http://e-docs.bea.com/wls/docs100/jdbc/thirdparty.html
Comment 4 Michael OBrien CLA 2008-06-16 15:59:19 EDT
For WLS logging: I noticed that there is an issue with the current WlsLog wrapper of NonCatalogLogger in the original product against 10.3 - the logs are not showing for a JPA application when this wls platform is used to override the default ServerLog - this may be why the WlsLog subclass was removed.
Comment 5 James Sutherland CLA 2008-06-19 13:59:31 EDT
Created attachment 105436 [details]
patch
Comment 6 James Sutherland CLA 2008-06-19 14:03:40 EDT
Added a fix for many of these issues and others.

Adds the unwrapping support to WLS and WAS platforms.

Adds support to unwrap before executing any statement requiring unwrapped results.  This is because WLS needlessly wrapps everything including ResultSet and even returned values (Lobs, Structs, Refs, etc.).

Changed unwrapping test connection to wrap similar to WLS to test.  Add some additional unwrapping tests.

Also,
Fixed package renamer properties file to rename some things that were renamed since the migration (JpaEntityManager, jpa.base...).
Comment 7 James Sutherland CLA 2008-06-23 09:11:00 EDT
Ignore the oxm changes in the dif, not should why SVN put those in.  I removed these from the checkin.
Comment 8 James Sutherland CLA 2008-06-23 09:12:16 EDT
Fixed
Comment 9 James Sutherland CLA 2008-07-15 11:03:39 EDT
closing
Comment 10 Tom Ware CLA 2008-07-15 13:12:06 EDT
*** Bug 227636 has been marked as a duplicate of this bug. ***
Comment 11 Sebastien Tardif CLA 2008-08-06 10:55:24 EDT
It's not working on WAS 6.1. It was obviously not code reviewed or tested.

Whatever is the exact signature of getNativeConnection, it must have at least one parameter to extract something from it.

TopLink 10.x does this:
    public Connection unwrapOracleConnection(Connection connection) { 
    	if (connection instanceof com.ibm.ws.rsadapter.jdbc.WSJdbcConnection){
            return (Connection)com.ibm.ws.rsadapter.jdbc.WSJdbcUtil.getNativeConnection((com.ibm.ws.rsadapter.jdbc.WSJdbcConnection) connection); 
        }
        return connection;
    }

EclipseLink under SVN rev 1707 does:
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);
            }
        }

Runtime error:
java.lang.NoSuchMethodException: com.ibm.ws.rsadapter.jdbc.WSJdbcUtil.getNativeConnection()
	at java.lang.Class.throwNoSuchMethodException(Class.java:274)
	at java.lang.Class.getDeclaredMethod(Class.java:586)
	at org.eclipse.persistence.internal.security.PrivilegedAccessHelper.getDeclaredMethod(PrivilegedAccessHelper.java:210)
	at org.eclipse.persistence.platform.server.was.WebSpherePlatform.getVendorConnectionMethod(WebSpherePlatform.java:120)
	at org.eclipse.persistence.platform.server.was.WebSpherePlatform.unwrapConnection(WebSpherePlatform.java:134)
Comment 12 Sebastien Tardif CLA 2008-08-06 10:59:49 EDT
Too be clear: EclipseLink 1.0 cannot work with WebSphere 6.0 or 6.1 and was not tested.
Comment 13 Sebastien Tardif CLA 2008-08-06 20:42:43 EDT
Another bug, unwrapConnection is coded like the method called is not a static method. 

The generic fix is below but it's likely that all WebSphere versions use a static method.

public Connection unwrapConnection(Connection connection) {
		
        if (getWebsphereConnectionClass().isInstance(connection) && getVendorConnectionMethod() != null) {
            try {
            	Method method = getVendorConnectionMethod();
            
            	if ( Modifier.isStatic(method.getModifiers()) ){
            		return (Connection) PrivilegedAccessHelper.invokeMethod(method, null,new Object[]{connection});
            	}
            	else {
            		return (Connection) PrivilegedAccessHelper.invokeMethod(method, connection);
            	}
            } catch (IllegalAccessException exception) {
                getDatabaseSession().getSessionLog().logThrowable(SessionLog.WARNING, exception);
            } catch (InvocationTargetException exception) {
                getDatabaseSession().getSessionLog().logThrowable(SessionLog.WARNING, exception);
            }
        }

        return super.unwrapConnection(connection);
	    
	}
Comment 14 dmitryerkin CLA 2008-08-13 01:45:53 EDT
The eclipselink 1.0 still does not work with the Websphere 6.1 correctly.

[12.08.08 10:18:00:203 MSD] 00000050 SystemOut     O [EL Warning]: 2008.08.12 10:18:00.203--Thread(Thread[WebContainer : 8,5,main])--java.lang.NoSuchMethodException: com.ibm.ws.rsadapter.jdbc.WSJdbcUtil.getNativeConnection() 
[12.08.08 10:18:00:250 MSD] 00000050 SystemOut     O [EL Warning]: 2008.08.12 10:18:00.250--UnitOfWork(312611490)--Thread(Thread[WebContainer : 8,5,main])--java.lang.ClassCastException: com.ibm.ws.rsadapter.jdbc.WSJdbcConnection incompatible with oracle.jdbc.OracleConnection

The error is described here:
http://www.nabble.com/com.ibm.ws.rsadapter.jdbc.WSJdbcConnection-incompatible-with-oracle.jdbc.OracleConnection-to18938778.html


Regards
Dmitry
Comment 15 James Sutherland CLA 2008-08-13 10:12:39 EDT
Reopenning for WAS issue.

What is the status of our WAS testing?
Comment 16 dmitryerkin CLA 2008-08-13 10:19:39 EDT
I am looking for the approach which will allow to use Oracle XMLDB in commercial j2ee projects.

Regards
Dmitry
Comment 17 Sebastien Tardif CLA 2008-09-08 15:39:27 EDT
From EclipseLink User Discussions group message sent by James Sutherland on Monday, September 08, 2008 10:20 AM, it seems that no tests running on WebSphere cover for the integration code. We need to fix that too.

Ideally we should have an undertanding of the different use cases that involve integration code of any application servers, than write test for them and execute them when we run test on specific application servers.

Focus on application server testing should start with the application the most used by client of EclipseLink. The most popular application servers are likely JBoss, WebSphere, and WebLogic.
Comment 18 Andrei Ilitchev CLA 2008-11-21 11:07:38 EST
Created attachment 118484 [details]
WAS unwrapConnection patch

Could somebody using WAS give this patch a try?
Comment 19 Andrei Ilitchev CLA 2008-11-21 15:07:18 EST
Checked the patch in. Tested by Yiping: 5 WAS tests that used to fail now pass.
Comment 20 James Sutherland CLA 2009-09-22 10:07:37 EDT
Closing

WAS is now tested nightly by Oracle
Comment 21 Eclipse Webmaster CLA 2022-06-09 10:10:31 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink