8
我将EJB部署在weblogic服务器上。我想从独立应用程序(瘦客户机)访问这些EJB。如何从独立客户端调用远程EJB
我将EJB部署在weblogic服务器上。我想从独立应用程序(瘦客户机)访问这些EJB。如何从独立客户端调用远程EJB
好的...我自己找到了。 :)
这是我用来从瘦客户端连接到远程EJB的代码。
Hashtable env = new Hashtable(5);
env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
//Assuming weblogic server is running on localhost at port 7001
env.put(Context.PROVIDER_URL, "t3://localhost:7001");
Context ic = new InitialContext(env);
//obtain a reference to the home or local home interface
FooHome fooHome = (FooHome)ic.lookup("MyBeans/FooHome");
//Get a reference to an object that implements the beans remote (component) interface
Foo foo = fooHome.create();
//call the service exposed by the bean
foo.shoutFoo()
它使我工作。
如果这对你有用,你应该接受你自己的答案。 – 2010-01-11 15:07:40
非常帮助我! – boutta 2010-10-22 12:23:04