看懂在APACHE网站上的英文文档确实是一项不小的挑战,下面说说飞宇对OFBIZ的入门方法,希望对像飞宇一样刚起步的人有所启示: 一、获取OFBIZ源码 由于我们学校用的是教育网,而关于OFBIZ的源码与文档只能由APACHE等外国网站提供,后来在文档上看到可以通过SVN下载,但事实证明在教育网下想通过SVN下载到OFBIZ几百MB的源码是不可能的。 后来,回家用ADSL,速度奇快,一般两三个小时就完成了。里面有多少个文件没数过,反正是挺多的。 还有一种不用SVN下载的方法,是直接上网站下。 PS: 用SVN下载: In the directory where you want OFBiz to be, do a SVN checkout of the ofbiz trunk. For example: svn co http://svn./repos/asf/ofbiz/trunk ofbiz 直接从网站下: All users can access anonymous WebDAV either by pointing your browser or connecting your WebDAV client to the same address as above: http://svn./repos/asf/ofbiz/trunk 推荐看Source Repository and Access这篇文档 二、运行自带的DEMO 1、在CMD里面定位到OFBIZ源码的根目录; 2、运行ant.bat命令 3、运行ant.bat run-install; 4、运行ant.bat run; 5、由于DEMO是用OFBIZ自带的DERBY数据库和J2EE容器,这时CMD窗口会占很大的系统资源,耐心点等到窗口信息停止滚动,不要关它。 6、打开游览器: Open a browser and go to http://127.0.0.1:8080/ecommerce/control/main for the ecommerce application or https://127.0.0.1:8443/webtools/control/main for the WebTools application or https://127.0.0.1:8443/catalog/control/main for the Catalog Manager application. PS:在调试时还有一个命令常用:ant.bat clean 推荐看Demo and Test Setup Guide这篇文章 三、与MYSQL结合 1、安装MYSQL,把MYSQL JDBC驱动放在OFBIZ源码ofbiz\framework\entity\lib\jdbc下; 2、在MYSQL中创建一个数据库,并赋予完全访问权限,如ofbiz_mysql数据库; 3、修改ofbiz\framework\entity\config下的entityengine.xml文件: <delegator name="default" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" distributed-cache-clear-enabled="false"> <group-map group-name="org.ofbiz" datasource-name="localmysql"/> </delegator> ---------------------------------------------------------------------- <datasource name="localmysql" helper-class="org.ofbiz.entity.datasource.GenericHelperDAO" schema-name="ofbiz_mysql" field-type-name="mysql" check-on-start="true" add-missing-on-start="true" use-pk-constraint-names="false"> <read-data reader-name="seed"/> <read-data reader-name="demo"/> <read-data reader-name="ext"/> <inline-jdbc jdbc-driver="com.mysql.jdbc.Driver" jdbc-uri="jdbc:mysql://127.0.0.1/ofbiz_mysql?autoReconnect=true" jdbc-username="root" jdbc-password="123456" isolation-level="ReadCommitted" pool-minsize="2" pool-maxsize="20"/> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> --> </datasource> --------------------------------------------------------------------- 4、按照运行DEMO的方法重新载入,完成转移数据库。 PS:在MYSQL中可以看到DEMO的数据库已经转移到里面了,几十个表呢,当然里面也有一些初始数据。 推荐看Demo and Test Setup Guide和Apache OFBiz Technical Production Setup Guide这两篇文章。 |
|
来自: ShangShujie > 《ofbiz》