ofbiz入门及安装

1.Ofbiz 介绍:

  Ofbiz(http://ofbiz.apache.org) 是 apache 的电子商务平台,充分利用了apache下的Open Source 项目,像 Tomcat, Ant, BeanShell, Jboss 等,构建了一个强大的系统平台,Ofbiz 已经完成了电子商务平台都需要的功能,像用户认证、工作流、交易规则处理等,Ofbiz 的核心技术在于 Entity Engine,其他的组件基本都是基于它的。简单来说 Entity Engine 的主要功能是将数据库表创建、对象与数据表的映射、对象的查询等做了强大封装,你可以在一个简单的 XML 文件中定义数据库表结构,Ofbiz 会自动帮你在数据库建表,并动态生成映射对象,你在程序中可以只考虑对 Object 的处理,Ofbiz 会自动通过事务逻辑更新到数据库中。Ofbiz 宣称的优点之一是用很少的 Code 完成复杂的处理。 
2.Ofbiz 下载与安装

  首先要安装 J2SDK1.6,到 http://java.sun.com 上下载,安装后设定 JAVA_HOME 环境变量为 J2SDK 的安装目录。

  访问网站http://ofbiz.apache.org,上面有下载的连接,请选择对应最新的稳定版本,下载下来解开后就可以运行了。 

3.ofbiz 配置mysql数据库
首先在 MySQL 创建数据库 ofbiz。
更新JDBC驱动,将mysql的jdbc驱动copy到${ofbiz-install-dir}/framework/entity/lib/jdbc 目录下。
设置实体引擎( Entity Engine)的缺省数据库为mysql.在修改 ${ofbiz install dir}/framework/entity/config/entityengine.xml文件中修改配置:
修改数据库连接参数:
<datasource 
           name="localmysql" 
           helper-class="org.ofbiz.entity.datasource. 
GenericHelperDAO" 
            field-type-name="mysql" 
            check-on-start="true" 
            add-missing-on-start="true" 
            check-pks-on-start="false" 
            use-foreign-keys="true" 
            join-style="ansi-no-parenthesis" 
            alias-view-columns="false" 
            drop-fk-use-foreign-key-keyword="true" 
            table-type="InnoDB" 
            character-set="utf8"   --字符集 
            collate="utf8_general_ci">  --排序方式 
        <read-data reader-name="seed"/> 
        <read-data reader-name="seed-initial"/> 
        <read-data reader-name="demo"/> 
        <read-data reader-name="ext"/> 
        <inline-jdbc 
                jdbc-driver="com.mysql.jdbc.Driver" 
                jdbc-uri="jdbc:mysql://localhost:3306/ofbiz?autoReconnect=true"  --数据库名 
                jdbc-username="root"  --用户名 
                jdbc-password=""   --密码 
                isolation-level="ReadCommitted" 
                pool-minsize="2" 
                pool-maxsize="250" 
                time-between-eviction-runs-millis="600000"/><!-- ####--> 
        <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> --> 
    </datasource>

修改实体引擎的数据库缺省配置如下:将datasource-name的值设置为 localmysql: 
<!-- the connection factory class to use, one is needed for obtaining connections/pools for defined resources --> 
    <connection-factory class="org.ofbiz.entity.connection.DBCPConnectionFactory"/> 

    <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"/> 
       <group-map group-name="org.ofbiz.olap" 
                  datasource-name="localmysql"/> 
    </delegator> 
    
            <delegator name="default-no-eca" 
               entity-model-reader="main" 
               entity-group-reader="main" 
               entity-eca-reader="main" 
               entity-eca-enabled="false" 
               distributed-cache-clear-enabled="false"> 
        <group-map group-name="org.ofbiz" 
                   datasource-name="localmysql"/> 
        <group-map group-name="org.ofbiz.olap" 
                   datasource-name="localmysql"/> 
    </delegator> 

    <!-- be sure that your default delegator (or the one you use) uses the same datasource for test. You must run "ant run-install" before running "ant run-tests" --> 
    <delegator name="test" 
               entity-model-reader="main" 
               entity-group-reader="main" 
               entity-eca-reader="main"> 
        <group-map group-name="org.ofbiz" 
                   datasource-name="localmysql"/> 
        <group-map group-name="org.ofbiz.olap" 
                   datasource-name="localmysql"/> 
    </delegator> 
    
            <delegator name="other" 
               entity-model-reader="main" 
               entity-group-reader="main" 
               entity-eca-reader="main"> 
        <group-map group-name="org.ofbiz" 
                  datasource-name="localmysql"/> 
    </delegator>

4.ofbiz编译和运行
打开dos并在ofbiz9 目录下执行命令: 
ant run-install (该命令用来预置默认数据库,编译java code)
startofbiz.bat

启动成功,可以打开以下界面: 
http://localhost:8080/ecommerce; 
https://localhost:8443/webtools; 

转载于:https://www.cnblogs.com/fantao-meng/p/3145301.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值