本文共 2111 字,大约阅读时间需要 7 分钟。
从博文: 中可以知道如何利用Intellij IDEA建立一个EJB Module,还有新建一个测试Module。
endpoint.name=client-endpointremote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=falseremote.connections=defaultremote.connection.default.host=localhostremote.connection.default.port = 4447remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=falseremote.connection.default.username=yangremote.connection.default.password=123456
3、修改index.jsp文件:
<%-- Created by IntelliJ IDEA. User: gao Date: 16-3-28 Time: 下午4:22 To change this template use File | Settings | File Templates.<%@ page contentType="text/html;charset=UTF-8" language="java" %>--%><%@ page language="java" contentType="text/html; charset=GB18030" pageEncoding="GB18030"%><%@page import="javax.naming.InitialContext"%><%@page import="com.ejb.HelloWorld"%><%@page import="javax.naming.NamingException"%><%@ page import="java.util.Hashtable" %><%@ page import="javax.naming.Context" %>测试页 Hello World!!!!!<% final String appName = ""; final String moduleName = "EJBTest_war_exploded"; final String distinctName = ""; final String beanName = "HelloWorldEJB"; final String viewClassName = HelloWorld.class.getName(); final String namespace = "ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName; System.out.println(namespace); try { final Hashtable jndiProperties = new Hashtable(); jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); final Context context = new InitialContext(jndiProperties); HelloWorld helloWorld = (HelloWorld) context.lookup(namespace); System.out.println(helloWorld); String s = helloWorld.sayHello("yangyuqin"); System.out.println(s); }catch (NamingException e) { e.printStackTrace(); }%>
4、使用JBoss运行EJBTest项目即可。
转载地址:http://wtmwo.baihongyu.com/