您的位置:首页 >> 编程开发 >> Java >> JavaBeans >> 正文
JavaBeans RSS
 

JBOSS3.0.4配置及使用初步

http://www.rdxx.com 01年11月18日 11:08 互联网 我要投稿

关键词: JBoss , 配置 , JB
System.out.println("ejbActivate");

       }

       public void ejbPassivate() throws EJBException, RemoteException {

              System.out.println("ejbPassivate");

       }

       public String example()

       {

              System.out.println("example()");

              return "Just a simple example!";

       }

}

客户端调用程序文件:ExampleClient.java

package examples;

import javax.naming.*;

import javax.rmi.PortableRemoteObject;

import java.util.Properties;

public class ExampleClient {

       public ExampleClient() {

              super();

       }

       public static void main(String[] args){

              try{

              Properties props =new Properties();

              props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");

              props.put(Context.PROVIDER_URL,"172.16.1.4:1099");

              Context ctx = new InitialContext(props);

              System.out.println("start ejb client test");

              Object obj=ctx.lookup("Example");

              ExampleHome home = (ExampleHome)PortableRemoteObject.narrow(obj,ExampleHome.class);

              Example example = home.create();

              System.out.println(example.example());

              example.remove();

              }catch(Exception e)

              {

                     e.printStackTrace();

              }

       }

}

EJB打包

       我们需要将以上文件编译的CLASS文件打成一个JAR包,部署到JBOSS中,才能调用

9 7 3 1 2 3 4 5 4 8 :


 
 
标签: JBoss , 配置 , JB 打印本文
 
 
  热点搜索
 
 
 



Valid XHTML 1.0 Transitional
Copyright ©2005 - 2008 Rdxx.Com,All Rights Reserved
收藏本页
收藏本站