[转帖]Weblogic 10.3配置db2连接池Cannot load driver: COM.ibm.db2.jdbc.app.DB2Driver _Tomcat, WebLogic及J2EE讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  Tomcat, WebLogic及J2EE讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 5680 | 回复: 0   主题: [转帖]Weblogic 10.3配置db2连接池Cannot load driver: COM.ibm.db2.jdbc.app.DB2Driver         上一篇   下一篇 
johnnyfox
注册用户
等级:新兵
经验:41
发帖:90
精华:0
注册:2011-12-12
状态:离线
发送短消息息给johnnyfox 加好友    发送短消息息给johnnyfox 发消息
发表于: IP:您无权察看 2015-1-7 15:03:36 | [全部帖] [楼主帖] 楼主

1)先要从下面目录

[db2inst@linux01 java]$ pwd
/home/db2inst/sqllib/java


复制db2java.jar  ,db2jcc.jar  ,db2jcc_license_cu.jar 到

/weblogic/user_projects/domains/test_domain/lib


这个目录里的README.txt说的很清楚,这个目录里的.jar文件会在weblogic启动时自动加到CLASSPATH的最后。

这样,在Weblogic启动时可以看到下面的日志:

<Jan 25, 2011 1:56:07 AM CST> <Notice> <WebLogicServer> <BEA-000395> <Following extensions directory contents added to the end of the classpath:
/weblogic/user_projects/domains/test_domain/lib/db2java.jar:/weblogic/user_projects/domains/test_domain/lib/db2jcc.jar:/weblogic/user_projects/domains/test_domain/lib/db2jcc_license_cu.jar>


2)这个完了之后,按照标准做法仍然不行。在Test Configuration时会收到下面的错误提示:

Connection test failed.
Cannot load driver: COM.ibm.db2.jdbc.app.DB2Driver


很误导人的一个提示

如果创建JDBC时采用Other,来手动指定Driver Class Name等设定之后在Test Configuration时会提示
找不到 db2jcct2云云...

其实时找不到libdb2jcct2.so   can't load db2jcct2(windows为db2jcct2.dll)

需要做的就是

]# export LD_LIBRARY_PATH=/home/db2inst/sqllib/lib:$LD_LIBRARY_PATH


然后重起Weblogic,再创建JDBC就没有任何问题了,无论Database Driver用DB2的还是Oracle(weblogic)的。

看来还是没有把/home/db2inst/sqllib/lib加到LD_LIBRARY_PATH里造成的。

针对不同操作系统:

On Windows?:
Add the path that includes the db2jcct2.dll file to the PATH variable. By default, the db2jcct2.dll file is located in %DB2HOME%\bin.
On UNIX:
DB2 Content Manager V8.4 and its APIs load libdb2jcct2.so from DB2 instance library path defined in LD_LIBRARY_PATH or LIBPATH variable.
32-bit DB2 Instance:
Make sure that the DB2 instance library path exists in LD_LIBRARY_PATH (Solaris? or Linux) or LIBPATH (AIX?). For example:
For Solaris: export LD_LIBRARY_PATH=/export/home/db2inst1/sqllib/lib:$LD_LIBRARY_PATH
For Linux: export LD_LIBRARY_PATH=/home/db2inst1/sqllib/lib:$LD_LIBRARY_PATH
For AIX: export LIBPATH=/home/db2inst1/sqllib/lib:$LIBPATH
64-bit DB2 Instance:
For 64-bit DB2 instance, [DB2 Instance Dir]/sqllib/lib links to 64-bit library directory. The following is the link relationship of the DB2 library directory on UNIX:
[DB2 Instance Dir]/sqllib/lib -> [DB2 Instance Dir]/sqllib/lib64 -> [DB2 Product Installation Dir]/lib64
[DB2 Instance Dir]/sqllib/lib32 -> [DB2 Product Installation Dir]/lib32
But DB2 Content Manager V8.4 supports only the 32-bit libdb2jcct2.so. To make DB2 Content Manager V8.4 and its APIs work correctly, the path to 32-bit libraries must be listed before the path to the 64-bit libraries in LD_LIBRARY_PATH or LIBPATH.
For example:
For AIX?: export LIBPATH=/opt/IBM/db2/V9.1/lib32:$LIBPATH
#weblogic&oracle app server


--转自 北京联动北方科技有限公司




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论