?
Solved

connection to db2 through datasource in websphere 4.0.3

Posted on 2004-03-30
11
Medium Priority
?
622 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
8 Comments
 
LVL 4

Expert Comment

by:Stan Reeser
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:
Stan Reeser earned 500 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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
 
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 500 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:Stan Reeser
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

-Xmx and -Xms are the two JVM options often used to tune JVM heap size.   Here are some common mistakes made when using them:   Assume BigApp is a java class file for the below examples. 1.         Missing m, M, g or G at the end …
Upgrading Tomcat – There are a couple of methods to upgrade Tomcat is to use The Apache Installer is to download and unzip and run the services.bat remove|install Tomcat6 Because of the App that we are working with, we can only use Tomcat 6.…
Loops Section Overview
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month16 days, 21 hours left to enroll

862 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