gpt4 book ai didi

mysql - Ofbiz:无法与 helperName [localmysql] 的数据库建立连接

转载 作者:行者123 更新时间:2023-11-29 06:04:58 25 4
gpt4 key购买 nike

我正在使用 Apache-ofbiz-13.07.03。我用 ant 构建项目。我用 mysql 更改数据库。当我想加载种子/演示数据或ant 启动,日志显示错误。

*** 我正在使用 mysql-connector-java-5.1.40-bin.jar 进行 jdbc 连接

 [java] 2017-02-20 00:59:44,209 |OFBiz-config-2       |GenericDelegator              |I| Delegator "default" initializing helper "localmysql" for entity group "org.ofbiz".
[java] 2017-02-20 00:59:44,209 |OFBiz-config-2 |GenericDelegator |I| Doing database check as requested in entityengine.xml with addMissing=true
[java] 2017-02-20 00:59:48,496 |OFBiz-config-2 |DatabaseUtil |E| Unable to establish a connection with the database for helperName [localmysql]... Error was: java.sql.SQLException: Unable to acquire a new connection from the pool


[java] 2017-02-20 00:59:52,572 |main |GenericDelegator |E| Failure in removeByCondition operation for entity [ServiceSemaphore]: org.ofbiz.entity.GenericDataSourceException: Generic Entity Exception occured in deleteByCondition (Unable to esablish a connection with the database. (Unable to acquire a new connection from the pool)). Rolling back transaction.
[java] org.ofbiz.entity.GenericDataSourceException: Generic Entity Exception occured in deleteByCondition (Unable to esablish a connection with the database. (Unable to acquire a new connection from the pool))
[java] at org.ofbiz.entity.datasource.GenericDAO.deleteByCondition(GenericDAO.java:1202) ~[ofbiz-entity-test.jar:?]

[java] ... 还有 22 个 [java] Caused by: java.sql.SQLException: 拒绝用户'ofbiz'@'10.0.31.110'的访问(使用密码:YES) [java] 在 com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964) ~[mysql-connector-java-5.1.40-bin.jar:5.1.40] [java] 在 com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3970) ~[mysql-connector-java-5.1.40-bin.jar:5.1.40] [java] 在 com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3906) ~[mysql-connector-java-5.1.40-bin.jar:5.1.40] [java] 在 com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:873) ~[mysql-connector-java-5.1.40-bin.jar:5.1.40]

我的entityengin.xm就像

 <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>

还有我的localmysql部分

我的服务器 ip 是 10.0.31.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="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://10.0.31.8/ofbiz?autoReconnect=true&amp;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>

最佳答案

请检查entityengine.xml配置是否正确。您可以在 -

/framework/entity/config/entityengine.xml

确保您已遵循以下步骤 -

  1. 在 mysql 中创建数据库名称 ofbiz、ofbizolap 和 ofbiztenant。
  2. 转到 framework/entity/config/entityengine.xml 并将其更改如下。

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

并在数据源 localmysql、localmysqlolap、localmysqltenant 中更改以下属性:

jdbc-username="your mysql username"

jdbc-password="your mysql user password"

希望这会有所帮助(是)

关于mysql - Ofbiz:无法与 helperName [localmysql] 的数据库建立连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42328194/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com