【问题标题】:Migrating Apache OFBiz from Derby to MySQL将 Apache OFBiz 从 Derby 迁移到 MySQL
【发布时间】:2017-04-18 20:25:19
【问题描述】:

我尝试使用 this tutorial 将 Apache OFBiz 从 derby 迁移到 mysql。在对entityengine.xml 进行更改之前,我使用defaultData 执行了ofbiz,并将数据从webtools 导出到xml 文件中。之后,我进行了所有上述更改,创建了工作数据库模式和用户。但是当我在这些更改之后运行 ofbiz 时,我收到一条异常消息

`invalid delegator name!`

这是为什么呢?我目前正在使用 16.011 版本的 OFBiz。下面是我的委托人和数据源的样子

<datasource name="localmysql"
            helper-class="org.apache.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="latin1"
            collate="latin1_general_cs">
        <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://127.0.0.1/ofbiz?autoReconnect=true"
                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>
    <datasource name="localmysqlolap"
            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="latin1"
            collate="latin1_general_cs">
        <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://127.0.0.1/ofbiz?autoReconnect=true"
                jdbc-username="ofbizolap"
                jdbc-password="ofbizolap"
                isolation-level="ReadCommitted"
                pool-minsize="2"
                pool-maxsize="250"
                time-between-eviction-runs-millis="600000"/>
    </datasource>

    <datasource name="localmysqltenant"
            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="latin1"
            collate="latin1_general_cs">
        <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://127.0.0.1/ofbiz?autoReconnect=true"
                jdbc-username="ofbiztenant"
                jdbc-password="ofbiztenant"
                isolation-level="ReadCommitted"
                pool-minsize="2"
                pool-maxsize="250"
                time-between-eviction-runs-millis="600000"/>
    </datasource>

和委托人

<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="localmysqlolap"/>
        <group-map group-name="org.ofbiz.tenant" datasource-name="localmysqltenant"/>
    </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="localmysqlolap"/>
        <group-map group-name="org.ofbiz.tenant" datasource-name="localmysqltenant"/>
    </delegator>

    <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="localmysqlolap"/>
        <group-map group-name="org.ofbiz.tenant" datasource-name="localmysqltenant"/>
    </delegator>

【问题讨论】:

    标签: mysql derby ofbiz


    【解决方案1】:

    Apache OFBiz 包结构最近发生了变化,并且提到的教程不是完全最新的。我已经更改了“org.ofbiz”。 “org.apache.ofbiz”的条目。在教程中。

    如果现在一切正常,请再试一次并报告。

    【讨论】:

      【解决方案2】:

      (我使用的是OFBiz 16.11.02,目前是最新版本)

      为数据库创建用户:

      create database ofbiz;
      create database ofbizolap;
      create database ofbiztenant;
      use mysql;
      select database();
      create user ofbiz@localhost;
      create user ofbizolap@localhost;
      create user ofbiztenant@localhost;
      
      UPDATE mysql.user
          SET authentication_string = PASSWORD('ofbiz'), password_expired = 'N'
          WHERE User = 'ofbiz' AND Host = 'localhost';
      FLUSH PRIVILEGES;
      
      UPDATE mysql.user
          SET authentication_string = PASSWORD('ofbizolap'), password_expired = 'N'
          WHERE User = 'ofbizolap' AND Host = 'localhost';
      FLUSH PRIVILEGES;
      
      UPDATE mysql.user
          SET authentication_string = PASSWORD('ofbiztenant'), password_expired = 'N'
          WHERE User = 'ofbiztenant' AND Host = 'localhost';
      FLUSH PRIVILEGES;
      
      grant all privileges on *.* to 'ofbiz'@localhost identified by 'ofbiz';
      grant all privileges on *.* to 'ofbizolap'@localhost identified by 'ofbizolap';
      grant all privileges on *.* to 'ofbiztenant'@localhost identified by 'ofbiztenant';
      

      使用端口号,默认为3306

       jdbc-uri="jdbc:mysql://127.0.0.1:3306/ofbiz?autoReconnect=true"
      

      找词derby,改成mysql

      然后

      gradlew cleanAll --info
      gradlew loadDefault --info
      gradlew ofbiz --info
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-06-04
        • 1970-01-01
        • 1970-01-01
        • 2011-08-24
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多