Solved

connection to db2 through datasource in websphere 4.0.3

Posted on 2004-03-30
11
537 Views
Last Modified: 2013-12-10
Hi

When trying to connect to db2 through a datasource in websphere 4.0.3 i get this error :

[30/03/04 15:56:11:312 CEST] 6c1cef40 Helpers       W NMSV0605E: A Reference object looked up from the context "domainRoots/UnspecifiedDomainName/legacyRoot" with the name "jdbc/webreport" 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
Type: name
Content: webreport
Type: minimumPoolSize
Content: 1
Type: maximumPoolSize
Content: 30
Type: connectionTimeout
Content: 180
Type: idleTimeout
Content: 1800
Type: orphanTimeout
Content: 1800
Type: statementCacheSize
Content: 100
Type: disableAutoConnectionCleanup
Content: false
Type: oemId
Content: WebSphereSequeLinkClient
Type: informixLockModeWait
Content: 0
Type: oracleStmtCacheSize
Content: 0
Type: disable2Phase
Content: false
Type: dataSourceClassName
Content: COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource
Type: user
Content: webreport
Type: password
Content: {xor}DCs+LStubWw=
Type: description
Content: New DB2 Data source
Type: databaseName
Content: db2hdesk

Exception data follows:
java.lang.NoClassDefFoundError: javax/sql/ConnectionPoolDataSource
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java(Compiled Code))
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java(Compiled Code))
      at java.net.URLClassLoader.defineClass(URLClassLoader.java(Compiled Code))
      at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java(Compiled Code))
      at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java(Compiled Code))
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java(Compiled Code))
      at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java(Compiled Code))
      at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
      at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
      at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:261)
      at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
      at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:261)
      at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code))
      at com.ibm.ws.classloader.ReloadableClassLoader.loadClass(ReloadableClassLoader.java:79)
      at com.ibm.websphere.advanced.cm.factory.DataSourceFactory.isJTAEnabled(DataSourceFactory.java:508)
      at com.ibm.ejs.cm.DataSourceFactory.createDataSource(DataSourceFactory.java:156)
      at com.ibm.ejs.cm.DataSourceFactory.getDataSource(DataSourceFactory.java:114)
      at com.ibm.websphere.advanced.cm.factory.DataSourceFactory.getDataSource(DataSourceFactory.java:386)
      at com.ibm.websphere.advanced.cm.factory.DataSourceFactory$ResourceReferenceObjectFactory.getObjectInstance(DataSourceFactory.java:701)
      at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:313)
      at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookup(Helpers.java:736)
      at com.ibm.ejs.ns.jndi.CNContextImpl.cacheLookup(CNContextImpl.java:2683)
      at com.ibm.ejs.ns.jndi.CNContextImpl.doLookup(CNContextImpl.java:1416)
      at com.ibm.ejs.ns.jndi.CNContextImpl.lookup(CNContextImpl.java:1121)
      at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:128)
      at javax.naming.InitialContext.lookup(InitialContext.java:359)
      at hdesk.fps.SQLUtil.<clinit>(SQLUtil.java:162)
      at _leftnavi_jsp_24._jspService(_leftnavi_jsp_24.java:158)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:142)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
      at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:301)
      at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:445)
      at org.apache.jasper.runtime.JspServlet.service(JspServlet.java:579)
      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:167)
      at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServlet.java:297)
      at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycleServlet.java:110)
      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:665)
      at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:331)
      at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:117)
      at com.ibm.servlet.engine.srt.WebAppInvoker.doForward(WebAppInvoker.java:124)
      at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:218)
      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:323)
      at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:252)
      at com.ibm.ws.util.CachedThread.run(ThreadPool.java:137)

