100分诚恳给出,请问这个Exception 是Weblogic81数据库连接池问题! pro.put(InitialContext.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLIntialContextFactory");pro.put(InitialContext.PROVIDER_URL,"t3://localhost:7001"); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你的程序不正确:import java.util.*;import java.sql.*;import javax.sql.*;import javax.naming.*;public class DataSourseTest { public DataSourseTest() { } public static void main(String[] args){ Connection con=null; Context context = getInitialContext(); // Context ctx=new InitialContext(pro); // DataSource ds=(DataSource)ctx.lookup("my/oracle");// 你的这行代码也有问题 DataSource ds=(DataSource)ctx.lookup("java:/comp/jdbc/oracle");// System.out.println("2!!!!!!!!!!!"); con=ds.getConnection(); System.out.println("Connection is ok!"); System.out.println(ds.getClass().getName()); }catch(Exception e){ e.printStackTrace(); }finally{ if(con!=null)try{con.close();}catch(Exception e){} } }private Context getInitialContext() throws Exception { String url = "t3://localhost:7001"; String user = null; String password = null; Properties properties = null; try { properties = new Properties(); properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); properties.put(Context.PROVIDER_URL, url); if (user != null) { properties.put(Context.SECURITY_PRINCIPAL, user); properties.put(Context.SECURITY_CREDENTIALS, password == null ? "" : password); } return new InitialContext(properties); } catch(Exception e) { log("Unable to connect to WebLogic server at " + url); log("Please make sure that the server is running."); throw e; } }}当然,我部知道你的具体的问题,和怎么配置的!!但是你要注意两点:(1)确定你的服务器合理的启动(2数据原正确的配置和要使用正确的java命名空间 我觉得是初始化试出的问题,你的环境属性改成:pro.put(InitialContext.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLIntialContextFactory");pro.put(InitialContext.PROVIDER_URL,"t3://localhost:7001"); pro.put(InitialContext.PROVIDER_URL,"t3://localhost:7001");我加上了这句 结果还是那个错误,,我的oracle server肯定启动了 基本的jdbc程序都可以用 ClassNotFoundException: weblogic.jndi.WLIntialContextFactoryweblogic起了没 Weblogic 绝对起了!但我刚刚试了试 不启动weblogic 好象错误信息也一样可我在jb里配置wb了啊,,并且在jb里用weblogic platform server 8.x admin console能启动ie,,访问http://localhost:7001/console 和weblogic的通信有问题,请检查weblogic是否安装成功。 在up 1,2下吧,我的jbuilder9 安装文件才150m大,,是不是这个原因?? 嘿嘿,我认为是weblogic.jndi.WLIntialContextFactory所在的包没有加载进来,Add External lib http://download2.bea.com/pub/releases/810/server810_win32.exe我下的是这个版本安装文件有217mb蛇蝎男人) 谢谢你 能告我怎么Add External lib 么 谢谢 中午了 高手们吃饭休息的时候帮我look 一下so up! weblogic.jndi.WLIntialContextFactory所在的包没有加载进来所以问题就是weblogic和jbuilder集成没配置好!缺CLASS 为什么一定要使用接口呢? 登陆界面登陆成功或失败页面跳转的问题 spring2.5的AOP求解? java比例截图 要无锯齿的 请赐教 关于Jetspeed2的验证问题,在线等待~~~~~~~~~~))) struts 中的<html:message>如何用? 大家可以帮我看看下面的程序为什么不能运行啊 兼职项目经理,系统分析员,架构师 请教大家一些关于JBuilder8.0的一些问题,谢谢大家!! 关于spring定时器求帮忙 J2EE布署问题! 用xsl如何判别xml节点的值????????
import java.util.*;
import java.sql.*;
import javax.sql.*;
import javax.naming.*;
public class DataSourseTest {
public DataSourseTest() {
} public static void main(String[] args){
Connection con=null;
Context context = getInitialContext();
// Context ctx=new InitialContext(pro);
// DataSource ds=(DataSource)ctx.lookup("my/oracle");// 你的这行代码也有问题
DataSource ds=(DataSource)ctx.lookup("java:/comp/jdbc/oracle");//
System.out.println("2!!!!!!!!!!!");
con=ds.getConnection();
System.out.println("Connection is ok!");
System.out.println(ds.getClass().getName());
}catch(Exception e){
e.printStackTrace();
}finally{
if(con!=null)try{con.close();}catch(Exception e){}
}
}
private Context getInitialContext() throws Exception {
String url = "t3://localhost:7001";
String user = null;
String password = null;
Properties properties = null;
try {
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, url);
if (user != null) {
properties.put(Context.SECURITY_PRINCIPAL, user);
properties.put(Context.SECURITY_CREDENTIALS, password == null ? "" : password);
} return new InitialContext(properties);
}
catch(Exception e) {
log("Unable to connect to WebLogic server at " + url);
log("Please make sure that the server is running.");
throw e;
}
}
}
当然,我部知道你的具体的问题,和怎么配置的!!
但是你要注意两点:
(1)确定你的服务器合理的启动
(2数据原正确的配置和要使用正确的java命名空间
pro.put(InitialContext.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLIntialContextFactory");
pro.put(InitialContext.PROVIDER_URL,"t3://localhost:7001");
我加上了这句 结果还是那个错误,,
我的oracle server肯定启动了 基本的jdbc程序都可以用
weblogic起了没
但我刚刚试了试 不启动weblogic 好象错误信息也一样可我在jb里配置wb了啊,,并且在jb里用weblogic platform server 8.x admin console
能启动ie,,访问http://localhost:7001/console
我的jbuilder9 安装文件才150m大,,是不是这个原因??
Add External lib
我下的是这个版本
安装文件有217mb
蛇蝎男人) 谢谢你 能告我怎么Add External lib 么 谢谢
so up!
所以问题就是weblogic和jbuilder集成没配置好!缺CLASS