开源电商 OFBiz (Mysql)Idea安装过程及问题(中文乱码,500 GenericEntityException jdbc,Visitor错误处理)

    xiaoxiao2022-06-22  19

    开源电商 OFBiz (Mysql)安装过程及问题

    OFBiz是一个非常著名的电子商务平台,是一个非常著名的开源项目,提供了创建基于最新J2EE/XML规范和技术标准,构建大中型企业级、跨平台、跨数据库、跨应用服务器的多层、分布式电子商务类WEB应用系统的框架。 OFBiz最主要的特点是OFBiz提供了一整套的开发基于Java的web应用程序的组件和工具。包括实体引擎, 服务引擎, 消息引擎, 工作流引擎, 规则引擎等。OFBiz 已经正式成为 Apache 的顶级项目: Apache OFBiz。Apache OFBiz不仅是一个产品及订单管理系统,它还提供了一整套功能,涵盖企业所需的方方面面。除了管理产品及其相关内容(如电子商店)外,Apache OFBiz还能履行许多其它重要角色,包括客户关系管理、项目进度、计费管理、人力资源管理以及订单管理。简而言之,它就是一个企业资源规划器。世界上有上千个企业在某方面或多方面依赖于OFBiz。

    下载Ofbiz

    目前Ofbiz的下载版本为:13.07.3(我们也是把这个版本作为实验环境) - 下载地址为:http://ofbiz.apache.org/download.html - 本版本下载:http://101.110.118.71/www.apache.org/dyn/closer.lua/ofbiz/apache-ofbiz-13.07.03.zip

    关于分支版本,官方是这样给的,后面可能会有16.xx,14.12 - 15.12官方描述

    官方版本描述

    运行Ofbiz

    这个是已经下载好的目录及解压 \ue415 下一个步骤,我们开始做一系列配置 ofbiz自带的数据库是Derby,这是一种小型的适合与测试系统的数据库,因为在项目中我们只是简单的实现一个但不适合在产品级系统中使用,所以通常我们需要将ofbiz迁移到其它数据库上,下面我就以如何迁移至mysql为例,向大家讲述数据库迁移过程,迁移至其它数据库的过程类似. 修改配置文件: entityengine.xml–>目录为..\apache-ofbiz-13.07.03\framework\entity\config


    –idea快捷键 注释快捷键 Ctrl+/ Ctrl+Shift+/ 区分它们两个的性质 一个是单行,一个是多行多注释 一个是多行单注释 格式化代码 Ctrl+Alt+L (如果不起作用,热键冲突了,自己可以根据自己喜好设置)

    <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="localderby"/> <group-map group-name="org.ofbiz.olap" datasource-name="localderbyolap"/> <group-map group-name="org.ofbiz.tenant" datasource-name="localderbytenant"/> <!-- <group-map group-name="org.ofbiz" datasource-name="localmysql"/> <group-map group-name="org.ofbiz.olap" datasource-name="localmysqlolap"/> <group-map group-name="org.ofbiz.tenant" datasource-name="localmysqltenant"/> --> <!-- <group-map group-name="org.ofbiz" datasource-name="localpostnew"/> <group-map group-name="org.ofbiz.olap" datasource-name="localpostolap"/> <group-map group-name="org.ofbiz.tenant" datasource-name="localposttenant"/> --> </delegator>

    修改..(自己举一反三,下面的雷同)

    <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="localderby"/> <group-map group-name="org.ofbiz.olap" datasource-name="localderbyolap"/> <group-map group-name="org.ofbiz.tenant" datasource-name="localderbytenant"/>--> <group-map group-name="org.ofbiz" datasource-name="localmysql"/> <group-map group-name="org.ofbiz.olap" datasource-name="localmysqlolap"/> <group-map group-name="org.ofbiz.tenant" datasource-name="localmysqltenant"/> <!-- <group-map group-name="org.ofbiz" datasource-name="localpostnew"/> <group-map group-name="org.ofbiz.olap" datasource-name="localpostolap"/> <group-map group-name="org.ofbiz.tenant" datasource-name="localposttenant"/> --> </delegator>

    其实如果你仔细的阅读了README 后面的就很Easy,贴出来

    All you need to run OFBiz is a 1.7 (version 7) JDK (not just the JRE, the full JDK). http://java.sun.com/javase/downloads/index.jsp You can load the demo data (strongly advised if you are new to OFBiz) with the following command on the command line from the OFBiz home folder (in Unix-like operating systems type "./ant" rather than "ant" to use the embed ant version if you haven't installed it on your system) : ant load-demo Then start OFBiz: ant start (or "java -Xms128M -Xmx512M -XX:MaxPermSize=128m -jar ofbiz.jar") (you can also run directly "ant load-demo start") Once OFBiz starts, you can look at the demo storefront at: http://localhost:8080/ecommerce the back office at: https://localhost:8443/ordermgr and the administration interface at: https://localhost:8443/webtools You can log in with the user "admin" and password "ofbiz". To stop OFBiz: ant stop To get the list of available commands: ant -p

    ofbiz采用编码jbk,我们改成utf-8主要都有哪些要改动的地方…. 创建数据库 我们上面说了,修改 entityengine.xml 这个文件,那么继续修改 ,土鳖康铁牛(to be continue) 数据源配置 下面配置localmysql 数据连接字符,在entityengine.xml 下半部分, 当然为了方便,数据库,用户名,密码都设置成ofbiz就不用改配置。连接自己改 character-set=”utf8” collate=”utf8_general_ci” jdbc-uri=”jdbc:mysql://192.168.163.128/ofbiz?autoReconnect=true&characterEncoding=UTF-8”

    <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="tenant"/> <read-data reader-name="seed"/> <read-data reader-name="seed-initial"/> <read-data reader-name="demo"/> <read-data reader-name="ext"/> <read-data reader-name="ext-test"/> <read-data reader-name="ext-demo"/> <inline-jdbc jdbc-driver="com.mysql.jdbc.Driver" jdbc-uri="jdbc:mysql://192.168.163.128/ofbiz?autoReconnect=true&characterEncoding=UTF-8" jdbc-username="ofbiz" jdbc-password="ofbiz" isolation-level="ReadCommitted" pool-minsize="2" pool-maxsize="250" time-between-eviction-runs-millis="600000"/><!-- Please note that at least one person has experienced a problem with this value with MySQL and had to set it to -1 in order to avoid this issue. For more look at http://markmail.org/thread/5sivpykv7xkl66px and http://commons.apache.org/dbcp/configuration.html--> <!-- <jndi-jdbc jndi-server-name="localjndi" jndi-name="java:/MySqlDataSource" isolation-level="Serializable"/> --> </datasource> "%JAVA_HOME%\bin\java" -jar framework/base/lib/ant-1.9.0-ant-launcher.jar -lib framework/base/lib/ant %1 %2 %3 %4 %5 %6 -->改ant.bat启动参数 "%JAVA_HOME%\bin\java" -Xms128M -Xmx512M -XX:MaxPermSize=128m -Dfile.encoding=UTF-8 -jar framework/base/lib/ant-1.9.0-ant-launcher.jar -lib framework/base/lib/ant %1 %2 %3 %4 %5 %6

    配置好这些就可以做初步的尝试了 ant load-demo

    但是要注意看上面这个时间太短了,仔细看一下过程,可能已经抛出异常了 Caused by: org.ofbiz.entity.GenericEntityException: org.ofbiz.entity.GenericEntityException: Cached loader got a known bad class name: com.mysql.jdbc.Driver (Cached loader got a known bad class name: com.mysql.jdbc.Driver) (Cached loader got a known bad class name: com.mysql.jdbc.Driver (Cached loader got a known bad class name: com.mysql.jdbc.Driver)) 解决:更新JDBC驱动,将mysql的jdbc驱动拷贝到${Ofbiz_Home}/framework/entity/lib/jdbc 目录下。

    -下载地址:http://dev.mysql.com/downloads/connector/j/

    ant start

    完美—-修改公司名称 中文乱码问题也已经解决 如果在页面出现500 visitor 错误,数据库配置问题。检查配置文件是否正确。

    Markdown及扩展

    ofbiz —— [ 维基百科 ]

    转载请注明原文地址: https://ju.6miu.com/read-1122770.html

    最新回复(0)