I can see that I do connect to datasource as the datasource information is pulled out.


   static
    {
        try
        {
        if(source==null) {
           java.util.Properties parms = new java.util.Properties();      
           parms.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");      
           
           javax.naming.Context context = new javax.naming.InitialContext(parms);                        
           source = (javax.sql.DataSource)context.lookup("jdbc/webreport");

           context.close();
          }
        }
        catch(Exception exception)
        {        
          System.out.println(exception);
        }
    }


    public Connection getConnection()
        throws SQLException
    {
        return source.getConnection("XXXX", "YYYY"); // ERROR
    }


 
0
Comment
Question by:Bjo020
  • 3
  • 2
  • 2
  • +1
11 Comments
 
LVL 4

Expert Comment

by:sreeser
ID: 10777938
Did you define your data source?
0
 

Author Comment

by:Bjo020
ID: 10781405
Yes.

All this is variables set in the data source :

Type: name
Content: webreport
Type: minimumPoolSize
Content: 1
Type: maximumPoolSize
Content: 30
Type: connectionTimeout
Content: 180
Type: idleTimeout
Content: 1800
Type: orphanTimeout
Content: 1800
Type: statementCacheSize
Content: 100
Type: disableAutoConnectionCleanup
Content: false
Type: oemId
Content: WebSphereSequeLinkClient
Type: informixLockModeWait
Content: 0
Type: oracleStmtCacheSize
Content: 0
Type: disable2Phase
Content: false
Type: dataSourceClassName
Content: COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource
Type: user
Content: webreport
Type: password
Content: {xor}DCs+LStubWw=
Type: description
Content: New DB2 Data source
Type: databaseName
Content: db2hdesk
0
 
LVL 4

Accepted Solution

by:
sreeser earned 125 total points
ID: 10785452
Its been a couple of years since I've done that but I am pretty sure you have to define the  db2 node that you want to access.
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 11067242
>> java.lang.NoClassDefFoundError: javax/sql/ConnectionPoolDataSource

From this, I can say, you are running in a low version JDK which doesn't support this.
You can have a higher version of JDK in which the websphere runs, then you can rectify this problem
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 9

Expert Comment

by:mmuruganandam
ID: 11067253
>> javax/sql/ConnectionPoolDataSource

is part of JRE's rt.jar.  So that is the culprit.
Change your JVM...
0
 
LVL 7

Assisted Solution

by:damonf
damonf earned 125 total points
ID: 11109563
you need to turn on jdbc2 in your db2 driver.  Stop all your db2 services, then go to <db2_install_root>/jdbc12/ and run usejdbc2.bat
0
 
LVL 7

Expert Comment

by:damonf
ID: 11392963
looks like  sreeser made a valid point, and damonf's suggestion is certainly something to try.  mmuruganandam looks inaccurate to me.
0
 
LVL 4

Expert Comment

by:sreeser
ID: 11393142
hard to pinpoint the problem with the minimal interaction, he clearly doesnt have his data sources set up correctly, and I dont't have the errors committed to memory but

A Reference object looked up from the context "domainRoots/UnspecifiedDomainName/legacyRoot" with the name "jdbc/webreport" was sent to the JNDI Naming Manager and an exception resulted.


This looks pretty clear that he cant log in.  Could be the drivers that damonf suggested, it could be the data source isn't registered ... I know that is a fairly complicated endevor the first time in WS, or it could be the database webuser doesnt exist (its odd that the db name and the user name are the same, is it not?)  I agree that I dont think it is the version of java as it gives u the java at install if I remember correctly (and WS 4 is lmost 3 years old now so unless he's not at Java 2 that really shouldn't be the problem)

HTH
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Secure cookies 1 61
How do you get SOAP Header in Library call 4 96
method reurn 7 83
java question on merging xls 3 68
Configure Web Service (server application) I. Configure security for Web Services methods First, we need to protect Session bean which implements the service: 1. Open EJB deployment descriptor (ejb-jar.xml) in the EJB project that contains you…
There are numerous questions about how to setup an IBM HTTP Server to be administered from WebSphere Application Server administrative console. I do hope this article will wrap things up and become a reference for this task. You need three things…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now