Bjo020
asked on
connection to db2 through datasource in websphere 4.0.3
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/UnspecifiedDo mainName/l egacyRoot" 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.factor y.DataSour ceFactory$ ResourceRe ferenceObj ectFactory
Reference Factory Class Location URLs: <null>
Reference Class Name: com.ibm.ejs.cm.portability .PortableD ataSource
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: disableAutoConnectionClean up
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.DB2Connec tionPoolDa taSource
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.NoClassDefFoundE rror: javax/sql/ConnectionPoolDa taSource
at java.lang.ClassLoader.defi neClass0(N ative Method)
at java.lang.ClassLoader.defi neClass(Cl assLoader. java(Compi led Code))
at java.security.SecureClassL oader.defi neClass(Se cureClassL oader.java (Compiled Code))
at java.net.URLClassLoader.de fineClass( URLClassLo ader.java( Compiled Code))
at java.net.URLClassLoader$Cl assFinder. run(URLCla ssLoader.j ava(Compil ed Code))
at java.net.URLClassLoader$Cl assFinder. run(URLCla ssLoader.j ava(Compil ed Code))
at java.security.AccessContro ller.doPri vileged(Na tive Method)
at java.net.URLClassLoader.fi ndClass(UR LClassLoad er.java(Co mpiled Code))
at java.lang.ClassLoader.load Class(Clas sLoader.ja va(Compile d Code))
at sun.misc.Launcher$AppClass Loader.loa dClass(Lau ncher.java (Compiled Code))
at java.lang.ClassLoader.load Class(Clas sLoader.ja va(Compile d Code))
at java.lang.ClassLoader.load Class(Clas sLoader.ja va(Compile d Code))
at com.ibm.ws.classloader.Com poundClass Loader.loa dClass(Com poundClass Loader.jav a:261)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va(Compile d Code))
at com.ibm.ws.classloader.Com poundClass Loader.loa dClass(Com poundClass Loader.jav a:261)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va(Compile d Code))
at com.ibm.ws.classloader.Rel oadableCla ssLoader.l oadClass(R eloadableC lassLoader .java:79)
at com.ibm.websphere.advanced .cm.factor y.DataSour ceFactory. isJTAEnabl ed(DataSou rceFactory .java:508)
at com.ibm.ejs.cm.DataSourceF actory.cre ateDataSou rce(DataSo urceFactor y.java:156 )
at com.ibm.ejs.cm.DataSourceF actory.get DataSource (DataSourc eFactory.j ava:114)
at com.ibm.websphere.advanced .cm.factor y.DataSour ceFactory. getDataSou rce(DataSo urceFactor y.java:386 )
at com.ibm.websphere.advanced .cm.factor y.DataSour ceFactory$ ResourceRe ferenceObj ectFactory .getObject Instance(D ataSourceF actory.jav a:701)
at javax.naming.spi.NamingMan ager.getOb jectInstan ce(NamingM anager.jav a:313)
at com.ibm.ws.naming.util.Hel pers.proce ssSerializ edObjectFo rLookup(He lpers.java :736)
at com.ibm.ejs.ns.jndi.CNCont extImpl.ca cheLookup( CNContextI mpl.java:2 683)
at com.ibm.ejs.ns.jndi.CNCont extImpl.do Lookup(CNC ontextImpl .java:1416 )
at com.ibm.ejs.ns.jndi.CNCont extImpl.lo okup(CNCon textImpl.j ava:1121)
at com.ibm.ws.naming.util.Wsn InitCtx.lo okup(WsnIn itCtx.java :128)
at javax.naming.InitialContex t.lookup(I nitialCont ext.java:3 59)
at hdesk.fps.SQLUtil.<clinit> (SQLUtil.j ava:162)
at _leftnavi_jsp_24._jspServi ce(_leftna vi_jsp_24. java:158)
at org.apache.jasper.runtime. HttpJspBas e.service( HttpJspBas e.java:142 )
at javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 853)
at org.apache.jasper.runtime. JspServlet $JspServle tWrapper.s ervice(Jsp Servlet.ja va:301)
at org.apache.jasper.runtime. JspServlet .serviceJs pFile(JspS ervlet.jav a:445)
at org.apache.jasper.runtime. JspServlet .service(J spServlet. java:579)
at javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 853)
at com.ibm.servlet.engine.web app.Strict ServletIns tance.doSe rvice(Serv letManager .java:827)
at com.ibm.servlet.engine.web app.Strict LifecycleS ervlet._se rvice(Stri ctLifecycl eServlet.j ava:167)
at com.ibm.servlet.engine.web app.IdleSe rvletState .service(S trictLifec ycleServle t.java:297 )
at com.ibm.servlet.engine.web app.Strict LifecycleS ervlet.ser vice(Stric tLifecycle Servlet.ja va:110)
at com.ibm.servlet.engine.web app.Servle tInstance. service(Se rvletManag er.java:47 2)
at com.ibm.servlet.engine.web app.ValidS ervletRefe renceState .dispatch( ServletMan ager.java: 1012)
at com.ibm.servlet.engine.web app.Servle tInstanceR eference.d ispatch(Se rvletManag er.java:91 3)
at com.ibm.servlet.engine.web app.WebApp RequestDis patcher.ha ndleWebApp Dispatch(W ebAppReque stDispatch er.java:66 5)
at com.ibm.servlet.engine.web app.WebApp RequestDis patcher.di spatch(Web AppRequest Dispatcher .java:331)
at com.ibm.servlet.engine.web app.WebApp RequestDis patcher.fo rward(WebA ppRequestD ispatcher. java:117)
at com.ibm.servlet.engine.srt .WebAppInv oker.doFor ward(WebAp pInvoker.j ava:124)
at com.ibm.servlet.engine.srt .WebAppInv oker.handl eInvocatio nHook(WebA ppInvoker. java:218)
at com.ibm.servlet.engine.inv ocation.Ca chedInvoca tion.handl eInvocatio n(CachedIn vocation.j ava:67)
at com.ibm.servlet.engine.srp .ServletRe questProce ssor.dispa tchByURI(S ervletRequ estProcess or.java:12 2)
at com.ibm.servlet.engine.ose listener.O SEListener Dispatcher .service(O SEListener .java:315)
at com.ibm.servlet.engine.htt p11.HttpCo nnection.h andleReque st(HttpCon nection.ja va:60)
at com.ibm.ws.http.HttpConnec tion.readA ndHandleRe quest(Http Connection .java:323)
at com.ibm.ws.http.HttpConnec tion.run(H ttpConnect ion.java:2 52)
at com.ibm.ws.util.CachedThre ad.run(Thr eadPool.ja va: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_FA CTORY, "com.ibm.websphere.naming. WsnInitial ContextFac tory");
javax.naming.Context context = new javax.naming.InitialContex t(parms);
source = (javax.sql.DataSource)cont ext.lookup ("jdbc/web report");
context.close();
}
}
catch(Exception exception)
{
System.out.println(excepti on);
}
}
public Connection getConnection()
throws SQLException
{
return source.getConnection("XXXX ", "YYYY"); // ERROR
}
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/UnspecifiedDo
Reference data follows:
Reference Factory Class Name: com.ibm.websphere.advanced
Reference Factory Class Location URLs: <null>
Reference Class Name: com.ibm.ejs.cm.portability
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: disableAutoConnectionClean
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.DB2Connec
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.NoClassDefFoundE
at java.lang.ClassLoader.defi
at java.lang.ClassLoader.defi
at java.security.SecureClassL
at java.net.URLClassLoader.de
at java.net.URLClassLoader$Cl
at java.net.URLClassLoader$Cl
at java.security.AccessContro
at java.net.URLClassLoader.fi
at java.lang.ClassLoader.load
at sun.misc.Launcher$AppClass
at java.lang.ClassLoader.load
at java.lang.ClassLoader.load
at com.ibm.ws.classloader.Com
at java.lang.ClassLoader.load
at com.ibm.ws.classloader.Com
at java.lang.ClassLoader.load
at com.ibm.ws.classloader.Rel
at com.ibm.websphere.advanced
at com.ibm.ejs.cm.DataSourceF
at com.ibm.ejs.cm.DataSourceF
at com.ibm.websphere.advanced
at com.ibm.websphere.advanced
at javax.naming.spi.NamingMan
at com.ibm.ws.naming.util.Hel
at com.ibm.ejs.ns.jndi.CNCont
at com.ibm.ejs.ns.jndi.CNCont
at com.ibm.ejs.ns.jndi.CNCont
at com.ibm.ws.naming.util.Wsn
at javax.naming.InitialContex
at hdesk.fps.SQLUtil.<clinit>
at _leftnavi_jsp_24._jspServi
at org.apache.jasper.runtime.
at javax.servlet.http.HttpSer
at org.apache.jasper.runtime.
at org.apache.jasper.runtime.
at org.apache.jasper.runtime.
at javax.servlet.http.HttpSer
at com.ibm.servlet.engine.web
at com.ibm.servlet.engine.web
at com.ibm.servlet.engine.web
at com.ibm.servlet.engine.web
at com.ibm.servlet.engine.web
at com.ibm.servlet.engine.web
at com.ibm.servlet.engine.web
at com.ibm.servlet.engine.web
at com.ibm.servlet.engine.web
at com.ibm.servlet.engine.web
at com.ibm.servlet.engine.srt
at com.ibm.servlet.engine.srt
at com.ibm.servlet.engine.inv
at com.ibm.servlet.engine.srp
at com.ibm.servlet.engine.ose
at com.ibm.servlet.engine.htt
at com.ibm.ws.http.HttpConnec
at com.ibm.ws.http.HttpConnec
at com.ibm.ws.util.CachedThre
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_
javax.naming.Context context = new javax.naming.InitialContex
source = (javax.sql.DataSource)cont
context.close();
}
}
catch(Exception exception)
{
System.out.println(excepti
}
}
public Connection getConnection()
throws SQLException
{
return source.getConnection("XXXX
}
Did you define your data source?
ASKER
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: disableAutoConnectionClean up
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.DB2Connec tionPoolDa taSource
Type: user
Content: webreport
Type: password
Content: {xor}DCs+LStubWw=
Type: description
Content: New DB2 Data source
Type: databaseName
Content: db2hdesk
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: disableAutoConnectionClean
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.DB2Connec
Type: user
Content: webreport
Type: password
Content: {xor}DCs+LStubWw=
Type: description
Content: New DB2 Data source
Type: databaseName
Content: db2hdesk
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>> java.lang.NoClassDefFoundE rror: javax/sql/ConnectionPoolDa taSource
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
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
>> javax/sql/ConnectionPoolDa taSource
is part of JRE's rt.jar. So that is the culprit.
Change your JVM...
is part of JRE's rt.jar. So that is the culprit.
Change your JVM...
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
looks like sreeser made a valid point, and damonf's suggestion is certainly something to try. mmuruganandam looks inaccurate to me.
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/UnspecifiedDo mainName/l egacyRoot" 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
A Reference object looked up from the context "domainRoots/UnspecifiedDo
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