1

I am using Apache-ofbiz-13.07.03.I build project with ant.I changed database with mysql.When I want to load seed/demo data or ant start,log shows error.

*** I am using mysql-connector-java-5.1.40-bin.jar for jdbc connection

 [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 more [java] Caused by: java.sql.SQLException: Access denied for user 'ofbiz'@'10.0.31.110' (using password: YES) [java] at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964) ~[mysql-connector-java-5.1.40-bin.jar:5.1.40] [java] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3970) ~[mysql-connector-java-5.1.40-bin.jar:5.1.40] [java] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3906) ~[mysql-connector-java-5.1.40-bin.jar:5.1.40] [java] at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:873) ~[mysql-connector-java-5.1.40-bin.jar:5.1.40]

my entityengin.xm is like

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

And my localmysql section

where my server ip is 10.0.31.8

I want to share that I can successfully run this project in my local machine without having any problem

<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>
naib khan
  • 928
  • 9
  • 16
  • 1
    Please check your database user and permission settings. The user ofbiz is not allowed to access you database from IP 10.0.31.110 as you can see from the errors. For further investigation, please provide your relevant entityengine.xml settings. – Michael Brohl Feb 19 '17 at 21:09
  • @MichaelBrohl I have add my entityengin.xml code in the last section of my code... I can login to my mysql databse throug '**username :ofbiz and pass :ofbiz** through command window as I give ofbiz grant all permission.. Thank you so much – naib khan Feb 20 '17 at 04:29
  • Possible duplicate of [Java JDBC Access denied for user](http://stackoverflow.com/questions/8224898/java-jdbc-access-denied-for-user) – Mark Rotteveel Feb 20 '17 at 15:57
  • no [link](http://stackoverflow.com/questions/8224898/java-jdbc-access-denied-for-user) does not solve my problem @MarkRotteveel – naib khan Feb 22 '17 at 12:10
  • This basically means that OFBiz can't talk to the database. If you're using an older version of OFBiz this may be due to an issue with the connection pool and the best fix is to restart OFBiz every so often. If this always happening then it may be a configuration issue where the database isn't setup right. If it was working and just started happening, try restarting OFBiz and the database (make sure the database is up before starting OFBiz). – Nitesh Goyal Feb 22 '17 at 12:39

3 Answers3

1

Please check if the entityengine.xml is configured correctly. You can find the file at -

/framework/entity/config/entityengine.xml

Make sure you have followed the following steps -

  1. Create databases name ofbiz,ofbizolap and ofbiztenant in mysql.
  2. Go to framework/entity/config/entityengine.xml and change this as below.

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

and in datasource localmysql,localmysqlolap,localmysqltenant change the bellow attributes:

jdbc-username="your mysql username"

jdbc-password="your mysql user password"

Hope this may help (Y)

Nitesh Goyal
  • 586
  • 5
  • 11
  • jdbc-username and password is correct.I have checked so many times about this username and password. thank you so much @Nitesh – naib khan Feb 22 '17 at 12:17
  • This basically means that OFBiz can't talk to the database. If you're using an older version of OFBiz this may be due to an issue with the connection pool and the best fix is to restart OFBiz every so often. If this always happening then it may be a configuration issue where the database isn't setup right. If it was working and just started happening, try restarting OFBiz and the database (make sure the database is up before starting OFBiz). – Nitesh Goyal Feb 22 '17 at 12:38
1

Finally I am able to find out my problem and I am able to solve my problem.

jdbc-uri="jdbc:mysql://localhost/ofbiz?autoReconnect=true&amp;characterEncoding=UTF-8"

this is all about this line. Whenever I created my database schema I have set default character set to other format rather than UTF-8

now I am able to connect my database. Thanks a lot all of you

naib khan
  • 928
  • 9
  • 16
0

jdbc-uri="jdbc:mysql://ServerIp/ofbiz?autoReconnect=true&amp;characterEncoding=UTF-8&amp;useSSL=false"

mysql conntector is 8.0.11 I set useSSL=false and it works

Nick John
  • 1
  • 1
  • Hi, how is this different in comparison with the accepted answer? [How to give a good answer](https://stackoverflow.com/help/how-to-answer) – Martin54 Feb 11 '23 at 18:02