Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Petstore on WAS/DB2 contd...

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have installed Web Application Server 4.0 and DB2 version 7.2/Version 7.1 FixPak 3. I have both products running on the same Win2K Server machine (development / evaluation purposes only).
I have followed all the setup instructions as per the documentation for DB2 and everything looks fine. I can query the tables that the scripts create etc through DB2 control center etc, however, when I try to enter the Petstore store, I get the message:
"Unable to Connect to Database Database Connection is closed: Confirm that you have started your database".
When I look in the default_server_stdout.log file I see the following error message:

[01.08.27 20:09:11:988 EDT] 4d58298f Helpers W NMSV0610I: A NamingException is being thrown from a javax.naming.Context implementation. Details follow:
Context implementation: com.ibm.ws.naming.java.javaURLContextRoot
Context method: lookup(String)
Context name: java:
Target name: java:comp/env/jdbc/EstoreDataSource
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 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.sun.j2ee.blueprints.tools.populate.web.PopulateServlet.getDBConnection(PopulateServlet.java:359)
at com.sun.j2ee.blueprints.tools.populate.web.PopulateServlet.checkConnection(PopulateServlet.java:179)
at com.sun.j2ee.blueprints.tools.populate.web.PopulateServlet.doGet(PopulateServlet.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager.java:827)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycleServlet.java:159)
at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServlet.java:286)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycleServlet.java:106)
at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:472)
at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletManager.java:1012)
at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManager.java:913)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:499)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:278)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:105)
at com.ibm.servlet.engine.srt.WebAppInvoker.doForward(WebAppInvoker.java:67)
at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:123)
at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:67)
at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:122)
at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener.java:315)
at com.ibm.servlet.engine.http11.HttpConnection.handleRequest(HttpConnection.java:60)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:313)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:242)
at com.ibm.ws.util.CachedThread.run(ThreadPool.java:122)
Is there another db driver that I should be using instead of COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource?
Thanks
Jason
jasonnewyork@yahoo.com
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jason,
Did you try to access the database from the Command Line Processor?
It is under IBM DB2>> Command Line Processor.
See if that helps.
Meddie

Originally posted by jason jones:
I have installed Web Application Server 4.0 and DB2 version 7.2/Version 7.1 FixPak 3. I have both products running on the same Win2K Server machine (development / evaluation purposes only).
I have followed all the setup instructions as per the documentation for DB2 and everything looks fine. I can query the tables that the scripts create etc through DB2 control center etc, however, when I try to enter the Petstore store, I get the message:
"Unable to Connect to Database Database Connection is closed: Confirm that you have started your database".
When I look in the default_server_stdout.log file I see the following error message:

[01.08.27 20:09:11:988 EDT] 4d58298f Helpers W NMSV0610I: A NamingException is being thrown from a javax.naming.Context implementation. Details follow:
Context implementation: com.ibm.ws.naming.java.javaURLContextRoot
Context method: lookup(String)
Context name: java:
Target name: java:comp/env/jdbc/EstoreDataSource
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 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.sun.j2ee.blueprints.tools.populate.web.PopulateServlet.getDBConnection(PopulateServlet.java:359)
at com.sun.j2ee.blueprints.tools.populate.web.PopulateServlet.checkConnection(PopulateServlet.java:179)
at com.sun.j2ee.blueprints.tools.populate.web.PopulateServlet.doGet(PopulateServlet.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager.java:827)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycleServlet.java:159)
at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServlet.java:286)
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycleServlet.java:106)
at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java:472)
at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletManager.java:1012)
at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManager.java:913)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:499)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:278)
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:105)
at com.ibm.servlet.engine.srt.WebAppInvoker.doForward(WebAppInvoker.java:67)
at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:123)
at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:67)
at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:122)
at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener.java:315)
at com.ibm.servlet.engine.http11.HttpConnection.handleRequest(HttpConnection.java:60)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:313)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:242)
at com.ibm.ws.util.CachedThread.run(ThreadPool.java:122)
Is there another db driver that I should be using instead of COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource?
Thanks
Jason
jasonnewyork@yahoo.com


 
jason jones
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure how that will help. The database does seem to be online and available from within the Db2 tools, however, when the Petstore demo attempts to access the database via jdbc I get the error message described below.

Originally posted by meddie katongole:
Jason,
Did you try to access the database from the Command Line Processor?
It is under IBM DB2>> Command Line Processor.
See if that helps.
Meddie


 
meddie katongole
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You connect to the database using "connect to db" where db is the name of the database and it tells you whether you have a connection or not.
Try it and see.

Originally posted by jason jones:
I am not sure how that will help. The database does seem to be online and available from within the Db2 tools, however, when the Petstore demo attempts to access the database via jdbc I get the error message described below.


 
jason jones
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried that and the connection worked, however, the Petstore application still does not work. I believe the problem is somewhere in the connection between the application and DB2.
The JDBC driver I am using is called: "Db2JdbcDriver", located in "D:\IBM\DB2\java\db2java.zip", and the implementation class name is "COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource".
Does this look appropriate?
Jason

Originally posted by meddie katongole:
You connect to the database using "connect to db" where db is the name of the database and it tells you whether you have a connection or not.
Try it and see.


 
jason jones
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I found the problem. It appears that by default JDBC 1.0 is installed - and it has no concept of connection pooling. The following article http://www-4.ibm.com/software/webservers/appserv/v4_faqs.html#11 points to instructions that explain how to upgrade to JDBC 2.0.
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by jason jones:
I found the problem. It appears that by default JDBC 1.0 is installed - and it has no concept of connection pooling. The following article http://www-4.ibm.com/software/webservers/appserv/v4_faqs.html#11 points to instructions that explain how to upgrade to JDBC 2.0.

 
Chitra Sen
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by jason jones:
I found the problem. It appears that by default JDBC 1.0 is installed - and it has no concept of connection pooling. The following article http://www-4.ibm.com/software/webservers/appserv/v4_faqs.html#11 points to instructions that explain how to upgrade to JDBC 2.0.



Hi Jones...
Iam also getting the same problem with oracle datasource.. but i didn't find any article which u have mentioned ...can u please tell me how to check for the version of JDBC
 
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chira
This applies only to DB2 as by default in DB2 7.x versions, JDBC2 is not enabled.
 
Ranch Hand
Posts: 219
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
chitra.. if u were looking for a way to make sure u are using jdbc2 for db2, the run the script usejdbc2.bat that is provided in the db2 installation directory.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
When I import an ear file in WSAD 5.0 and try to run the project, I am facing the same exception
javax.naming.NamingException: ClassNotFoundException: COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource
I am getting this problem only in one machine. Initially this machine didn't contain IBM DB2. I installed version 7 of the same. But still I am continuing to get the same error.
Please help.
 
reply
    Bookmark Topic Watch Topic
  • New Topic