I am facing classpath issue related to jars in WAS plugins folder. My application had IBM specific code to get compiled using the com.ibm.ws.runtime jar as mentioned below.
Location : C:\Program Files\IBM\Websphere\AppServer\Plugins
Source code:
Object obj = ((com.ibm.ws.rsadapter.jdbc.WSJdbcUtil.getNativeConnection((com.ibm.ws.rsadapter.jdbc.WSJdbcConnection)connect)));
Both classes are available in com.ibm.ws.runtime
Compiled successfully by including IBM runtime.jar in classpath of build process but after the deployment in WAS, i am getting ClassNotFoundException. Could any one please let me know, how to include that plugins folder in classpath of WAS, so that i wont get ClassNotFoundException. I have added only runtime.jar in JVM classpath but it is throwing error as it is dependent on other jars of IBM.
Error : Caused by: java.lang.ClassNotFoundException: com.ibm.ws.rsadapter.jdbc.WSJdbcConnection
Updated: Currently it is working perfectly with Jboss server. Code below. My aim is to proivide the same provision with Webpshere.
Calling method:
Connection connect = null;
connect = mDataSrc.getConnection();
unlockJDBC(connect);
private void unlockJDBC(Connection connect)
{
//This bit is JBoss specific but we are trying to avoid importing JBoss JAR files so we use reflection instead.
if (connect.getClass().getName().equals("org.jboss.resource.adapter.jdbc.WrappedConnection") || connect.getClass().getSuperclass().getName().equals("org.jboss.resource.adapter.jdbc.WrappedConnection"))
{
Method method = null;
try{
method = connect.getClass().getMethod("getUnderlyingConnection",null);
Connection conn = (Connection)method.invoke(connect, null);
if (conn != null){
connect = conn;
}
}
catch (InvocationTargetException e){
mLogger.severe(e.getTargetException().getMessage());
}
catch (Exception e){
mLogger.severe(e.toString());
}
}
if (connect instanceof ExtEmbeddedConnection){
ExtEmbeddedConnection embConnect = (ExtEmbeddedConnection)connect;
try{
embConnect.unlock("unlock");
}
catch (Exception e){
mLogger.severe(e.toString());
}
}