当前位置:   article > 正文

新手干货 Apache Ofbiz介绍+安装到使用

apache ofbiz

1.介绍(Introduction):

OFBiz is an Apache Software Foundation top level project.

      首先先介绍一下 广义 Apache Ofbiz,Apache  OFBiz全称是The ApacheOpen For Business Project。Open For Business(OFBiz)是一套基于通用架构的企业应用程序,使用通用数据,逻辑和流程组件。 应用程序的松散耦合特性使这些组件易于理解,扩展和定制。

    提供了创建基于最新的J2EE/XML规范和技术标准,构建大中型企业级、快平台、跨数据库、跨应用服务器的多层、分布式电子商务类WEB应用系统的框架,类似 ERP,CRM,ORDER,电商..... 很多模块
  OFBiz几乎实现了所有的J2EE核心设计模式,各个模块之间的耦合比较松散,用户能够比较容易的根据自己的需要进行拆卸,非常灵活。下面介绍一下它的目录结构以及文件说明。

2.下载(DownLoad)

https://ofbiz.apache.org/developers.html

  搜索ofbiz 进入官方地址·  捣鼓那个网下载 ofbiz16.11.05的  (见图)

https://www.apache.org/dyn/closer.lua/ofbiz/apache-ofbiz-16.11.05.zip

 

  你可以 链接到网址:https://cwiki.apache.org/confluence/display/OFBIZ/OFBiz+Tutorial+-+A+Beginners+Development+Guide

然后再去对比其他文档看 之前文档都是很早之前的 文档了 新的版本都有所不同 

(备注 :我这里用的 是 ofbiz16.11.05 支持jdk1.8)

好了,看到这么多的(版本)不同时间的,版本的不同点 你都可以从上面链接里面Get到  (简直就是,哪里不懂点哪里 ... ... )

 

 

3.安装配置环境 (Installation configuration environment)

    上面备注了 我下载的是 Apachea OFbiz16版本的  支持jdk1.8(老版本以上 ,需另外更改配置)

下载了之后,简单操作,解压,该项目名称(记得要改文件名称,不然了解一下不改名为啥不行  也好 (* ̄︶ ̄) -!)

解压好的项目层级目录,这里介绍一下 这些包都是干什么用的

 

运行Apache ofbiz

  • 下载,解压,配置到本地,进入安装目录(即解压目录)导入到idea开发工具中 

  • 解压目录下:\framework\entity\config\entityengine.xml  中更改为本地mysql配置

       在本地数据库创建 ofbiz ,ofbizolap, ofbiztenant 三个数据库

