虽然不知道EJB有啥用,刚接触,很多例子不成功,写我成功的过程。
JDK:8u112
eclipse:2018-09(4.9.0)
JBoss:jboss-eap-7.1.0
一、工具下载
1、JDK(Java Development Kit)https://www.oracle.com/technetwork/java/javase/downloads/index.html
(jdk-8u112-windows-i586(JBoss AS 7.1.1.Final与JDK8不兼容,jboss-eap-7.1.0可以) \ jdk-7u80-windows-i586.exe)
其他版本:页面底端
2、Eclipse下载https://www.eclipse.org/downloads/packages/
(eclipse-jee-2018-09-win32------Eclipse IDE for Java EE Developers)
(Eclipse IDE for Java EE Developers 该版本集成了Java ee开发常用插件,不同版本装不同插件能达到一样的效果)
(其他历史版本https://www.eclipse.org/downloads/packages/release)
3-1、JBOSS-EAP(Red Hat JBoss Enterprise Application Platform)https://developers.redhat.com/products/eap/download/
(jboss-eap-7.1.0)
3-2、JBOSS AS(JBoss Application Server)http://jbossas.jboss.org/downloads/
(JBoss AS 7.1.1.Final)
二、JBoss运行测试
1、运行\jboss-as-7.1.1.Final\bin\standalone.bat
卡在"Brontes" starting,网上说的是JBoss as 7.1 与JDK8不兼容,使用JDK8之前版本。
2、运行\ jboss-eap-7.1.0\bin\standalone.bat
Calling "D:\jboss-eap-7.1.0\bin\standalone.conf.bat"
Setting JAVA property to "D:\ProgramFiles\Java\jdk1.8.0_112\bin\java"
===============================================================================
JBoss Bootstrap Environment
JBOSS_HOME: "D:\jboss-eap-7.1.0"
JAVA: "D:\ProgramFiles\Java\jdk1.8.0_112\bin\java"
JAVA_OPTS: "-client -Dprogram.name=standalone.bat -Xms1G -Xmx1G -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -Xloggc:"D:\jboss-eap-7.1.0\standalone\log\gc.log" -XX:GCLogFileSize=3M -XX:-TraceClassUnloading"
===============================================================================
11:13:28,571 INFO [org.jboss.modules] (main) JBoss Modules version 1.6.0.Final-redhat-1
11:13:30,232 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.7.SP1-redhat-1
11:13:30,464 INFO [org.jboss.as] (MSC service thread 1-7) WFLYSRV0049: JBoss EAP 7.1.0.GA (WildFly Core 3.0.10.Final-redhat-1) 在启动
11:13:32,545 INFO [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: 地址 'security-realm' 上的资源里的属性 '/core-service=management/management-interface=http-interface' 已被舍弃,以后的版本里可能会删除它。详情请参考 read-resource-description 操作的输出里的属性描述。
11:13:32,610 INFO [org.wildfly.security] (ServerService Thread Pool -- 6) ELY00001: WildFly Elytron version 1.1.7.Final-redhat-1
11:13:32,627 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 29) WFLYCTL0028: 地址 'security-realm' 上的资源里的属性 '/subsystem=undertow/server=default-server/https-listener=https' 已被舍弃,以后的版本里可能会删除它。详情请参考 read-resource-description 操作的输出里的属性描述。
11:13:32,697 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039:使用 socket-binding (management-http) 创建 HTTP 管理服务
11:13:32,723 INFO [org.xnio] (MSC service thread 1-4) XNIO version 3.5.4.Final-redhat-1
11:13:32,730 INFO [org.xnio.nio] (MSC service thread 1-4) XNIO NIO Implementation Version 3.5.4.Final-redhat-1
11:13:32,829 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 42) WFLYCLINF0001: 激活 Infinispan 子系统。
11:13:32,840 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 50) WFLYNAM0001: 激活 Naming 子系统
11:13:32,852 INFO [org.jboss.as.security] (ServerService Thread Pool -- 57) WFLYSEC0002: 激活安全子系统
11:13:32,860 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 60)WFLYWS0002: 激活 WebServices Extension
11:13:32,853 INFO [org.jboss.as.jaxrs] (ServerService Thread Pool -- 43) WFLYRS0016: RESTEasy 版本 3.0.24.Final-redhat-1
11:13:32,846 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 58) WFLYTX0013: node-identifier 上的 /subsystem=transactions 属性被设置为默认值。这对于运行多个服务器的环境是一种危险。请确保属性值是唯一的。
11:13:32,861 INFO [org.jboss.as.security] (MSC service thread 1-3) WFLYSEC0001: 当前的 PicketBox 版本=5.0.2.Final-redhat-1
11:13:32,834 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 48) WFLYJSF0007: 激活下面的 JSF 实现:[main]
11:13:32,939 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0003: 正在启动 Undertow 1.4.18.Final-redhat-2
11:13:32,975 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 36) WFLYJCA0004: 部署兼容 JDBC 的驱动 class org.h2.Driver (版本 1.4)
11:13:32,975 INFO [org.jboss.as.connector] (MSC service thread 1-5) WFLYJCA0009: 启动 JCA 子系统(WildFly/IronJacamar 1.4.6.Final-redhat-1)
11:13:33,036 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-5) WFLYJCA0018: 已用 driver-name = h2 启动 Driver 服务
11:13:33,204 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 59) WFLYUT0014: 用选项 [directory-listing: 'D:\jboss-eap-7.1.0/welcome-content', follow-symlink: 'false', case-sensitive: 'false', safe-symlink-paths: 'true'] 为路径 '[]' 创建文件处理程序
11:13:33,729 INFO [org.jboss.as.naming] (MSC service thread 1-7) WFLYNAM0003:启动 Naming 服务
11:13:33,731 INFO [org.jboss.as.mail.extension] (MSC service thread 1-7) WFLYMAIL0001: 绑定 mail 会话 [java:jboss/mail/Default]
11:13:34,093 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 41)WFLYIO001: 工作线程 'default' 已根据您的 8 个可用处理器自动配置为带有 64 任务线程的 4 个内核线程
11:13:34,172 INFO [org.jboss.as.ejb3] (MSC service thread 1-2) WFLYEJB0482: Strict pool mdb-strict-max-pool 在使用源自这个主机的 CPU 数量的最大实例数 16(每个类)。
11:13:34,172 INFO [org.jboss.as.ejb3] (MSC service thread 1-1) WFLYEJB0481: Strict pool slsb-strict-max-pool 在使用源自线程工作节点池大小的最大实例数 64(每个类)。
11:13:34,221 INFO [org.jboss.remoting] (MSC service thread 1-4) JBoss Remotingversion 5.0.5.Final-redhat-1
11:13:34,240 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0012: 已启动服务器 default-server。
11:13:34,251 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0018: 正在启动主机 default-host
11:13:34,334 INFO [org.jboss.as.patching] (MSC service thread 1-7) WFLYPAT0050: JBoss EAP 累计补丁 ID 是:base,一次性补丁包括:none
11:13:34,489 WARN [org.jboss.as.domain.management.security] (MSC service thread 1-1) WFLYDM0111: 未找到密钥库 D:\jboss-eap-7.1.0\standalone\configuration\application.keystore,它将在第一次使用主机 localhost 的自签名证书时自动生成。
11:13:34,564 INFO [org.jboss.as.ejb3] (MSC service thread 1-8) WFLYEJB0493: EJB 子系统暂停完成
11:13:34,551 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) WFLYUT0006: Undertow HTTP listener default 正在侦听 127.0.0.1:8080
11:13:34,595 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread1-4) WFLYDS0013: 为目录 FileSystemDeploymentService 启动的 D:\jboss-eap-7.1.0\standalone\deployments
11:13:35,218 INFO [org.jboss.as.connector.subsystems.datasources] (MSC servicethread 1-2) WFLYJCA0001: 绑定数据源 [java:jboss/datasources/ExampleDS]
11:13:35,792 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0006: Undertow HTTPS listener https 正在侦听 127.0.0.1:8443
11:13:35,971 INFO [org.jboss.ws.common.management] (MSC service thread 1-1) JBWS022052: Starting JBossWS 5.1.9.Final-redhat-1 (Apache CXF 3.1.12.redhat-1)
11:13:36,078 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212:恢复服务器
11:13:36,082 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: 侦听 http://127.0.0.1:9990/management 的 HTTP 管理接口
11:13:36,084 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: 管理控制台侦听于 http://127.0.0.1:9990
11:13:36,087 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: JBoss EAP 7.1.0.GA (WildFly Core 3.0.10.Final-redhat-1) started in 8650ms - Started 292of 553 services (347 services are lazy, passive or on-demand)
浏览输入http://localhost:8080/
运行成功。
三、eclipse集成JBoss插件及配置创建JBoss服务器
https://blog.csdn.net/qq_25189723/article/details/85107696
四、创建EJB项目
File -> EJB Project 或
或File -> Other –> EJB -> EJB Project
输入项目名 –> Next(或直接Finish)
Next
勾选 Generate ejb-jar.xm deployment descriptor -> Finish
右击ejbModule创建一个Session Bean (EJB 3.0)
输入包名com.ejbhello.server
类名 EJBHelloWorld
接口EJBHelloWorldRemote
package com.ejbhello.server;
import javax.ejb.Remote;
@Remote
public interface EJBHelloWorldRemote {
public String sayHello(String name);
}
实现类EJBHelloWorld
package com.ejbhello.server;
import javax.ejb.Stateless;
/**
* Session Bean implementation class EJBHelloWorld
*/
@Stateless
public class EJBHelloWorld implements EJBHelloWorldRemote {
/**
* Default constructor.
*/
public EJBHelloWorld() {
// TODO Auto-generated constructor stub
}
@Override
public String sayHello(String name) {
return name+"你好";
}
}
服务器上右键 -> Add and Remove 加入项目(可以移除多余项目,甚至是删除\jboss-eap-7.1.0\standalone\deployments下部署的项目)然后运行。
或不考虑其他项目,直接在项目 右键 -> Run on Server 选择或创建服务器 运行。
16:55:55,602 INFO [org.jboss.modules] (main) JBoss Modules version 1.6.0.Final-redhat-1
16:55:55,929 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.7.SP1-redhat-1
16:55:56,071 INFO [org.jboss.as] (MSC service thread 1-7) WFLYSRV0049: JBoss EAP 7.1.0.GA (WildFly Core 3.0.10.Final-redhat-1) 在启动
16:55:57,564 INFO [org.jboss.as.controller.management-deprecated] (Controller Boot Thread) WFLYCTL0028: 地址 'security-realm' 上的资源里的属性 '/core-service=management/management-interface=http-interface' 已被舍弃,以后的版本里可能会删除它。详情请参考 read-resource-description 操作的输出里的属性描述。
16:55:57,582 INFO [org.wildfly.security] (ServerService Thread Pool -- 8) ELY00001: WildFly Elytron version 1.1.7.Final-redhat-1
16:55:57,610 INFO [org.jboss.as.controller.management-deprecated] (ServerService Thread Pool -- 17) WFLYCTL0028: 地址 'security-realm' 上的资源里的属性 '/subsystem=undertow/server=default-server/https-listener=https' 已被舍弃,以后的版本里可能会删除它。详情请参考 read-resource-description 操作的输出里的属性描述。
16:55:57,614 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) WFLYDS0004: 在部署目录中找到 EJBHello.jar。让部署生成名为 EJBHello.jar.dodeploy 的文件。
16:55:57,671 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0039: 使用 socket-binding (management-http) 创建 HTTP 管理服务
16:55:57,689 INFO [org.xnio] (MSC service thread 1-4) XNIO version 3.5.4.Final-redhat-1
16:55:57,698 INFO [org.xnio.nio] (MSC service thread 1-4) XNIO NIO Implementation Version 3.5.4.Final-redhat-1
16:55:57,761 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 42) WFLYCLINF0001: 激活 Infinispan 子系统。
16:55:57,773 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 50) WFLYNAM0001: 激活 Naming 子系统
16:55:57,775 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 58) WFLYTX0013: node-identifier 上的 /subsystem=transactions 属性被设置为默认值。这对于运行多个服务器的环境是一种危险。请确保属性值是唯一的。
16:55:57,780 INFO [org.jboss.as.jaxrs] (ServerService Thread Pool -- 43) WFLYRS0016: RESTEasy 版本 3.0.24.Final-redhat-1
16:55:57,805 INFO [org.jboss.as.security] (ServerService Thread Pool -- 57) WFLYSEC0002: 激活安全子系统
16:55:57,853 INFO [org.jboss.as.security] (MSC service thread 1-1) WFLYSEC0001: 当前的 PicketBox 版本=5.0.2.Final-redhat-1
16:55:57,867 INFO [org.jboss.as.naming] (MSC service thread 1-2) WFLYNAM0003: 启动 Naming 服务
16:55:57,868 INFO [org.jboss.as.mail.extension] (MSC service thread 1-2) WFLYMAIL0001: 绑定 mail 会话 [java:jboss/mail/Default]
16:55:57,901 INFO [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0003: 正在启动 Undertow 1.4.18.Final-redhat-2
16:55:57,945 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 36) WFLYJCA0004: 部署兼容 JDBC 的驱动 class org.h2.Driver (版本 1.4)
16:55:57,952 INFO [org.jboss.as.connector] (MSC service thread 1-8) WFLYJCA0009: 启动 JCA 子系统(WildFly/IronJacamar 1.4.6.Final-redhat-1)
16:55:57,967 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-8) WFLYJCA0018: 已用 driver-name = h2 启动 Driver 服务
16:55:58,000 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 60) WFLYWS0002: 激活 WebServices Extension
16:55:58,007 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 48) WFLYJSF0007: 激活下面的 JSF 实现:[main]
16:55:58,161 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 59) WFLYUT0014: 用选项 [directory-listing: 'D:\jboss-eap-7.1.0/welcome-content', follow-symlink: 'false', case-sensitive: 'false', safe-symlink-paths: 'true'] 为路径 '[]' 创建文件处理程序
16:55:58,418 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 41) WFLYIO001: 工作线程 'default' 已根据您的 8 个可用处理器自动配置为带有 64 任务线程的 4 个内核线程
16:55:58,456 INFO [org.jboss.as.ejb3] (MSC service thread 1-4) WFLYEJB0481: Strict pool slsb-strict-max-pool 在使用源自线程工作节点池大小的最大实例数 64(每个类)。
16:55:58,457 INFO [org.jboss.as.ejb3] (MSC service thread 1-4) WFLYEJB0482: Strict pool mdb-strict-max-pool 在使用源自这个主机的 CPU 数量的最大实例数 16(每个类)。
16:55:58,461 INFO [org.jboss.remoting] (MSC service thread 1-5) JBoss Remoting version 5.0.5.Final-redhat-1
16:55:58,515 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0012: 已启动服务器 default-server。
16:55:58,518 INFO [org.wildfly.extension.undertow] (MSC service thread 1-1) WFLYUT0018: 正在启动主机 default-host
16:55:58,543 INFO [org.jboss.as.patching] (MSC service thread 1-5) WFLYPAT0050: JBoss EAP 累计补丁 ID 是:base,一次性补丁包括:none
16:55:58,558 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: 开始 "EJBHello.jar" 的部署(runtime-name: "EJBHello.jar")
16:55:58,560 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0006: Undertow HTTP listener default 正在侦听 127.0.0.1:8080
16:55:58,562 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-7) WFLYDS0013: 为目录 FileSystemDeploymentService 启动的 D:\jboss-eap-7.1.0\standalone\deployments
16:55:58,562 WARN [org.jboss.as.domain.management.security] (MSC service thread 1-6) WFLYDM0111: 未找到密钥库 D:\jboss-eap-7.1.0\standalone\configuration\application.keystore,它将在第一次使用主机 localhost 的自签名证书时自动生成。
16:55:58,617 INFO [org.jboss.as.ejb3] (MSC service thread 1-7) WFLYEJB0493: EJB 子系统暂停完成
16:55:58,708 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-7) WFLYJCA0001: 绑定数据源 [java:jboss/datasources/ExampleDS]
16:55:58,855 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) WFLYUT0006: Undertow HTTPS listener https 正在侦听 127.0.0.1:8443
16:55:58,925 INFO [org.jboss.ws.common.management] (MSC service thread 1-5) JBWS022052: Starting JBossWS 5.1.9.Final-redhat-1 (Apache CXF 3.1.12.redhat-1)
16:55:59,080 INFO [org.jboss.weld.deployer] (MSC service thread 1-5) WFLYWELD0003: 处理 Weld 部署 EJBHello.jar
16:55:59,122 INFO [org.hibernate.validator.internal.util.Version] (MSC service thread 1-5) HV000001: Hibernate Validator 5.3.5.Final-redhat-2
16:55:59,193 INFO [org.jboss.as.ejb3.deployment] (MSC service thread 1-5) WFLYEJB0473: 部署单元 'EJBHelloWorld' 里的 Session Bean 'deployment "EJBHello.jar"' 的 JNDI 绑定如下:
java:global/EJBHello/EJBHelloWorld!com.ejbhello.server.EJBHelloWorldRemote
java:app/EJBHello/EJBHelloWorld!com.ejbhello.server.EJBHelloWorldRemote
java:module/EJBHelloWorld!com.ejbhello.server.EJBHelloWorldRemote
java:jboss/exported/EJBHello/EJBHelloWorld!com.ejbhello.server.EJBHelloWorldRemote
java:global/EJBHello/EJBHelloWorld
java:app/EJBHello/EJBHelloWorld
java:module/EJBHelloWorld
16:55:59,348 INFO [org.jboss.weld.Version] (MSC service thread 1-7) WELD-000900: 2.4.3 (redhat)
16:55:59,422 INFO [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-4) ISPN000128: Infinispan version: Infinispan 'Chakra' 8.2.8.Final-redhat-1
16:55:59,734 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 62) WFLYCLINF0002: 启动 client-mappings 容器的 ejb 缓存
16:56:00,124 INFO [org.jboss.as.server] (ServerService Thread Pool -- 37) WFLYSRV0010: 已部署的 "EJBHello.jar"(runtime-name: "EJBHello.jar")
16:56:00,165 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: 恢复服务器
16:56:00,166 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: 侦听 http://127.0.0.1:9990/management 的 HTTP 管理接口
16:56:00,166 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: 管理控制台侦听于 http://127.0.0.1:9990
16:56:00,167 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: JBoss EAP 7.1.0.GA (WildFly Core 3.0.10.Final-redhat-1) started in 4919ms - Started 408 of 632 services (350 services are lazy, passive or on-demand)
五、新建客户端测试Java Project
新建客户端测试Java Project
接口类EJBHelloWordRemote右键 -> Export 导出Jar 包。
Java -> Jar
Browse 选择路径-> Finish。
新建Java Project
输入项目名 EJBClient -> Finish
将导出的ejbhello.jar 和 \jboss-eap-7.1.0\bin\client\jboss-client.jar 加入 Build Path
新建测试类
输入包名com.ejbhello.client
类名EJBHelloWordClient
ejb:/EJB项目名//实现类名!包名.接口类名
服务器运行有 java:global/EJBHello/EJBHelloWorld!com.ejbhello.server.EJBHelloWorldRemote
package com.ejbhello.client;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import com.ejbhello.server.EJBHelloWorldRemote;
public class EJBHelloWorldClient {
public static void main(String[] args) throws NamingException {
Properties props = new Properties();
props.setProperty(Context.URL_PKG_PREFIXES,"org.jboss.ejb.client.naming");
InitialContext ctx = new InitialContext(props);
EJBHelloWorldRemote ejb = (EJBHelloWorldRemote)
ctx.lookup("ejb:/EJBHello//EJBHelloWorld!com.ejbhello.server.EJBHelloWorldRemote");
String s = ejb.sayHello("znj");
System.out.println(s);
}
}
配置文件jboss-ejb-client.properties
endpoint.name=client-endpoint
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=default
remote.connection.default.host=127.0.0.1
remote.connection.default.port = 8080
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connection.default.username=admin
remote.connection.default.password=admin
运行
六、可能出现的问题
jboss-client.jar、jboss-ejb-client.properties及lookup参数
可能没有jboss-client.jar
Exception in thread "main" javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.ejbhello.client.EJBHelloClient.main(EJBHelloClient.java:17)
可能 没有配置文件 或 项目名 写错(不是包名,大小写)。
INFO: EJBCLIENT000069: Using legacy jboss-ejb-client.properties security configuration
Exception in thread "main" javax.ejb.NoSuchEJBException: EJBCLIENT000079: Unable to discover destination for request for EJB StatelessEJBLocator for "/ejbhello/EJBHelloWorld", view is interface com.ejbhello.server.EJBHelloWorldRemote, affinity is None
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:567)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:503)
at org.jboss.ejb.protocol.remote.RemotingEJBClientInterceptor.handleInvocationResult(RemotingEJBClientInterceptor.java:56)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:569)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:503)
at org.jboss.ejb.client.TransactionPostDiscoveryInterceptor.handleInvocationResult(TransactionPostDiscoveryInterceptor.java:133)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:569)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:503)
at org.jboss.ejb.client.DiscoveryEJBClientInterceptor.handleInvocationResult(DiscoveryEJBClientInterceptor.java:108)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:569)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:503)
at org.jboss.ejb.client.NamingEJBClientInterceptor.handleInvocationResult(NamingEJBClientInterceptor.java:78)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:569)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:503)
at org.jboss.ejb.client.TransactionInterceptor.handleInvocationResult(TransactionInterceptor.java:172)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:569)
at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:503)
at org.jboss.ejb.client.EJBClientInvocationContext.awaitResponse(EJBClientInvocationContext.java:913)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:177)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:112)
at com.sun.proxy.$Proxy0.sayHello(Unknown Source)
at com.ejbhello.client.EJBHelloClient.main(EJBHelloClient.java:19)
Exception in thread "main" java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:, moduleName:ejbhello, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@14da5c3
at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:798)
at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:128)
at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:186)
at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPossibleRetries(EJBInvocationHandler.java:255)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:200)
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:183)
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:146)
at com.sun.proxy.$Proxy0.sayHello(Unknown Source)
at com.ejbhello.client.EJBHelloClient.main(EJBHelloClient.java:19)