有没有更详细一点的代码片段,比如客户调用的代码,Home和Remote接口的声明什么的。
解决方案 »
- public class BaseDaoimpl<T, PK extends Serializable> implements BaseDao<T, PK>
- MyEclipse怎么实现自动部署?
- jsp代码多,编译通不过
- 如何在项目中加入角色,不同的角色有不同的权限
- tomcat和apache集成问题
- Hibernate 多对一 怎样插入外键
- 个位帮个忙!急。jcr创建节点的时候如何给节点属性?
- ireport 输出验证问题
- 请问<html:link page=""> 的用法。
- 使用tomcat服务器怎样做事务处理?
- 请教高手如何搭建J2EE开发环境。
- 急!请问谁有java和xml结合使用的例子或资料、信息,在下感激不尽!!
//get naming context
Context ctx = new InitialContext(); //look up jndi name
Object ref = ctx.lookup("Test"); //cast to Home interface
testHome = (TestHome) PortableRemoteObject.narrow(ref, TestHome.class);
testHome.create("123"); //这一步出错!
什么iiop, smart agent我都启动了,还有其他原因吗?
我的EJB是1。0
我的代码是这样
//get naming context
Context ctx = new InitialContext();
//look up jndi name
testHome home = ctx.lookup("testHome");//我的错误在这,根本找不到,如果注释掉这句以及后面关于EJB的部分,SERVLET可以运行! //cast to Home interface
//testHome = (TestHome) PortableRemoteObject.narrow(ref, TestHome.class);
testHome.create("123");
//Object ref = contxt.lookup("testHome");
//testHome home = (testHome)PortableRemoteObject.narrow(ref,testHome.class);'
testHome home = (testHome)contxt.lookup("test");
// test testOk = home.create();
java.io.PrintWriter out = response.getWriter();
out.println("<HTML><HEAD></HEAD><body>");
out.println("heheheh") ;
// testOk.put("im","yeeee",999,1800,"ye");
out.println("</body></HTML>");
Context contxt = getInitialContext();
//Object ref = contxt.lookup("testHome");
//testHome home = (testHome)PortableRemoteObject.narrow(ref,testHome.class);'
//******* testHome home = (testHome)contxt.lookup("testHome");
// test testOk = home.create();
java.io.PrintWriter out = response.getWriter();
out.println("<HTML><HEAD></HEAD><body>");
out.println("heheheh") ;
// testOk.put("im","yeeee",999,1800,"ye");
out.println("</body></HTML>");
还有ejbCreate,ejbPostCreate 等是不是符合j2ee规范
另外,检查一下你的CMP实体bean类文件的代码编写是否符合EJB1.1规范,比如,是否有ejbPostCreate(),ejbCreate()和create()是否匹配?
当然,我觉得有必要确定错误究竟是不是处在你说的地方。