ofbiz實體引擎結合jbuilder的配置
1.1 配置這一節將給出實體引擎在jbuider中單獨使用的配置向導
本文是從ofbiz網站的(OFBiz Quick Start Guide by Brett G. Palmer)的基礎上完成配置。
1.從www.ofbiz.org中下載ofbiz-XX-XX-complete.zip包,本文用的是ofbiz-2.1.1-apps.zip
解開放到某個目錄下,本文在j:\ofbiz,這也就是ofbiz.home的值
2.建立jbuilder項目,如下圖所示
3.加入源文件,
ofbiz.home/core/src/entiry
ofbiz.home/core/src/share
4.加入所用到的jar文件
ofbiz.home/lib/common
ofbiz.home/lib/compile
ofbiz.home/lib/jasterreports
ofbiz.home/lib/jotm
ofbiz.home/lib/scripting
ofbiz.home/lib/share
ofbiz.home/lib/tyrex
5.將配置文件等導入工程
將ofbiz.home/commonapp/etc下所有文件打到ofbiz_etc.jar包內
jar cvf ofbiz_etc.jar *
將ofbiz.home/core/docs/xmldefs/ofbiz下所有文件打到ofbiz_dtd.jar包內
jar cvf ofbiz_dtd.jar *
將這兩個包引入工程。
6.將ofbiz.home\setup\jrun4\servers\ofbiz\SERVER-INF\jndi.properties文件放入
ofbiz.home\lib\jotm\jotm.jar包內
7.配置ofbiz.home
在項目run tab中加入vm parameter:
-Dofbiz.home=j:\ofbiz
8.在GenericDelegator.java中,將下面語句注釋掉。
/*
// setup the Entity ECA Handler
try {
Class eecahClass = loader.loadClass(ECA_HANDLER_CLASS_NAME);
this.entityEcaHandler = (EntityEcaHandler) eecahClass.newInstance();
this.entityEcaHandler.setDelegator(this);
} catch (ClassNotFoundException e) {
Debug.logWarning(e, "EntityEcaHandler class with name " + ECA_HANDLER_CLASS_NAME + " was not found, Entity ECA Rules will be disabled");
} catch (InstantiationException e) {
Debug.logWarning(e, "EntityEcaHandler class with name " + ECA_HANDLER_CLASS_NAME + " could not be instantiated, Entity ECA Rules will be disabled");
} catch (IllegalAccessException e) {
Debug.logWarning(e, "EntityEcaHandler class with name " + ECA_HANDLER_CLASS_NAME + " could not be accessed (illegal), Entity ECA Rules will be disabled");
} catch (ClassCastException e) {
Debug.logWarning(e, "EntityEcaHandler class with name " + ECA_HANDLER_CLASS_NAME + " does not implement the EntityEcaHandler interface, Entity ECA Rules will be disabled");
}
*/
9.測試文件Test.java
package org.ofbiz.core;
import org.ofbiz.core.entity.GenericDelegator;
import org.ofbiz.core.entity.GenericValue;
import org.ofbiz.core.util.UtilMisc;
import org.ofbiz.core.entity.*;
public class Test {
public static void main(String[] args) {
System.out.println("Entered testFindByPrimaryKey");
//Instantiate the delegator.
GenericDelegator delegator = GenericDelegator.getGenericDelegator("default");
// Find book by primary key
try {
GenericValue party= delegator.findByPrimaryKey("PartyType",
UtilMisc.toMap("partyTypeId", "PERSON"));
}
catch (GenericEntityException ex1) {
}
return;
}
}
10.ok
posted on 2006-08-15 11:29 liaojiyong 閱讀(520) 評論(0) 編輯 收藏 所屬分類: Ofbiz