您现在的位置: 中国教师站 >> 教师关注 >> 电脑技术 >> 编程技术 >> Java >> 正文

Google
jboss3.2初步配置使用心得[windows2000+sql server 20
作者:Siny 文章来源:中国教师站cn-teacher 点击数: 更新时间:2007-4-22 14:50:32
nbsp;  
    } catch (java.rmi.RemoteException e) {
     e.printStackTrace();
    } catch ( Throwable t ) {
     t.printStackTrace();
    } finally {
   
    }
    return ejbSays;
   }
 
   public static Context getInitialContext() throws Exception {
    Properties p = new Properties();
    p.put(Context.INITIAL_CONTEXT_FACTORY,
             "org.jnp.interfaces.NamingContextFactory");
           p.put(Context.PROVIDER_URL, "localhost:1099");
           return new InitialContext(p);
   }
       
   public static void main(String[] args) {
           JFrame win = new HelloWorldClient();
           win.pack();
           win.setVisible(true);
   }
       
   private String ejbSays="";
   private JTextField info;
   private JButton subButton;
   private JTextArea area;
  }

  作了一个简单的gui,主要注意的是getInitalContext()方法jboss的连接参数的设置和getEJBInfo()方法对ejb的调用

  将编译好的HelloWorldClient.class,HelloWorldClient$1.class,放置到d:sessionbean目录下(如果放到别的地方,确定可以
  通过路径找到HelloBean,HelloHome,Hello类

  d:sessionbeanjava HelloWorldClient

  点按钮就会返回hello world(做gui是为了复习一下以前的知识)

 <5>cmp的测试
  此cmp继续使用上面的数据源对应的northwind数据库,要在其中建一个表cd。
  <<1>>CD.java

   import javax.ejb.EJBObject;
   import java.rmi.RemoteException;

   public interface CD extends EJBObject {

    public Integer getId() throws RemoteException;
    public void setId(Integer id) throws RemoteException;
 
    public String getTitle() throws RemoteException;
    public void setTitle(String title) throws RemoteException;

    public String getArtist() throws RemoteException;
    public void setArtist(String artist) throws RemoteException;

    public String getType() throws RemoteException;
    public void setType(String type) throws RemoteException;

    public String getNotes() throws RemoteException;
    public void setNotes(String notes) throws RemoteException;
   }

  <<2>>CDHome.java

   import javax.ejb.EJBHome;
   import javax.ejb.CreateException;
   import javax.ejb.FinderException;
   import java.rmi.RemoteException;
   import java.util.Collection;

   public interface CDHome extends EJBHome {
  

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 下一页

相关专题:
 
 网友评论:(评论内容只代表网友观点,与本站立场无关!)
GOOGLE广告

阅读排行

| 设为首页 | 加入收藏 | 联系站长 | 友情链接 | 版权申明 |
中国教师站

中国教师站 版权所有 Copyright © 2006-2020 All Rights Reserved 站长:Sina & Siny
[备用域名:www.JXZYW.Com] 有事请留言有事请留言
【实力成就精品 诚信呵护品牌】

信息产业部备案
苏ICP备06018635号