try {
// Get the home object
Object ejbHome = CVUtility.getHomeObject(remoteClassName, jndiName);
Class ejbHomeClass = ejbHome.getClass();
// Call create
Method homeCreateMethod = ejbHomeClass.getMethod("create", null);
ejb = homeCreateMethod.invoke(ejbHome, null);
Class ejbClass = ejb.getClass();
// set the dataSource
Class[] setDataSourceArgType = { String.class };
Method setDataSourceMethod = ejbClass.getMethod("setDataSource", setDataSourceArgType);
Object[] setDataSourceArg = { dataSource };
setDataSourceMethod.invoke(ejb, setDataSourceArg);
} catch (Exception e) {
throw e;
}
return ejb;
}