如果配置名和类名一致是可以的。public EJBHome getEJBHome(String jndiName, String className)EJBHome ejbHome = null;
javax.naming.InitialContext ictx = new javax.naming.InitialContext();
Object jndiRef = ictx.lookup(jndiName);
ejbHome = (EJBHome) PortableRemoteObject.narrow(jndiRef,
Class.forName(className));
javax.naming.InitialContext ictx = new javax.naming.InitialContext();
Object jndiRef = ictx.lookup(jndiName);
ejbHome = (EJBHome) PortableRemoteObject.narrow(jndiRef,
Class.forName(className));
解决方案 »
- java.lang.NullPointerException问题
- 解析XML
- struts+hibnate的一个项目,tomat启动时后台报错了
- org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated withthe session
- 在Struts中如何实现图片的上传?????
- struts+hibernate+mysql3.1的乱码问题,困饶多天,请高手指点!!!
- JMX和MBeans是什么东西?
- 在Selevt里通过JDBC提取数据的问题,怪~!
- 如何使一个字符串的值循环累加
- 这个是什么错误?Weblogic啊,我服了你了。
- 高分请教 new socket(ip,port)发生的错误
- 关于business delegate和facade的区别?
直接这个接口是不可以create的吧
EJBHome xxx = (EJBHome) PortableRemoteObject.narrow(obj, homeInterfaceClass);
xxx.create();
这样是可以的,这就是接口编程
兄弟这样
好象不行呢,不可以的吧
method create not found in interface javax.ejb.EJBHome
那我怎么自动造型成那个ejbHome并进行业务方法的调用
比如说我知道
interface interfaceA{}
class CLASSB implements interfaceA
{
add();
}
我只知道
String aa="CLASSB";
我想调用
add()方法
p
p
p
pppp
p
ppp
p
p
p
p
p
pp