aspose file tools*
The moose likes Websphere and the fly likes problem with DB2 connection in a stateful session bean and deployed by Websphere Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "problem with DB2 connection in a stateful session bean and deployed by Websphere" Watch "problem with DB2 connection in a stateful session bean and deployed by Websphere" New topic
Author

problem with DB2 connection in a stateful session bean and deployed by Websphere

christy smile
Ranch Hand

Joined: Oct 15, 2001
Posts: 101
Hi, All,
I am trying to create a db2 connection within a stateful session bean. The following code is what I used:
dbName = "java:comp/env/jdbc/sampledb";
InitialContext ic = new InitialContext;
DataSource ds = (DataSource) ic.lookup(dbName);
Connection conn = ds.getConnection();
However, when I tried to run this stateful session bean within Websphere, I always get the following exception:
[02.01.25 15:41:32:033 CST] 5584277c DataSourceFac X CONM1006E: The data source class name "COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource" could not be found for data source (telco).
[02.01.25 15:41:32:454 CST] 5584277c UrlContextHel W NMSV0605E: A Reference object looked up from the context "local:" with the name "jdbc/jdbc/Session" was sent to the JNDI Naming Manager and an exception resulted.
Reference data follows:
Reference Factory Class Name: com.ibm.websphere.advanced.cm.factory.DataSourceFactory$ResourceReferenceObjectFactory
Reference Factory Class Location URLs: <null>
Reference Class Name: com.ibm.ejs.cm.portability.PortableDataSource
CMPropertiesRefAddr: {properties=CMProperties for DataSource "telco"
Using underlying DataSource class: COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource
Data Source Properties:
{description=datasource used for datapublisher, databaseName=telco}
Connection Pool Properties:
user = yingliu
minConnectionPoolSize = 1
maxConnectionPoolSize = 10
connTimeout = 180
idleTimeout = 1800
orphanTimeout = 1800
maxStatementCacheSize = 100
autoConnectionCleanupDisabled= false
errorMap = null
informixLockModeWait = 0}
Exception data follows:
javax.naming.NamingException: ClassNotFoundException: COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource
at com.ibm.websphere.advanced.cm.factory.DataSourceFactory$ResourceReferenceObjectFactory.getObjectInstance(DataSourceFactory.java:754)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:308)
at com.ibm.ws.naming.urlbase.UrlContextHelper.isReference(UrlContextHelper.java:115)
at com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(UrlContextHelper.java:221)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1181)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1158)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1210)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.ibm.ws.naming.util.IndirectJndiLookupObjectFactory.getObjectInstance(IndirectJndiLookupObjectFactory.java:193)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:308)
at com.ibm.ws.naming.urlbase.UrlContextHelper.isReference(UrlContextHelper.java:115)
at com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(UrlContextHelper.java:229)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1181)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1158)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1210)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.ibm.wtas.parlay.datapublisher.DataPublisherDatabaseBean.createDBConnection(DataPublisherDatabaseBean.java:164)
at com.ibm.wtas.parlay.datapublisher.DataPublisherDatabaseBean.doInitialize(DataPublisherDatabaseBean.java:119)
at com.ibm.wtas.parlay.datapublisher.DataPublisherBean.handleManagedObjectEvent(DataPublisherBean.java:276)
at com.ibm.wtas.parlay.datapublisher.EJSRemoteStatefulDataPublisherDatabase.handleManagedObjectEvent(EJSRemoteStatefulDataPublisherDatabase.java:265)
at com.ibm.wtas.parlay.datapublisher._DataPublisherDatabase_Stub.handleManagedObjectEvent(_DataPublisherDatabase_Stub.java:461)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.wtas.parlay.management.ApplicationManagerBean.fireManagementEventToManagedObject(ApplicationManagerBean.java:343)
at com.ibm.wtas.parlay.management.ApplicationManagerBean.fireManagementEventInBatchToManagedObjects(ApplicationManagerBean.java:295)
at com.ibm.wtas.parlay.management.ApplicationManagerBean.submitServerEvent(ApplicationManagerBean.java:872)
at com.ibm.wtas.parlay.management.EJSRemoteStatelessApplicationManager.submitServerEvent(EJSRemoteStatelessApplicationManager.java:241)
at com.ibm.wtas.parlay.management._ApplicationManager_Stub.submitServerEvent(_ApplicationManager_Stub.java:628)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.wtas.parlay.ParlayCustomService.fireManagementEventToManagedObject(ParlayCustomService.java:550)
at com.ibm.wtas.parlay.ParlayCustomService.fireManagementEventInBatchToManagedObjects(ParlayCustomService.java:506)
at com.ibm.wtas.parlay.ParlayCustomService.serverStarted(ParlayCustomService.java:250)
at com.ibm.ws.runtime.Server.fireServerStarted(Server.java:1977)
at com.ibm.ws.runtime.StandardServer.initializeRuntime0(StandardServer.java:351)
at com.ibm.ws.runtime.Server.initializeRuntime(Server.java:882)
at com.ibm.ws.runtime.StandardServer.main(StandardServer.java:519)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:158)
at com.ibm.etools.websphere.tools.runner.api.ServerRunner$1.run(ServerRunner.java)
[02.01.25 15:41:32:574 CST] 5584277c Helpers W NMSV0610I: A NamingException is being thrown from a javax.naming.Context implementation. Details follow:
Context implementation: com.ibm.ws.naming.urlns.genericURLContextRoot
Context method: lookup(Name)
Context name: local:
Target name: jdbc/jdbc/Session
Other data:
Exception stack trace: com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while attempting to get an instance of the object for the specified reference object. Root exception is javax.naming.NamingException: ClassNotFoundException: COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource
at com.ibm.websphere.advanced.cm.factory.DataSourceFactory$ResourceReferenceObjectFactory.getObjectInstance(DataSourceFactory.java:754)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:308)
at com.ibm.ws.naming.urlbase.UrlContextHelper.isReference(UrlContextHelper.java:115)
at com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(UrlContextHelper.java:221)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1181)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1158)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1210)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.ibm.ws.naming.util.IndirectJndiLookupObjectFactory.getObjectInstance(IndirectJndiLookupObjectFactory.java:193)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:308)
at com.ibm.ws.naming.urlbase.UrlContextHelper.isReference(UrlContextHelper.java:115)
at com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(UrlContextHelper.java:229)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1181)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1158)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1210)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.ibm.wtas.parlay.datapublisher.DataPublisherDatabaseBean.createDBConnection(DataPublisherDatabaseBean.java:164)
at com.ibm.wtas.parlay.datapublisher.DataPublisherDatabaseBean.doInitialize(DataPublisherDatabaseBean.java:119)
at com.ibm.wtas.parlay.datapublisher.DataPublisherBean.handleManagedObjectEvent(DataPublisherBean.java:276)
at com.ibm.wtas.parlay.datapublisher.EJSRemoteStatefulDataPublisherDatabase.handleManagedObjectEvent(EJSRemoteStatefulDataPublisherDatabase.java:265)
at com.ibm.wtas.parlay.datapublisher._DataPublisherDatabase_Stub.handleManagedObjectEvent(_DataPublisherDatabase_Stub.java:461)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.wtas.parlay.management.ApplicationManagerBean.fireManagementEventToManagedObject(ApplicationManagerBean.java:343)
at com.ibm.wtas.parlay.management.ApplicationManagerBean.fireManagementEventInBatchToManagedObjects(ApplicationManagerBean.java:295)
at com.ibm.wtas.parlay.management.ApplicationManagerBean.submitServerEvent(ApplicationManagerBean.java:872)
at com.ibm.wtas.parlay.management.EJSRemoteStatelessApplicationManager.submitServerEvent(EJSRemoteStatelessApplicationManager.java:241)
at com.ibm.wtas.parlay.management._ApplicationManager_Stub.submitServerEvent(_ApplicationManager_Stub.java:628)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.wtas.parlay.ParlayCustomService.fireManagementEventToManagedObject(ParlayCustomService.java:550)
at com.ibm.wtas.parlay.ParlayCustomService.fireManagementEventInBatchToManagedObjects(ParlayCustomService.java:506)
at com.ibm.wtas.parlay.ParlayCustomService.serverStarted(ParlayCustomService.java:250)
at com.ibm.ws.runtime.Server.fireServerStarted(Server.java:1977)
at com.ibm.ws.runtime.StandardServer.initializeRuntime0(StandardServer.java:351)
at com.ibm.ws.runtime.Server.initializeRuntime(Server.java:882)
at com.ibm.ws.runtime.StandardServer.main(StandardServer.java:519)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:158)
at com.ibm.etools.websphere.tools.runner.api.ServerRunner$1.run(ServerRunner.java)

