websphere4连接DB2数据库的问题,急啊
程序中采用JDNI调用数据库
我连接数据库部分是这么写的
public class DBManage {
private static PropertyResourceBundle sqlBundle;
private static PropertyResourceBundle configBundle;
private DataSource ds = null;
private Connection cn = null;
private PreparedStatement ps = null;
private ResultSet rs = null;
private String strDataSource = null;
private String strDataBase = null;
private String NAMESPACE = "<nameSpace>";
private String TABLENAME = "<tableName>";
//private PrintWriter log;
static {
sqlBundle =
(PropertyResourceBundle) PropertyResourceBundle.getBundle(
"cn.com.net99.db.sql");
configBundle =
(PropertyResourceBundle) PropertyResourceBundle.getBundle(
"cn.com.net99.db.config");
}
/**
* 构造函数。在该构造函数中获取连接数据库需要的DataSource。
* @throws Exception
*/
public DBManage() throws Exception {
Context ctx = null;
try {
Hashtable parms = new Hashtable();
parms.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
strDataSource = configBundle.getString("DataSource");
// strDataBase = configBundle.getString("DataBase");
//String strLogFile = configBundle.getString("logfile");
//log = new PrintWriter(new FileWriter(strLogFile, true), true);
ctx = new InitialContext(parms);
//ctx = new InitialContext();
ds = (DataSource) ctx.lookup(strDataSource);
}
catch (Exception e) {
e.printStackTrace();
System.out.println("数据库操作错误");
}
finally {
if (ctx != null) {
ctx.close();
}
}
}
config.properties是这么写的
DataSource=java:comp/env/jdbc/CHINA
DataBase=CHINA
web.xml是这么写的
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app id="WebApp_ID">
<display-name>IPDPoD</display-name>
<description>IPDPoD</description>
<welcome-file-list id="WelcomeFileList_1">
<welcome-file>index.jsp</welcome-file>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<env-entry>
<env-entry-name>param/DBNameSpace</env-entry-name>
<env-entry-value>CHINA</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
</web-app>
但是在websphere4抱错
[04.10.13 09:40:45:677 CST] 1bbc8052 SystemOut U ???????
[04.10.13 09:40:45:726 CST] 1bbc8052 WebGroup X Servlet Error: java.lang.String: method replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; not found: java.lang.Exception: java.lang.String: method replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; not found
at admin.index_jsp_0._jspService(index_jsp_0.java:210)
请问这个是什么错误啊,我应该怎么改啊,急!!!
(websphere4没法换)