JiveJdon Community Forums
在线142人   首页   主题总表   培训咨询   精华   查搜   注册    登陆
首页 » 论坛 » J2EE/JavaEE/JEE/EJB/JSF等技术讨论
???en_US.forumThreadPrev.name??? 上一主题
  Go back to the topic 返回本主题   Go back to the topic listing返回主题列表
???en_US.forumThreadNext.name??? 下一主题
Go 总共有 3 回复 / 1
 发表新帖子   回复该主题贴
belly

悄悄话
发表文章: 10
注册时间: 2005年07月05日 16:56
能在webligic中 JNDI 到 本地接口 吗 2005年10月30日 19:06 到本帖网址 加入本帖到收藏夹 发送到手机 回复该主题
标签列表

有些 不解.高手指点。

我在JB+Webligic+Mysql下做了一个 CMP,它有 远程和本地接口

但我在 JNDI 它的 远程Home接口时OK,
一到本地接口时就出错了。???
下面是 配置文件。
<weblogic-enterprise-bean>
<ejb-name>Flights</ejb-name>
<entity-descriptor>
<persistence>
<persistence-use>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
<type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
</persistence-use>
</persistence>
</entity-descriptor>

<jndi-name>FlightsRemote</jndi-name>
<local-jndi-name>Flights</local-jndi-name>

</weblogic-enterprise-bean>


这里是 我的测试类(自己写的)
ackage EJB;

import EJB.com.relation.onetomany.address.*;
import javax.naming.*;
import javax.rmi.PortableRemoteObject;
import java.lang.String;
import java.util.Properties;

public class FlightTestClient1 {
public static void main(String[] args) {
//我把远程Home接口及操作省略了,这样直接些
Flights local=null;
FlightsHome localHome=null;


try {

//get naming context
Context context = getInitialContext();
//look up jndi name 这里(在引用本地Home接口时)出了错,
localHome = (FlightsHome) context.lookup("Flights");



} catch (Exception e) {
e.printStackTrace();
}


}



public static Context getInitialContext() throws Exception {
String url = "t3://zkiller-34e6e35:7001";
String user = null;
String password = null;
Properties properties;
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 javax.naming.InitialContext(properties);
} catch (Exception e) {
System.out.println("Unable to connect to WebLogic server at " + url);
System.out.println("Please make sure that the server is running.");
throw e;
}
}

}
belly

悄悄话
发表文章: 10
注册时间: 2005年07月05日 16:56
Re: 能在webligic中 JNDI 到 本地接口 吗 2005年10月30日 19:16 到本帖网址 加入本帖到收藏夹 发送到手机 回复该主题


不好意思。 配置文件没 显示出来。

这里补上

<ejb-name>Flights</ejb-name>
<entity-descriptor>
<persistence>
<persistence-use>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
<type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
</persistence-use>
</persistence>
</entity-descriptor>

<jndi-name>FlightsRemote</jndi-name>
<local-jndi-name>Flights</local-jndi-name>
belly

悄悄话
发表文章: 10
注册时间: 2005年07月05日 16:56
Re: 能在webligic中 JNDI 到 本地接口 吗 2005年10月30日 19:20 到本帖网址 加入本帖到收藏夹 发送到手机 回复该主题


配置文件还显示不出,再来一次。不好意思



<weblogic-enterprise-bean>
<ejb-name>Flights</ejb-name>
<entity-descriptor>
<persistence>
<persistence-use>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
<type-version>6.0</type-version>
<type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
</persistence-use>
</persistence>
</entity-descriptor>

<jndi-name>FlightsRemote</jndi-name>
<local-jndi-name>Flights</local-jndi-name>
</weblogic-enterprise-bean>
belly

悄悄话
发表文章: 10
注册时间: 2005年07月05日 16:56
Re: 能在webligic中 JNDI 到 本地接口 吗 2005年10月31日 12:15 到本帖网址 加入本帖到收藏夹 发送到手机 回复该主题


弄懂了, 来跟大家分享。

原因在: 本地接口只能在同一个容器,好象应该是同一个JVM中才能访问。
我把EJB 放在Weblogic 中,在JB中运行client来JNDI 本地接口,当然不行了。。。。。
这个主题有 3 回复 / 1Go
???en_US.forumThreadPrev.name??? 上一主题
  Go back to the topic 返回本主题   Go back to the topic listing返回主题列表    返回页首返回页首
???en_US.forumThreadNext.name??? 下一主题
热点TAG: AOP cache 缓存 DDD EJB 集群 设计模式 Hibernate IOC JiveJdon OO RBAC Seam Spring Struts
正在读取,请等待...
google yahoo 新浪ViVi 365Key网摘 天极网摘 CSDN网摘 添加到百度搜藏 POCO网摘 博采网摘
查询本论坛内 回复超过的热门帖子
     回复该主题贴
标题
 
粗体 斜体 下划线 插入图片 插入代码 插入url链接 插入附件
内容
 

手机阅读 add to google add to yahoo
解惑之道在J道 ,打造中国最具影响力的的企业软件社区
OpenSource JIVEJDON v3.0 Powered by JdonFramework Code © 2002-08 jdon.com
anti spam