如题!
ejb2.0 ejb3.0 远程的本地的,调用方法都给你写出来了,你还不知道,连怎么从web组件中调用都写给你了,你脑袋没有毛病吧?
[size=small][code="java"]package com.copote.fygl.sjwh;
import java.util.HashMap;
import java.util.Properties;
import javax.ejb.CreateException;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import com.copote.cpstmg.ejb.cpstmgEJBFactory;
import com.copote.tframe.biz.BizProcessor;
import com.copote.tframe.biz.Dataset;
import com.copote.tframe.common.Record;
import copote.fygl.CPST_FYGLLocal;
import copote.fygl.CPST_FYGLLocalHome;
import copote.fygl.CPST_FYGLRemote;
import copote.fygl.CPST_FYGLRemoteHome;
/**
@author Administrator 戴忠德 qq:413881261 csdn: jjk_02027 javaeye: 飞火流星
*
*/
public class fyzpgg_BZ_main extends BizProcessor {
// private CPST_FYGLLocal m_ejbFYGLRemote = null;
private CPST_FYGLRemote m_ejbFYGLRemote = null;
private void createEjbAsNeeded() throws Exception {
/* JBoss5.1.0
* Properties props = new Properties();
* props.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
* props.setProperty("java.naming.provider.url", "Socket/RMI://localhost:1099");
* InitialContext ctx = new InitialContext(props);
*
* WebLogic8.1.6
* Properties props = new Properties();
* props.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
* props.put(Context.PROVIDER_URL, "t3://10.3.7.44:7001");
* InitialContext ctx = new InitialContext(props);
*
* EJB2.X
* 调用远程接口
* CPST_FYGLRemoteHome home = (CPST_FYGLRemoteHome) ctx.lookup("CPST_FYGL");
public void doBizProcess() throws Exception {
m_ejbFYGLRemote.sjwh_Operate_fyzpgg(Index_added, (HashMap) hm_added
.clone(), Index_deleted, (HashMap) hm_deleted.clone(),
Index_modified, (HashMap) hm_modified.clone());
m_ejbFYGLRemote.remove();
} catch (Exception ex) {
throw new Exception(ex.getMessage());
}
}
}
[/code][/size]
ejb-jar.xml (ejb2.X)
[code="java"]<!-- ######仿印管理############## -->
仿印管理
CPST_FYGL
copote.fygl.CPST_FYGLRemoteHome
copote.fygl.CPST_FYGLRemote
copote.fygl.CPST_FYGLLocalHome
copote.fygl.CPST_FYGLLocal
copote.fygl.CPST_FYGLBean
Stateless
Container
[/code]
weblogic-ejb-jar.xml (ejb2.X)
[code="java"] <!-- author 戴忠德 ############# begin ##################### -->
<!-- ######仿印管理############## -->
CPST_FYGL
CPST_FYGL
CPST_FYGLLocal
[/code]
web.xml(ejb2.X+ejb3.X)
[code="java"] <!-- 如果引用的是EJB3.0,则需去掉 -->
仿印管理
ejb/CPST_FYGLLocal
Session
copote.fygl.CPST_FYGLLocalHome
copote.fygl.CPST_FYGLLocal
<!-- 如果一个EAR文件中存在多个EJB jar,而这些jar分别含有相同名称的EJB时,
应在EJB名称前加上jar文件名和#号,如:HelloWorld.jar#HelloWorldBean -->
CPST_FYGL
[/code]
那些你都不用管,你只管:
//EJB2.X调用本地接口
71.// CPST_FYGLLocalHome home = (CPST_FYGLLocalHome) ctx.lookup("CPST_FYGLLocal");
不就行了啊!
[code="java"]//EJB2.X调用本地接口
CPST_FYGLLocalHome home = (CPST_FYGLLocalHome) ctx.lookup("CPST_FYGLLocal");
m_ejbFYGLRemote = home.create();
m_ejbFYGLRemote.sjwh_Operate_fyzpgg(。。。); [/code]
这些还不够吗?