[02.01.25 15:41:32:704 CST] 5584277c Helpers W NMSV0610I: A NamingException is being thrown from a javax.naming.Context implementation. Details follow:
Context implementation: com.ibm.ws.naming.urlns.genericURLContextRoot
Context method: lookup(Name)
Context name: local:
Target name: local:jdbc/jdbc/Session
Other data:
Exception stack trace: com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while attempting to get an instance of the object for the specified reference object. Root exception is javax.naming.NamingException: ClassNotFoundException: COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource
at com.ibm.websphere.advanced.cm.factory.DataSourceFactory$ResourceReferenceObjectFactory.getObjectInstance(DataSourceFactory.java:754)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:308)
at com.ibm.ws.naming.urlbase.UrlContextHelper.isReference(UrlContextHelper.java:115)
at com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(UrlContextHelper.java:221)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1181)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1158)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1210)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.ibm.ws.naming.util.IndirectJndiLookupObjectFactory.getObjectInstance(IndirectJndiLookupObjectFactory.java:193)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:308)
at com.ibm.ws.naming.urlbase.UrlContextHelper.isReference(UrlContextHelper.java:115)
at com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(UrlContextHelper.java:229)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1181)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1158)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1210)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.ibm.wtas.parlay.datapublisher.DataPublisherDatabaseBean.createDBConnection(DataPublisherDatabaseBean.java:164)
at com.ibm.wtas.parlay.datapublisher.DataPublisherDatabaseBean.doInitialize(DataPublisherDatabaseBean.java:119)
at com.ibm.wtas.parlay.datapublisher.DataPublisherBean.handleManagedObjectEvent(DataPublisherBean.java:276)
at com.ibm.wtas.parlay.datapublisher.EJSRemoteStatefulDataPublisherDatabase.handleManagedObjectEvent(EJSRemoteStatefulDataPublisherDatabase.java:265)
at com.ibm.wtas.parlay.datapublisher._DataPublisherDatabase_Stub.handleManagedObjectEvent(_DataPublisherDatabase_Stub.java:461)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.wtas.parlay.management.ApplicationManagerBean.fireManagementEventToManagedObject(ApplicationManagerBean.java:343)
at com.ibm.wtas.parlay.management.ApplicationManagerBean.fireManagementEventInBatchToManagedObjects(ApplicationManagerBean.java:295)
at com.ibm.wtas.parlay.management.ApplicationManagerBean.submitServerEvent(ApplicationManagerBean.java:872)
at com.ibm.wtas.parlay.management.EJSRemoteStatelessApplicationManager.submitServerEvent(EJSRemoteStatelessApplicationManager.java:241)
at com.ibm.wtas.parlay.management._ApplicationManager_Stub.submitServerEvent(_ApplicationManager_Stub.java:628)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.wtas.parlay.ParlayCustomService.fireManagementEventToManagedObject(ParlayCustomService.java:550)
at com.ibm.wtas.parlay.ParlayCustomService.fireManagementEventInBatchToManagedObjects(ParlayCustomService.java:506)
at com.ibm.wtas.parlay.ParlayCustomService.serverStarted(ParlayCustomService.java:250)
at com.ibm.ws.runtime.Server.fireServerStarted(Server.java:1977)
at com.ibm.ws.runtime.StandardServer.initializeRuntime0(StandardServer.java:351)
at com.ibm.ws.runtime.Server.initializeRuntime(Server.java:882)
at com.ibm.ws.runtime.StandardServer.main(StandardServer.java:519)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:158)
at com.ibm.etools.websphere.tools.runner.api.ServerRunner$1.run(ServerRunner.java)