下面我把我配置的本地mysql 代码 贴上来了   直接搜索 localmysql 可以发现 我改了三处   localmysql(ofbiz),localmysqlolap (ofbizolap),localmysqltenant (ofbiztentant)  。记得啊再往下面 还要配置自己的本地数据库 root、password  忘记了的话本地数据库的新建三个库里不会生成数据表(里面主体表:ofbiz)         

 

  默认先在本地创建三个数据库 (配置utf-8)

   然后这样还是不行的, 还要修改一处 mysql的驱动包 要添加到依赖中去也就是  解压文件下的 build.gradle文件下 配置 依赖包

  1. // MySQL Connector l
  2. compile 'mysql:mysql-connector-java:5.1.41'
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!--
  3. Licensed to the Apache Software Foundation (ASF) under one
  4. or more contributor license agreements. See the NOTICE file
  5. distributed with this work for additional information
  6. regarding copyright ownership. The ASF licenses this file
  7. to you under the Apache License, Version 2.0 (the
  8. "License"); you may not use this file except in compliance
  9. with the License. You may obtain a copy of the License at
  10. http://www.apache.org/licenses/LICENSE-2.0
  11. Unless required by applicable law or agreed to in writing,
  12. software distributed under the License is distributed on an
  13. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. KIND, either express or implied. See the License for the
  15. specific language governing permissions and limitations
  16. under the License.
  17. -->
  18. <!--
  19. - This file configures the Entity Engine JDBC (or other DataSource) and JTA
  20. access. For a detailed description see the core/docs/entityconfig.html file.
  21. -->
  22. <entity-config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  23. xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/entity-config.xsd">
  24. <resource-loader name="fieldfile" class="org.apache.ofbiz.base.config.FileLoader"
  25. prepend-env="ofbiz.home" prefix="/framework/entity/fieldtype/"/>
  26. <!-- the transaction factory class to use, one is needed for each way of getting JTA interfaces -->
  27. <!-- Use this one for Geronimo -->
  28. <transaction-factory class="org.apache.ofbiz.entity.transaction.GeronimoTransactionFactory"/>
  29. <!-- Use this one for getting the JTA objects from JNDI -->
  30. <!-- NOTE: to use the JndiFactory you must specify the necessary JNDI properties
  31. <transaction-factory class="org.apache.ofbiz.entity.transaction.JNDITransactionFactory">
  32. <user-transaction-jndi jndi-server-name="default" jndi-name="java:comp/UserTransaction"/>
  33. <transaction-manager-jndi jndi-server-name="default" jndi-name="java:comp/UserTransaction"/>
  34. </transaction-factory>
  35. -->
  36. <!--
  37. It is common to use UserTransaction for the TransactionManager, but if that doesn't work, try this: <transaction-manager-jndi jndi-server-name="default" jndi-name="java:comp/TransactionManager"/>
  38. Common UserTransaction locations:
  39. java:comp/UserTransaction (most servers: Resin, Orion, OC4J, etc)
  40. UserTransaction (RexIP)
  41. JBoss uses two different objects for the UserTransaction and TransactionManager interfaces;
  42. they are located in JNDI at: "java:comp/UserTransaction" and "java:/TransactionManager" respectively
  43. -->
  44. <!-- the connection factory class to use, one is needed for obtaining connections/pools for defined resources -->
  45. <connection-factory class="org.apache.ofbiz.entity.connection.DBCPConnectionFactory"/>
  46. <debug-xa-resources value="false" /> <!-- see https://issues.apache.org/jira/browse/OFBIZ-4282 for more -->
  47. <delegator name="default" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main" distributed-cache-clear-enabled="false">
  48. <group-map group-name="org.apache.ofbiz" datasource-name="localmysql"/>
  49. <group-map group-name="org.apache.ofbiz.olap" datasource-name="localmysqlolap"/>
  50. <group-map group-name="org.apache.ofbiz.tenant" datasource-name="localmysqltenant"/>
  51. </delegator>
  52. <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">
  53. <group-map group-name="org.apache.ofbiz" datasource-name="localderby"/>
  54. <group-map group-name="org.apache.ofbiz.olap" datasource-name="localderbyolap"/>
  55. <group-map group-name="org.apache.ofbiz.tenant" datasource-name="localderbytenant"/>
  56. </delegator>
  57. <!-- be sure that your default delegator (or the one you use) uses the same datasource for test. You must run "gradlew loadDefault" before running "gradlew testIntegration" -->
  58. <delegator name="test" entity-model-reader="main" entity-group-reader="main" entity-eca-reader="main">
  59. <group-map group-name="org.apache.ofbiz" datasource-name="localderby"/>
  60. <group-map group-name="org.apache.ofbiz.olap" datasource-name="localderbyolap"/>
  61. <group-map group-name="org.apache.ofbiz.tenant" datasource-name="localderbytenant"/>
  62. </delegator>
  63. <!-- need to at least define a name for each component to use -->
  64. <entity-model-reader name="main"/>
  65. <!-- need to at least define a name for each component to use -->
  66. <entity-group-reader name="main"/>
  67. <!-- need to at least define a name for each component to use -->
  68. <entity-eca-reader name="main"/>
  69. <!-- need to at least define a name for each component to use -->
  70. <!-- defining:
  71. tenant = OFBiz and External Tenant Data
  72. seed = OFBiz and External Seed Data - to be maintained along with source and updated whenever a system deployment is updated
  73. seed-initial = OFBiz and External Seed Data - to be maintained along with source like other seed data, but only loaded initially and not updated when a system is updated except manually reviewing each line
  74. demo = OFBiz Only Demo Data
  75. ext = External General Data (custom)
  76. ext-test = External Test Data (custom)
  77. ext-demo = External Demo Data (custom)
  78. -->
  79. <entity-data-reader name="tenant"/>
  80. <entity-data-reader name="seed"/>
  81. <entity-data-reader name="seed-initial"/>
  82. <entity-data-reader name="demo"/>
  83. <entity-data-reader name="ext"/>
  84. <entity-data-reader name="ext-test"/>
  85. <entity-data-reader name="ext-demo"/>
  86. <field-type name="hsql" loader="fieldfile" location="fieldtypehsql.xml"/>
  87. <field-type name="derby" loader="fieldfile" location="fieldtypederby.xml"/>
  88. <field-type name="daffodil" loader="fieldfile" location="fieldtypedaffodil.xml"/>
  89. <field-type name="axion" loader="fieldfile" location="fieldtypeaxion.xml"/>
  90. <field-type name="mysql" loader="fieldfile" location="fieldtypemysql.xml"/>
  91. <field-type name="postgres" loader="fieldfile" location="fieldtypepostgres.xml"/>
  92. <field-type name="oracle" loader="fieldfile" location="fieldtypeoracle.xml"/>
  93. <field-type name="sapdb" loader="fieldfile" location="fieldtypesapdb.xml"/>
  94. <field-type name="sybase" loader="fieldfile" location="fieldtypesybase.xml"/>
  95. <field-type name="firebird" loader="fieldfile" location="fieldtypefirebird.xml"/>
  96. <field-type name="mssql" loader="fieldfile" location="fieldtypemssql.xml"/>
  97. <field-type name="advantage" loader="fieldfile" location="fieldtypeadvantage.xml"/>
  98. <!--
  99. For DAO/JDBC Helper: Tries:
  100. 1. JNDI Datasource IF jdbc.jndi.name, context.provider, etc are specified
  101. 2. Embedded (JOTM) if available (uses jdbc.driver, jdbc.uri, jdbc.username, jdbc.password, isolation.level)
  102. 3. Direct to manually laoded JDBC driver (uses jdbc.driver, jdbc.uri, jdbc.username, jdbc.password)
  103. Transaction Isolation Levels - (<helperName>.isolation.level) can be as follows:
  104. * None
  105. * ReadCommitted (Recommended)
  106. * ReadUncommitted
  107. * RepeatableRead
  108. * Serializable (NOT Recommended)
  109. * Not set uses database default
  110. -->
  111. <datasource name="localhsql"
  112. helper-class="org.apache.ofbiz.entity.datasource.GenericHelperDAO"
  113. field-type-name="hsql"
  114. check-on-start="true"
  115. add-missing-on-start="true"
  116. check-indices-on-start="true"
  117. use-foreign-keys="true"
  118. use-foreign-key-indices="true"
  119. use-fk-initially-deferred="false"
  120. join-style="ansi-no-parenthesis"
  121. alias-view-columns="true">
  122. <read-data reader-name="tenant"/>
  123. <read-data reader-name="seed"/>
  124. <read-data reader-name="seed-initial&#
声明:本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号