http://docs.jboss.org/ejb3/app-server/tutorial/jndibinding/jndi.html
JNDI Bindings
By default, session beans will bind to JNDI in the form ejbName/remote for remote interfaces and ejbName/local in the case of local interfaces. When the EJBs are deployed in an .ear file, the default jndi binding will be prepended by the name of the .ear file. So if the ear file name is foo.ear the default jndi names would be foo/EJB-NAME/remote and foo/EJB-NAME/local. You can override this behavior by defining your own @org.jboss.ejb3.LocalBinding or @org.jboss.ejb3.remoting.RemoteBinding.
Local Interface JNDI Binding.
To change the JNDI name for your local interface use the org.jboss.ejb3.LocalBinding annotation.
@Stateless
@LocalBinding(jndiBinding="custom/MySession")
public class MySessionBean implements MySession
{
}
Remote Interface JNDI Binding
To change the JNDI name for your remote interface use the org.jboss.ejb3.RemoteBindings annotation.
@Stateless
@RemoteBinding(jndiName="custom/remote/MySession")
public class MySessionBean implements MySession
{
}
Persistence unit JNDI Bindings
Persistence units are not bound into JNDI by default. You can bind them by defining some jboss specific properties in persistence.xml.
<persistence></persistence>
<persistence-unit name="manager1"></persistence-unit>
<jta-data-source></jta-data-source>java:/DefaultDS
<jar-file></jar-file>MyApp.jar
<class></class>org.acme.Employee
<class></class>org.acme.Person
<class></class>org.acme.Address
<properties></properties>
<property name="jboss.entity.manager.jndi.name" value="java:/Manager1"></property>
<property name="jboss.entity.manager.factory.jndi.name" value="java:/Manager1Factory"></property>
Client
Open up Client.java. You'll see that it looks up the stateless bean under "Calculator". Also notice that there is no Home interface and you can begin executing on the stateless bean right away.
Building and Running
To build and run the example, make sure you have ejb3.deployer installed in JBoss 4.0.x and have JBoss running. See the reference manual on how to install EJB 3.0.
Unix: $ export JBOSS_HOME=<where your="" jboss="" is="" distribution=""></where>
Windows: $ set JBOSS_HOME=<where your="" jboss="" is="" distribution=""></where>
$ ant
$ ant run
run:
[java] 1 + 1 = 2
[java] 1 - 1 = 0
Jar structure
EJB 3.0 beans must be packaged in a JAR file with the suffix .jar. Running the ant script above creates a JAR file within the deploy/ directory of JBoss. All that needs to be in that jar is your server-side class files. So basically just the CalculatorBean and the interfaces it implements. JBoss will automatically browse the JAR file to determine if any EJBs are annotated by any classes within it. THere is no precompilation step.
分享到:
相关推荐
jboss配置MySql的JNDI
jboss 配置jndi数据源,deploy下配置oracle-ds.xml
1.16 如何在Eclipse中调试JBoss应用 1.17 JBoss 5.0 安装与配置详解 1.18 JBOSS安装配置 1.19 Oracle,MySql,SQL server分页 1.20 Jboss下的第一个EJB程序 1.21 JNDI 1.22 JNDI配置原理详解 1.23 JSF+Seam...
NULL 博文链接:https://lumingming1987.iteye.com/blog/1663974
在JBOSS 环境中配置JMS,在程序中可以通过JNDI 获取连接,如消息启动Bean 就可以通过JNDI获取:@MessageDriven(activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue ...
jboss+mysql+jndi
jboss-web.xml jndi.properties oracle-ds.xml三个文件,EJB+JPA 所需要的一些配置文件
NULL 博文链接:https://elfmtian.iteye.com/blog/734597
主要参照网上的将打包了
jboss+mysql+jndi
jboss安装与jndi配置.doc,word文档形式的。
JNDI (Java Naming and Directory Interface) 它还提供一些高级特性,比如集群、JMX、Web Service。它还整合了IIOP(Internet Inter-ORB Protocol)。 因为JBoss代码遵循LGPL许可,你可以在任何商业应 用中免费使用...
jboss7连接oracle驱动及配置
JBOSS,JBoss安装部署 JBOSS,JBoss安装部署
JavaEE源代码 jboss-commonJavaEE源代码 jboss-commonJavaEE源代码 jboss-commonJavaEE源代码 jboss-commonJavaEE源代码 jboss-commonJavaEE源代码 jboss-commonJavaEE源代码 jboss-commonJavaEE源代码 jboss-...
JBoss启动JBoss启动JBoss启动JBoss启动JBoss启动JBoss启动JBoss启动JBoss启动 JBoss启动
某大牛写的jboss-exp 1. 查看系统名称 java -jar jboss_exploit_fat.jar -i http://192.168.7.84:10081/invoker/JMXInvokerServlet get jboss.system:type=ServerInfo OSName 2. 查看系统版本 java -jar jboss_...
jboss 下载(httpwww.jboss.org)
赠送jar包:jboss-logging-3.3.2.Final.jar; 赠送原API文档:jboss-logging-3.3.2.Final-javadoc.jar; 赠送源代码:jboss-logging-3.3.2.Final-sources.jar; 赠送Maven依赖信息文件:jboss-logging-3.3.2.Final....