• ejb2


    编辑器加载中...package com.dxz.ejb2; import java.util.Properties; import javax.naming.InitialContext; import javax.rmi.PortableRemoteObject; public class Test { public static String test_jboss() { System.out .println("==========================================================="); 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"); try { InitialContext ctx = new InitialContext(props); Object objRef = ctx.lookup("ejb/helloEJB"); HelloWorldHome home = (HelloWorldHome) PortableRemoteObject.narrow( objRef, HelloWorldHome.class); HelloWorldRemote remote = home.create(); System.out.println(remote.sayHello()); return "OK"; } catch (Exception ex) { ex.printStackTrace(); return "Fail"; } } public static String test_wasce() { System.out .println("==========================================================="); try { InitialContext ctx = new InitialContext(); Object objRef = ctx.lookup("java:comp/env/ejb/helloEJB"); HelloWorldHome home = (HelloWorldHome) PortableRemoteObject.narrow( objRef, HelloWorldHome.class); HelloWorldRemote remote = home.create(); System.out.println(remote.sayHello()); return "OK"; } catch (Exception ex) { ex.printStackTrace(); return "Fail"; } } }
  • 相关阅读:
    第一周任务Largest Submatrix of All 1’s
    第一周 Largest Rectangle in a Histogram
    第二次作业
    B. Light bulbs(2019 ICPC上海站)
    二维平面最近点-分治
    python生成器,推导式
    python函数名的运用,闭包,迭代器
    python函数(二)
    python函数(一)
    python基础(七)
  • 原文地址:https://www.cnblogs.com/duanxz/p/2752642.html
Copyright © 2020-2023  润新知