EJB调用.htmlphp
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false remote.connections=default remote.connection.default.host=localhost remote.connection.default.port = 4447 remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false remote.connection.default.username =YOUR_JBOSS_COSOLE_USERNAME remote.connection.default.password =YOUR_JBOSS_COSOLE_PASSWORD
private static Context initialContext;
private static final String PKG_INTERFACES = "org.jboss.ejb.client.naming";
Properties properties = new Properties();
properties.put(Context.URL_PKG_PREFIXES, PKG_INTERFACES);
initialContext = new InitialContext(properties);
获得 EJB 的jndiNamecss
//appName 表示部署的 ear 文件的名称部分(不包括 '.ear')
String appName = "";
//moduleName 表示该EJB jar 文件的名称部分
String moduleName = "JPAProject";
/* Jboss 7 容许每一个部署有一个(可选)惟一的名字,若是咱们没有明确该名字distinctName 为 "" */
String distinctName = "";
//要调用的 EJB 的类名
String beanName = "ProjectBean";
//将 ProjectBean 的 remote 接口放在和 Client 中(包名和 EJB 端相同)
String interfaceName = ProjectBeanRemote.class.getName();
String jndiName = "ejb:" + appName + "/" + moduleName + "/" +
distinctName + "/" + beanName + "!" + interfaceName;
ProjectBeanRemote PB = (ProjectBeanRemote) context.lookup(jndiName);
generated by haroopadhtml