jb9+weblogic7的问题 没有加载weblogic的jndi驱动。你把你的weblogic.jar加到classpath中就ok了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 已经加了,而且还在jb中加了个包含weblogic的library,工程属性的required library中选中了。刚开始做ejb的例子,请多多指教 Hashtable ht=new Hashtable();ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory")应该是这样的吧。 直接写默认就是当前你的EJB服务器的JNDI上下文. Context context = new InitialContext();如果是访问别的WLS ,可以这样写: properties = new Properties(); properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); properties.put(Context.PROVIDER_URL, EJBSERVERURL); properties.put(Context.SECURITY_PRINCIPAL, EJBUSERNAME); properties.put(Context.SECURITY_CREDENTIALS, EJBPASSWORD); Context context = new InitialContext(properties); 谢谢各位,jndi没问题了,编译通过,不过deploy 时不论是实体还是会话bean 都有unable to connect server t3://sea:7001 as user weblogic(如题)的错误,我想是不是设置有问题,请各位帮忙看看,分不够再加。 用户名:weblogic 用户不对或是没有权限访问你的WLS.你写了那么多是画蛇添足.只写一句试试,Context context = new InitialContext();如果不行就写全了吧. String EJBSERVERURL = "t3://sea:7001"; String EJBUSERNAME = "weblogic登陆名";//如果有NULL表示WLS默认USER用户。 String EJBPASSWORD = "weblogic密码";//如果有NULL表示WLS默认USER用户的密码。 Properties properties = null; properties = new Properties(); properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"); properties.put(Context.PROVIDER_URL, EJBSERVERURL); properties.put(Context.SECURITY_PRINCIPAL, EJBUSERNAME); properties.put(Context.SECURITY_CREDENTIALS, EJBPASSWORD); Context context = new InitialContext(properties); 登陆名不正确,用weblogic的登陆名和密码 t3://sea:7001里的sea最好打上所要发布机器的IP地址。应该可以了。 看看你的Server配置里面是否加了weblogic.jar。 jsp怎么获取到数据库的数据 关于java事务的问题! 截取String问题 Struts2中文件上传乱码 J2EE的程序员帮帮忙 关于Spring的hessian的使用问题,求助 关于Map类的问题 由.net转向java,该从何处入手? Struts in Action 中调试出现的错误: Cannot find ActionMappings or ActionFormBeans 初学java应从哪里学起?各位大虾请指教 用jboss来deployEjb出错!!高手快来! 《J2EE 构建企业系统-专家级解决方案》5折抛售
ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory")应该是这样的吧。
Context context = new InitialContext();如果是访问别的WLS ,可以这样写:
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, EJBSERVERURL);
properties.put(Context.SECURITY_PRINCIPAL, EJBUSERNAME);
properties.put(Context.SECURITY_CREDENTIALS, EJBPASSWORD); Context context = new InitialContext(properties);
只写一句试试,
Context context = new InitialContext();如果不行就写全了吧.
String EJBSERVERURL = "t3://sea:7001";
String EJBUSERNAME = "weblogic登陆名";//如果有NULL表示WLS默认USER用户。 String EJBPASSWORD = "weblogic密码";//如果有NULL表示WLS默认USER用户的密码。 Properties properties = null;
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, EJBSERVERURL);
properties.put(Context.SECURITY_PRINCIPAL, EJBUSERNAME);
properties.put(Context.SECURITY_CREDENTIALS, EJBPASSWORD); Context context = new InitialContext(properties);
应该可以了。