您的位置:jsp学习站首页 >> 工具/平台 >> 其它 >> 开发工具:用JBuiler玩转petstore

开发工具:用JBuiler玩转petstore (1)

[ 来源:互网络 | 更新日期:2007-10-01 20:44:12 | 浏览次数:17941]
简介:bea

开发j2ee应用一直用Jbuiler(两个月前因工作关系开始用eclipse了),仓促开发了所谓数千万的项目(政府的),在banq的指点下,才突然发现petstore中有很多可借鉴的东西。

  而Jbuiler下玩petstore不是件很容易的事,本人在暑假期间花了三天时间解决了这个问题,愿与大家共享。本文只包括ejb部分。petstore的版本是bea提供的,因为我用的是weblogic,带来的一个附加的优点是学习了ejb的继承。

  首先从以下地址下载petstore源码。

  ftp://edownload:BUY_ME@ftpna2.bea.com/pub/downloads/petstore_1.3.1_02_bea.zip

0.按JBuilder标准拷贝文件至src目录

1.package com.sun.j2ee.blueprints.waf.view.taglibs.smart;
开始位置在com.sun.j2ee.bluprints.taglibs.smart,改。

2.新建petstore Web App,自然引入原有的Web pacakage

3.配好pointbase数据源:Enterprise Setup--Database Poilet(URL中要注意去掉jdbc:)--JBuiler中配数据源(一直不能看到table,不知何原因。重启后没反应,删除jndi-definations.xml后,又乱改了一下密码,refresh才行。)

4.可以开始import ejb了,import所有带ejb子目录下的ejb。注意!primary key class手工写为java.lang.String报错:Error Parsing EJB file: Source file not found for class: null。是指的String类找不到!麻烦!而写为com.sun.j2ee.blueprint.xxx.xxPK!也出错:包不对:com.sun.j2ee.blueprint.xxx.String。改为:com.sun.j2ee.blueprint.xxx.WeblogicxxPK。又出错!
"estore.jar": Unable to load a class specified in your ejb-jar.xml: Unable to load Primary Key class: ’String’. Possible causes: 1:
The Primary Key class is a Java Language Primitive;
this is not allowed. 2: If the Primary Key is a Compound Key,
 the Compound Primary Key class is not in the JAR file being compiled.
3: The classpath is incorrect.
此问题最后手工改:petstore.ejbgrpx中的java.lang.String解决。
注意:WeblogicXXXEJB的Inheritence选项中指定EJB的父类。引完后必须手工选择Table,Table Schema要把后缀EJB去掉,不然EJB-QL语句会出错。手工选择对应数据库的column,不然会报错:ejb-jar.xml中的cmp-field必须在weblogic-rdbms-jar中有对应元素。
另外,CustomerEJB中account, profile都选对应的field为account_primarykey, profile_primarykey而不是同名的field!

5.一路顺利,但OPCAdminFacadeEJB报告名称冲突。原因是建立了错误的EJB,找到那个打了叉的EJB视图。

6.EJB-QL书写。找到Primiry-key之外的方法,搜索ejb-jar.xml中包括EJB名称的文件(有很多ejb-jar文件)。拷贝相应的ejb-ql语句。

7.ejbCreat方法必须返回primary-key类型的值。此问题的解决办法是在Local Home Interface中定义主键时,使用(Object key),JBuiler有时会自动改,再改回来!

8.把WeblogicXXEJB的primarykey的Integer类型改为String类型,否则会说主键描述和定义的不一样。不能改父类的定义,只能这么改了,不知有无副作用。

9.console-security-user中把admin等用户的用户名改为petstore,以便登录

10.
(1)JMS stores
MyJMS File Store, JMSFileStore
MyJMS File Store Persist, P_JMSFileStore
(2)JMS Server
MyJMS Server
注意选择Persistent Store, paging store
(3)Connection Factorys
jms/op

[1] [2]
Tags:关键字:开发工具:用JBuiler玩转petstore
责任编辑:glen