[02.01.25 15:41:32:854 CST] 5584277c Helpers W NMSV0610I: A NamingException is being thrown from a javax.naming.Context implementation. Details follow:
Context implementation: com.ibm.ws.naming.urlns.genericURLContextRoot
Context method: lookup(String)
Context name: local:
Target name: local:jdbc/jdbc/Session
Other data:
Exception stack trace: com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while attempting to get an instance of the object for the specified reference object. Root exception is javax.naming.NamingException: ClassNotFoundException: COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource
at com.ibm.websphere.advanced.cm.factory.DataSourceFactory$ResourceReferenceObjectFactory.getObjectInstance(DataSourceFactory.java:754)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:308)
at com.ibm.ws.naming.urlbase.UrlContextHelper.isReference(UrlContextHelper.java:115)
at com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(UrlContextHelper.java:221)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1181)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1158)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1210)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.ibm.ws.naming.util.IndirectJndiLookupObjectFactory.getObjectInstance(IndirectJndiLookupObjectFactory.java:193)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:308)
at com.ibm.ws.naming.urlbase.UrlContextHelper.isReference(UrlContextHelper.java:115)
at com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(UrlContextHelper.java:229)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1181)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1158)
at com.ibm.ws.naming.urlbase.UrlContext.lookup(UrlContext.java:1210)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.ibm.wtas.parlay.datapublisher.DataPublisherDatabaseBean.createDBConnection(DataPublisherDatabaseBean.java:164)
at com.ibm.wtas.parlay.datapublisher.DataPublisherDatabaseBean.doInitialize(DataPublisherDatabaseBean.java:119)
at com.ibm.wtas.parlay.datapublisher.DataPublisherBean.handleManagedObjectEvent(DataPublisherBean.java:276)
at com.ibm.wtas.parlay.datapublisher.EJSRemoteStatefulDataPublisherDatabase.handleManagedObjectEvent(EJSRemoteStatefulDataPublisherDatabase.java:265)
at com.ibm.wtas.parlay.datapublisher._DataPublisherDatabase_Stub.handleManagedObjectEvent(_DataPublisherDatabase_Stub.java:461)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.wtas.parlay.management.ApplicationManagerBean.fireManagementEventToManagedObject(ApplicationManagerBean.java:343)
at com.ibm.wtas.parlay.management.ApplicationManagerBean.fireManagementEventInBatchToManagedObjects(ApplicationManagerBean.java:295)
at com.ibm.wtas.parlay.management.ApplicationManagerBean.submitServerEvent(ApplicationManagerBean.java:872)
at com.ibm.wtas.parlay.management.EJSRemoteStatelessApplicationManager.submitServerEvent(EJSRemoteStatelessApplicationManager.java:241)
at com.ibm.wtas.parlay.management._ApplicationManager_Stub.submitServerEvent(_ApplicationManager_Stub.java:628)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.wtas.parlay.ParlayCustomService.fireManagementEventToManagedObject(ParlayCustomService.java:550)
at com.ibm.wtas.parlay.ParlayCustomService.fireManagementEventInBatchToManagedObjects(ParlayCustomService.java:506)
at com.ibm.wtas.parlay.ParlayCustomService.serverStarted(ParlayCustomService.java:250)
at com.ibm.ws.runtime.Server.fireServerStarted(Server.java:1977)
at com.ibm.ws.runtime.StandardServer.initializeRuntime0(StandardServer.java:351)
at com.ibm.ws.runtime.Server.initializeRuntime(Server.java:882)
at com.ibm.ws.runtime.StandardServer.main(StandardServer.java:519)
at java.lang.reflect.Method.invoke(Native Method)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:158)
at com.ibm.etools.websphere.tools.runner.api.ServerRunner$1.run(ServerRunner.java)
Any help on this topic will help!
Thank you!
Christy
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
This looks like a WebSphere issue so I am moving this to that forum.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Mike Yu
Ranch Hand

Joined: Nov 17, 2001
Posts: 175
InitialContext ic = new InitialContext;


Thanks,<br />Mike
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: problem with DB2 connection in a stateful session bean and deployed by Websphere