我正在使用Apache-ofbiz-13.07.03.I构建项目 ant .I用mysql.When修改数据库,我想加载种子/演示数据或蚂蚁开始,日志显示错误。
*我使用mysql-连接器-java-5.1.40-bin.jar进行jdbc连接
Java2017-02-20 00:59:44,209μ-OFBiz-config-2\GenericDelegator_i\x--默认“初始化实体组”"org.ofbiz“的助手"localmysql”。Java2017-02-20 00:59:44,209 OFBiz-配置-2 GenericDelegator/I按entityengine.xml请求进行数据库检查,addMissing=true 2017-02-20 00:59:48,496 OFBiz-config-2 helperName DatabaseUtil-2 helperName localmysql数据库连接错误是: java.sql.SQLException:无法从池java 2017-02-20 00获得新连接:59:52,572 entity : org.ofbiz.entity.GenericDataSourceException: deleteByCondition的removeByCondition操作失败(无法与数据库建立连接)。(无法从池中获取新连接)。回滚交易。org.ofbiz.entity.GenericDataSourceException:在deleteByCondition中发生了泛型实体异常(无法建立与数据库的连接)。(无法从池中获取新连接)) org.ofbiz.entity.datasource.GenericDAO.deleteByCondition(GenericDAO.java:1202) ~ofbiz上的java -实体-test.jar:?
22由以下原因引起的java : com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964):拒绝用户'ofbiz'@'10.0.31.110‘(使用密码:是) java在com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3970) ~mysql-连接器- java -5.1.40-bin.jar:5.1.40在com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3970)~mysql-连接器-java-5.1.40-bincom.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3906) ~mysql-连接器-java-5.1.40-bin.jar:5.1.40在com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:873) ~mysql-连接器-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&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>发布于 2017-02-22 12:25:43
最后,我能够找到我的问题,我能够解决我的问题。
jdbc-uri="jdbc:mysql://localhost/ofbiz?autoReconnect=true&characterEncoding=UTF-8"这都是关于这条线的。每当我创建数据库模式时,我都会将默认字符集设置为其他格式的,而不是UTF-8。
现在我可以连接我的数据库了。非常感谢大家
发布于 2017-02-21 11:29:27
请检查entityengine.xml是否配置正确。你可以在-
/framework/entity/config/演奏会.
确保你遵循了以下步骤-
在数据源localmysql中,localmysqlolap,localmysqltenant更改以下属性:
jdbc-用户名=“您的mysql用户名” jdbc-密码=“您的mysql用户密码”
希望这能帮到(Y)
https://stackoverflow.com/questions/42328194
复制相似问题