登录社区:用户名: 密码: 忘记密码 网页功能:加入收藏 设为首页 网站搜索  

文档

下载

图书

论坛

安全

源码

硬件

游戏
首页 信息 空间 VB VC Delphi Java Flash 补丁 控件 安全 黑客 电子书 笔记本 手机 MP3 杀毒 QQ群 产品库 分类信息 编程网站
  立华软件园 - 安全技术中心 - 技术文档 - JAVA 技术文章 | 相关下载 | 电子图书 | 攻防录像 | 安全网站 | 在线论坛 | QQ群组 | 搜索   
 安全技术技术文档
  · 安全配制
  · 工具介绍
  · 黑客教学
  · 防火墙
  · 漏洞分析
  · 破解专题
  · 黑客编程
  · 入侵检测
 安全技术工具下载
  · 扫描工具
  · 攻击程序
  · 后门木马
  · 拒绝服务
  · 口令破解
  · 代理程序
  · 防火墙
  · 加密解密
  · 入侵检测
  · 攻防演示
 安全技术论坛
  · 安全配制
  · 工具介绍
  · 防火墙
  · 黑客入侵
  · 漏洞检测
  · 破解方法
 其他安全技术资源
  · 攻防演示动画
  · 电子图书
  · QQ群组讨论区
  · 其他网站资源
最新招聘信息

weblogic与jBuilder5集成开发EJB全功全守
发表日期:2004-07-30作者:[转贴] 出处:  


Weblogic6.0Jbuilder5的集成

进行EJB的开发调试

一、安装和配置

先安装Jbuilder5 Enterprise,然后安装Jbuilder5 Person, license key,确保Jbuilder5 Enterprise,能运行。

安装完Jbuilder5,BAS4.5weblolgic6.0后,就可以开始配置了。

1 系统环境变量的修改:

把系统环境变量TMPTEMP改为不带有空格的目录;

JB5里菜单 Project --> Default Project Properties -->Paths 中把所有带空格的目录改为不带空格的目录;(为什么要这样设置呢?因为整合后的 weblogic JB5在开发过程中JB5会调用 weblogic 的包来制作EJB,而weblogic对那些有空格的不能很好地识别,工作时会出错,即是说weblogic要接触到的目录,目录名最好不是中文名、带空格。)

在使用JB5编辑时会发现光标与实际位置不对齐的问题, 其实只需要在Tools -->Editor Opntion -->Color Reserved Word 设置成不使用粗体和斜体就可以了。

2 jbuilder5 的配置:

A Tools -->Configure Libraries 下确定有WebLogic6.0包,其中class中应该加入如下class和路径:

C:eawlserver6.0lib cr_wls60f.jar(是Weblogic6.0crack包)

C:eawlserver6.0libweblogic_sp.jar

C:eawlserver6.0libweblogic.jar

BTools Menu -->Enterprise Setup -->CORBA

新增一个weblogic的项, Path for ORB tools下,加入Weblogic的主目录,在Library for projects下,加入 Weblogic6.0 库,具体方法是:点“..”,然后选择 Weblogic6.0包;在 compiler command 填上 idlj.exe ;在Command option for output directory 填上一个目录路径,但是要注意的是,不能是中文、带空格。

 

CTools Menu -->Enterprise Setup -->Application Server -->BAS4.5

填上 AppServer 安装的目录。并选上 Enable Integrate复选框。

Tools Menu -->Enterprise Setup -->Application Server -->Weblogic6.0 填上 Weblogic 安装的目录和主目录。

注意:不要选中Use external compiler复选框

D、配置Default Project Properties

Project -->Default Project Properties -->Path -->Required Libraries 中选择Weblogic6.0

Project -->Default Project Properties -->Build -->IDL IDL compiler中选择Weblogic

Project -->Default Project Properties -->Run -->Application选择main class weblogic.Server (当你正确设定Weblogic6.0包后,可以找到该类。)

Complile before running Complile before debugging 的钩子去掉,否则即使你运行一次EJB客户端都好都会重新制作一次EJB包。

Project -->Default Project Properties -->Servers 点“..”这这里选择 Application Server ,当然又是选Weblogic6.0 选中 Weblogic6.0后点 Edit…按钮:

²     Require Libraries添加 Weblogic6.0包,把其他删除;同时在class 中删除所有的类的路径;

²     修改VM Parameters:如:

-ms64m -mx64m  -Dweblogic.Domain=petstore -Dweblogic.Name=petstoreServer -Dbea.home=d:ea -Dcloudscape.system.home=.samplesevalcloudscapedata -Djava.security.policy==d:eawlserver6.0libweblogic.policy 

注意:参数为启动weblogic服务的启动参数,可以参照../config/mydomain/startWeblogic.cmd里的启动配置,调试过程中的大部分错误来至于此处的不合理配置,包括其中的domainserver名的大小写,都会造成出错。

²     如果需要调试JSPServlet,选中Application server is web server

二、在 Jbuilder中创建Enterprise Bean

