当前位置: 技术问答>java相关
这个问题太简单了,不过就当散分了 --------------- 200分(来者有分)
来源: 互联网 发布时间:2015-07-24
本文导语: 运行不通说我的 jndiName 有问题,我用的是 weblogic6.1 /** * 有状态会话Bean * Stateful.Session remote 接口 * Stateful.SessionHome Home 接口 * Stateful.SessionImp 实现类 * * 无状态会话Bean * Stateless.Sess...
运行不通说我的 jndiName 有问题,我用的是 weblogic6.1
/**
* 有状态会话Bean
* Stateful.Session remote 接口
* Stateful.SessionHome Home 接口
* Stateful.SessionImp 实现类
*
* 无状态会话Bean
* Stateless.Session remote 接口
* Stateless.SessionHome Home 接口
* Stateless.SessionImp 实现类
*
* /
==============================================
/* 这是一个有状态会话BEAN的一个方法
*
* 这个方法主要就是做为 无状态会话BEAN 的客户(访问无状态会话BEAN)
*/
Stateless.SessionHome home = (Stateless.SessionHome)
PortableRemoteObject.narrow(
new InitialContext().lookup("java:comp/env/ejb/CallStateless"), //
Stateful.SessionImp2
Stateless.SessionHome
Stateless.Session
Stateless.SessionImp
Stateless
Container
========== weblogic-ejb-jar.xml =========================================
SessionImp
CallClient
Stateful.SessionImp2
CallStateless
=========================================================================
/* 这是一个有状态会话BEAN的客户
*/
Properties pro = new Properties();
pro.put( Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory" );
pro.put( Context.PROVIDER_URL, "t3://localhost:7001" );
Stateful.SessionHome home = (Stateful.SessionHome)
PortableRemoteObject.narrow(
new InitialContext().lookup("CallClient"), //
/**
* 有状态会话Bean
* Stateful.Session remote 接口
* Stateful.SessionHome Home 接口
* Stateful.SessionImp 实现类
*
* 无状态会话Bean
* Stateless.Session remote 接口
* Stateless.SessionHome Home 接口
* Stateless.SessionImp 实现类
*
* /
==============================================
/* 这是一个有状态会话BEAN的一个方法
*
* 这个方法主要就是做为 无状态会话BEAN 的客户(访问无状态会话BEAN)
*/
Stateless.SessionHome home = (Stateless.SessionHome)
PortableRemoteObject.narrow(
new InitialContext().lookup("java:comp/env/ejb/CallStateless"), //
Stateful.SessionImp2
Stateless.SessionHome
Stateless.Session
Stateless.SessionImp
Stateless
Container
========== weblogic-ejb-jar.xml =========================================
SessionImp
CallClient
Stateful.SessionImp2
CallStateless
=========================================================================
/* 这是一个有状态会话BEAN的客户
*/
Properties pro = new Properties();
pro.put( Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory" );
pro.put( Context.PROVIDER_URL, "t3://localhost:7001" );
Stateful.SessionHome home = (Stateful.SessionHome)
PortableRemoteObject.narrow(
new InitialContext().lookup("CallClient"), //