1.什么是JBoss
2.ejbç¨åºä»£ç
什么是JBoss
是一个基于J2EE的开放源代码的应用服务器。 JBoss代码遵循LGPL许可,可以在任何商业应用中免费使用。王 源码时代JBoss是一个管理EJB的容器和服务器,支持EJB 1、硅谷源码1、liveplayerjs源码EJB 2、0和EJB3的规范。但JBoss核心服务不包括支持servlet/JSP的WEB容器,一般与Tomcat或Jetty绑定使用。
ejbç¨åºä»£ç
EJBæ¯J2EEæ¡æ¶ä¸æéè¦çé¨åï¼ä¹æ¯ä¼ä¸åºç¨ä¸æ常ç¨çææ¯ä¹ä¸ï¼ç¶èEJBç客æ·ç«¯ç¼å对äºå¼åè èè¨ä¸æ¯ä¸ä»¶è½»æ¾çäºæ ãæ§ä»¶æ¶æä¸çEJBæ§ä»¶å¤§å¤§çç®åäºEJBèµæºçå¤ææ§ãé¾åº¦ï¼å¼åè åªéè¦éè¿ç®åçç»§æ¿ org.apache.beehive.controls.system.ejb.SessionEJBControlæè org.apache.beehive.controls.system.ejb.EntityEJBControlï¼ç¶åéè¿æä¾ç¸åºç注éå°±å¯ä»¥å®æ EJBèµæºç访é®ã
-------------------------------------------------------------
EJB Beanç±»æºä»£ç âHelloWorld.java
æ¸ å1 ejbsrcorgvivianjbeehivecontrolsexamplesejbhelloworld.java
1. package org.vivianj.beehive.controls.examples.ejb;
2.
3. import javax.ejb.*;
4.
5. public class HelloWorld
6. implements SessionBean
7. {
8. public void ejbCreate() {
9. }
. public String sayHello()
. {
. return âHello World!â;
. }
. }
å ±4页ã
EJB Remoteæ¥å£ç±»æºä»£ç âHelloWorldRemote.java
æ¸ å2 ejbsrcorgvivianjbeehivecontrolsexamplesejbHelloWorldRemote.java
1. package org.vivianj.beehive.controls.examples.ejb;
2.
3. import javax.ejb.EJBObject;
4. import java.rmi.RemoteException;
5.
6. import javax.ejb.*;
7.
8. public interface HelloWorldRemote extends EJBObject {
9.
. public String sayHello() throws RemoteException;
.
. }
EJB Homeæ¥å£ç±»æºä»£ç --HelloWorldHome.java
æ¸ å3 ejbsrcorgvivianjbeehivecontrolsexamplesejbHelloWorldHome.java
1. package org.vivianj.beehive.controls.examples.ejb;
2.
3. import javax.ejb.CreateException;
4. import javax.ejb.EJBHome;
5. import javax.ejb.FinderException;
6. import java.rmi.RemoteException;
7. import java.util.Collection;
8.
9. import javax.ejb.*;
.
. public interface HelloWorldHome extends EJBHome {
.
. public HelloWorldRemote create()
. throws CreateExceptionï¼ RemoteException;
.
. }
EJBå¼åå®æåï¼æ们å¯ä»¥å°EJBæå æä¼ä¸åºç¨ï¼ç¶åå°çæçä¼ä¸åºç¨åå¸å°JBossåºç¨æå¡å¨ä¸ã
å¼åEJBæ§ä»¶
æ们ç°å¨æ¥å¼åä¸ä¸ªEJBæ§ä»¶-- HelloWorldSessionEJBControlï¼éè¿å®æ们è½å¤ç´æ¥è®¿é® 1.å¼åSessionBean ä¸å¼ååé¨ç½²çEJBã
HelloWorldSessionEJBControléè¿JBossæä¾çorg.jnp.interfaces.NamingContextFactoryå·¥åç±»è·åEJB访é®çä¸ä¸æç¯å¢ã
æ¸ å4ä¸æ¯EJBæ§ä»¶çå ¨é¨æºä»£ç ã
æ¸ å4 srcorgvivianjbeehivecontrolsexamplescontrols
HelloWorldSessionEJBControl.java
1. package org.vivianj.beehive.controls.examples.controls;
2.
3. import org.apache.beehive.controls.api.bean.ControlExtension;
4. import org.apache.beehive.controls.system.ejb.SessionEJBControl;
5. import org.vivianj.beehive.controls.examples.ejb.helloworldHome;
6. import org.vivianj.beehive.controls.examples.ejb.helloworldRemote;
7.
8. /
**9. * HelloWorldSessionEJBControl ç¨äºå°è£ 访é®è¿ç¨JBossæå¡å¨ä¸
. * SessionBeançæä½æ¹æ³
. */
. @ControlExtension
. @SessionEJBControl.EJBHome(jndiName = âjndi/helloworldâ)
. @SessionEJBControl.JNDIContextEnv(
. contextFactory = âorg.jnp.interfaces.NamingContextFactoryâï¼
. providerURL = âjnp://localhost:â)
. public interface HelloWorldSessionEJBControl
. extends SessionEJBControlï¼
. HelloWorldHomeï¼ HelloWorldRemote {
. }
2024-11-20 20:04
2024-11-20 18:46
2024-11-20 18:39
2024-11-20 18:39
2024-11-20 18:31
2024-11-20 18:17
2024-11-20 18:17
2024-11-20 17:53