Each enterprise bean you create must belong to a JBuilder EJB group. An EJB group is a logical grouping of one or more beans that will be deployed in a single JAR file. It contains the information that is used to produce the deployment descriptor(s) for that JAR file. You can edit the content of an EJB group using the Deployment Descriptor editor.

l     Creating an EJB group

两种方式:

 File|New|Enterprise|Empty EJB Group…

 File|New|Enterprise|EJB Group From Descriptors…

Notice:EJB Group类型选择ejbprgx(用XML作描述文件,适用于版本控制)

l     Creating an Entity Enterprise Bean

两种方式:

²    Enterprise JavaBean wizard

²    The EJB Entity Bean Modeler

File|New|Enterprise|Enterprise JavaBean…

l     EJB中增加属性及方法

选中EJB类文件,选择Bean Designer|property|Add Property

l     Exposing Business methods through the remote interface

在远程接口中增加方法:

选中EJB类文件,选择Bean Designer|Mothods Tab,选择要暴露在远程接口中的方法(Checked or UnCheck)。

三、调试EJB

1、       创建Container Server

Run|Configurations…?D?D》New…|Run

l     Configuration nameServerName

l     正确设置EJB|VM parameters:(和Project Properties…àRunàEJB| VM parameters…);

l     Application|Main classweblogic.Server

2、       创建Cilent for Test

l     创建Client框架

NewàEnterprise|EJB Test Client…选择需要调试的EJB名称和Package,Class名称,ok按钮。

l     添加对EJB方法的引用

ClientClass的构造函数的try块的结尾添加对EJB方法的引用。Eg:

package adtec.wei.changTest;

import adtec.wei.chang.*;

import javax.naming.*;

import java.util.Properties;

import javax.rmi.PortableRemoteObject;

 

public class changEJBTestClient {

  private changEJBHome changEJBHomeObject = null;

  /**Construct the EJB test client*/

  public changEJBTestClient() {

    try {

      //get naming context

      Context ctx = getInitialContext();

      //look up jndi name

      Object ref = ctx.lookup("changEJBHome");

      //cast to Home interface

      changEJBHomeObject = (changEJBHome) PortableRemoteObject.narrow(ref, changEJBHome.class);

     int age = changEJBHomeObject.create().getAge();

     System.out.println("My Age is : "+age);

    }

    catch(Exception e) {

      e.printStackTrace();

    }

  }

 

  private Context getInitialContext() throws Exception {

    String url = "t3://100.100.100.69:7001";

    String user = null;

    String password = null;

    Properties properties = null;

    try {

      properties = new Properties();

      properties.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");

      properties.put(Context.PROVIDER_URL, url);

      if (user != null) {

        properties.put(Context.SECURITY_PRINCIPAL, user);

        properties.put(Context.SECURITY_CREDENTIALS, password == null ? "" : password);

      }

      return new InitialContext(properties);

    }

    catch(Exception e) {

      System.out.println("Unable to connect to WebLogic server at " + url);

      System.out.println("Please make sure that the server is running.");

      throw e;

    }

  }

 

   // Utility Methods

  //--------------------------------------------------------------------

  public changEJBHome getHome() {

    return changEJBHomeObject;

  }

  /**Main method*/

  public static void main(String[] args) {

      changEJBTestClient client = new changEJBTestClient();

      //int age = client.getHome().create().getAge();

    // Use the getHome() method of the client object to call Home interface

    // methods that will return a Remote interface reference.  Then

    // use that Remote interface reference to access the EJB.

  }

}

 

l     创建Client运行环境

Run|Configurations…?D?D》New…|Run

Application|Main classwei.chang.song.changEJBTestClient

其中:Main Class为我们创建的客户端运行类。

3、       运行调试

l     选择快捷工具条上的Run Project按钮,点开下拉菜单,选择运行Container Server,启动EJB容器服务;如存在问题,请首先检查VM Parameters,确认无误。

l     同上的方式运行Client,客户端将返回正确的期望值。

4、       远程调用EJB

EJB包文件,发布到Application Server上,确保Server已经启动。Client远程调用时,更改在getInitialContext函数中的URL,如Application ServerIP地址为100.100.100.69的机器上运行,则URLt3//100.100.100.697001

注:有关Jbuilder 5Borland AppServer的集成应用,参见Jbuilder 5 Help,里面有较为详尽的介绍。

 


我来说两句】 【发送给朋友】 【加入收藏】 【返加顶部】 【打印本页】 【关闭窗口
中搜索 weblogic与jBuilder5集成开发EJB全功全守

 ■ [欢迎对本文发表评论]
用  户:  匿名发出:
您要为您所发的言论的后果负责,故请各位遵纪守法并注意语言文明。

最新招聘信息

关于我们 / 合作推广 / 给我留言 / 版权举报 / 意见建议 / 广告投放 / 友情链接  
Copyright ©2001-2006 Lihuasoft.net webmaster(at)lihuasoft.net
网站编程QQ群   京ICP备05001064号 页面生成时间:0.00197