在tomcat中如何调用weblogic上的ejb?急啊!!! 两个服务器就比较复杂了首先你要把webligic.jar加到lib里面然后使用这个配置文件来初始化Context,然后再lookup webligic的jndi树里面对应的EJB 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我也把weblogic.jar加在lib里了,但是不成功的我调用的代码 Context ctx = new InitialContext(); Object h = ctx.lookup("apply.Login"); LoginHome home = (LoginHome) PortableRemoteObject.narrow(h, LoginHome.class); ejbLogin = home.create();按说没有指定参数创建context是会在找jndi.properties文件的,可还是不成功。 应用中引的ContextFactory类总是org.apach.naming.java.javaURLContextFactory,不会是weblogic.jndi.WLInitialContextFactory,为什么呢? Context ctx = null;Hashtable env = new Hashtable();env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory "); env.put(Context.PROVIDER_URL, "t3://192.168.0.2:7001"); ... ...try { ctx = new InitialContext(env);} catch (NamingException ne) { ne.printStackTrace()} finally { try { ctx.close(); } catch (Exception e) { e.printStackTrace() }} 谢谢,更改程序是可以的。问题我不想在更改程序,原来都是用Context ctx = new InitialContext();现在主要是两方面1.通过jndi.properties不行,不知是为什么?怎么样通过配置而不是修改程序解决。2.tomcat启动过程中在那里设置了java.naming.factory.initial,让它指定org.apach.naming.java.javaURLContextFactory,而不是weblogic.jndi.WLInitialContextFactory? 我也有同样的问题,不知是什么原因,不能通过配置使tomcat的action层得到weblogic中ejb的实例,只能通过Hashtable env = new Hashtable();env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");env.put(Context.PROVIDER_URL, "t3://192.168.0.2:7001 ");这种方式才行,望能得到解答! jquery子页面传值给父页面 这是神马开发模式?????????????????? 请在职的程序员或者项目经理们给提点参考意见 向Mysql数据库插入数据. iReport + jasper report如何迭代List<Object> ? xfire调用webservice返回的结果如何取到呀,现在调用 有问题吗? JAVA执行客户端命令 struts 中的java文件怎么编译?(在dos中用javac编译) 请教高手,如果数据表没有主键,用CMP如何作呀,为什么总出错呀!! 怎么解决 当前最完整的Hibernate中文手册 如何修改tomcat的默认主页
我调用的代码
Context ctx = new InitialContext();
Object h = ctx.lookup("apply.Login");
LoginHome home = (LoginHome) PortableRemoteObject.narrow(h,
LoginHome.class);
ejbLogin = home.create();
按说没有指定参数创建context是会在找jndi.properties文件的,可还是不成功。
问题我不想在更改程序,原来都是用Context ctx = new InitialContext();
现在主要是两方面
1.通过jndi.properties不行,不知是为什么?怎么样通过配置而不是修改程序解决。
2.tomcat启动过程中在那里设置了java.naming.factory.initial,让它指定org.apach.naming.java.javaURLContextFactory,而不是weblogic.jndi.WLInitialContextFactory?
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
env.put(Context.PROVIDER_URL, "t3://192.168.0.2:7001 ");
这种方式才行,望能得到解答!