Solved

connection to db2 through datasource in websphere 4.0.3

Posted on 2004-03-30
11
569 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Suggested Solutions

Title # Comments Views Activity
Allow Firefox to use Java 6 plugin? 15 59
Shorten long url?  Apache2 and Tomcat. 7 257
Should we upgrade from Tomcat 7 to Tomcat 8 ? 5 828
spring example errors 33 504
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…
Verbose logging is used to diagnose garbage collector problems. By default, -verbose:gc output is written to either native_stderr.log or native_stdout.log.   It is also possible to redirect the logs to a user-specified file. This article will de…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

733 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