Embedded EJB3是否能用java代码作为客户端调用?
大家好:
在jboss中我们可以在eclipse中直接通过以下代码来调用运行中的EJB3 Service.
Properties props = new Properties();
props.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
props.setProperty("java.naming.provider.url", "localhost:1099");
props.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
InitialContext ctx = new InitialContext(props);
Object obj = ctx.lookup("HelloWorldBean/remote");
但是在Embedded EJB3版本中它的客户端的properties与jboss中的不同变为:
props.put("java.naming.factory.initial", "org.jnp.interfaces.LocalOnlyContextFactory");
props.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
我在tomcat中运行我的Embedded Ejb3。使用jsp客户端可以调用EJB3。
但是在eclipse中直接以上写入客户代码却throw Exception是否意味着Embedded EJB3只能在服务器能调用?不支持直接的java代码调用?
Thanks for any reply