Hi All,
trying to define an external datasource and to connect to the external mysql-database, ofbiz states a "null-pointer exception". Here is the datasource, which I appended into framework/entity/config/entityengine.xml: <datasource name="test_mysql" 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="main"/> <inline-jdbc jdbc-driver="com.mysql.jdbc.Driver" jdbc-uri="jdbc:mysql://localhost/wp_platfo" jdbc-username="root" jdbc-password="" isolation-level="ReadCommitted" pool-minsize="2" pool-maxsize="250" time-between-eviction-runs-millis="600000"/> </datasource> Calling https://localhost:8443/webtools/control/view/ModelInduceFromDb with test_mysql as paramenter the server returns a "java.lang.NullPointerException". In ofbiz.log I found this lines: 20141203140027648 |-0.0.0.0-8443-exec-3 |DatabaseUtil |E| Unable to establish a connection with the database for helperName [test_mysql]... Error was: org.ofbiz.entity.GenericEntityException: com.mysql.jdbc.Driver (com.mysql.jdbc.Driver) 20141203140027648 |-0.0.0.0-8443-exec-3 |DatabaseUtil |E| Unable to establish a connection with the database, no additional information available. 20141203140027650 |-0.0.0.0-8443-exec-3 |JspViewHandler |E| ServletException rendering JSP view Otherwise a simple java demo like this: Class.forName("com.mysql.jdbc.Driver"); String host = "localhost"; String user = "root"; String pass = ""; String db = "wp_platfo"; String conString = "jdbc:mysql://" + host + "/" + db + ""; Connection con = DriverManager.getConnection(conString, user, pass); System.out.println("conString: " + conString); connects without problems (I simply copied the conString into the ofbiz-engines jdbc-uri field, so this should work!?). Why could the connection fail? Thank you! |
Are you using the proper mysql port# ?
|
In reply to this post by info@agentur-m3.de
Hello,
You try with "jdbc-password" attribute is not null. On Wed, Dec 3, 2014 at 8:21 PM, [hidden email] <[hidden email]> wrote: > Hi All, > > trying to define an external datasource > and to connect to the external mysql-database, > ofbiz states a "null-pointer exception". > > Here is the datasource, which I appended into > framework/entity/config/entityengine.xml: > > <datasource name="test_mysql" > 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="main"/> > <inline-jdbc > jdbc-driver="com.mysql.jdbc.Driver" > jdbc-uri="jdbc:mysql://localhost/wp_platfo" > jdbc-username="root" > jdbc-password="" > isolation-level="ReadCommitted" > pool-minsize="2" > pool-maxsize="250" > time-between-eviction-runs-millis="600000"/> > </datasource> > > Calling https://localhost:8443/webtools/control/view/ModelInduceFromDb > with test_mysql as paramenter > > the server returns a "java.lang.NullPointerException". > > In ofbiz.log I found this lines: > > 20141203140027648 |-0.0.0.0-8443-exec-3 |DatabaseUtil |E| Unable > to establish a connection with the database for helperName > [test_mysql]... Error was: org.ofbiz.entity.GenericEntityException: > com.mysql.jdbc.Driver (com.mysql.jdbc.Driver) > 20141203140027648 |-0.0.0.0-8443-exec-3 |DatabaseUtil |E| Unable > to establish a connection with the database, no additional information > available. > 20141203140027650 |-0.0.0.0-8443-exec-3 |JspViewHandler |E| > ServletException rendering JSP view > > > Otherwise a simple java demo like this: > > Class.forName("com.mysql.jdbc.Driver"); > String host = "localhost"; > String user = "root"; > String pass = ""; > String db = "wp_platfo"; > String conString = "jdbc:mysql://" + host + "/" + > db + ""; > Connection con = > DriverManager.getConnection(conString, user, pass); > > System.out.println("conString: " + conString); > > connects without problems (I simply copied the conString into the > ofbiz-engines jdbc-uri field, so this should work!?). > > Why could the connection fail? > > Thank you! > > > > > > > > > -- *THINH CHU THI (Ms)* *Developer**Email:* [hidden email] | *Mobile:* (+84) 989 466 070 *OLBIUS., JSC* *Tel:* (+84) 9 88 99 3333 *Address:* Room 2508, M3-M4 building, No 91, Nguyen Chi Thanh St., Ha Noi City, Viet Nam *Website:* http://olbius.vn |
In reply to this post by info@agentur-m3.de
You should have to set password for mysql user, empty password does not
work, please refer EntityConfigUtil.getJdbcPassword() Thanks & Regards -- Deepak Dixit www.hotwaxmedia.com On Wed, Dec 3, 2014 at 6:51 PM, [hidden email] <[hidden email]> wrote: > Hi All, > > trying to define an external datasource > and to connect to the external mysql-database, > ofbiz states a "null-pointer exception". > > Here is the datasource, which I appended into > framework/entity/config/entityengine.xml: > > <datasource name="test_mysql" > 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="main"/> > <inline-jdbc > jdbc-driver="com.mysql.jdbc.Driver" > jdbc-uri="jdbc:mysql://localhost/wp_platfo" > jdbc-username="root" > jdbc-password="" > isolation-level="ReadCommitted" > pool-minsize="2" > pool-maxsize="250" > time-between-eviction-runs-millis="600000"/> > </datasource> > > Calling https://localhost:8443/webtools/control/view/ModelInduceFromDb > with test_mysql as paramenter > > the server returns a "java.lang.NullPointerException". > > In ofbiz.log I found this lines: > > 20141203140027648 |-0.0.0.0-8443-exec-3 |DatabaseUtil |E| Unable > to establish a connection with the database for helperName > [test_mysql]... Error was: org.ofbiz.entity.GenericEntityException: > com.mysql.jdbc.Driver (com.mysql.jdbc.Driver) > 20141203140027648 |-0.0.0.0-8443-exec-3 |DatabaseUtil |E| Unable > to establish a connection with the database, no additional information > available. > 20141203140027650 |-0.0.0.0-8443-exec-3 |JspViewHandler |E| > ServletException rendering JSP view > > > Otherwise a simple java demo like this: > > Class.forName("com.mysql.jdbc.Driver"); > String host = "localhost"; > String user = "root"; > String pass = ""; > String db = "wp_platfo"; > String conString = "jdbc:mysql://" + host + "/" + > db + ""; > Connection con = > DriverManager.getConnection(conString, user, pass); > > System.out.println("conString: " + conString); > > connects without problems (I simply copied the conString into the > ofbiz-engines jdbc-uri field, so this should work!?). > > Why could the connection fail? > > Thank you! > > > > > > > > > |
In reply to this post by Thinh CHU THI
Did you also create a delegator for the "test_mysql" datasource?
<delegator name="test_mysql" 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="test_mysql"/> </delegator> <datasource name="test_mysql" 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/wp_platfo?autoReconnect=true" jdbc-username="root" jdbc-password="root" isolation-level="ReadCommitted" pool-minsize="2" pool-maxsize="250" time-between-eviction-runs-millis="600000 </datasource> Regards Len -----Original Message----- From: Thinh CHU THI [mailto:[hidden email]] Sent: Wednesday, December 03, 2014 8:56 PM To: [hidden email] Subject: Re: null pointer from external mysql datasource connection Hello, You try with "jdbc-password" attribute is not null. On Wed, Dec 3, 2014 at 8:21 PM, [hidden email] <[hidden email]> wrote: > Hi All, > > trying to define an external datasource > and to connect to the external mysql-database, > ofbiz states a "null-pointer exception". > > Here is the datasource, which I appended into > framework/entity/config/entityengine.xml: > > <datasource name="test_mysql" > 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="main"/> > <inline-jdbc > jdbc-driver="com.mysql.jdbc.Driver" > jdbc-uri="jdbc:mysql://localhost/wp_platfo" > jdbc-username="root" > jdbc-password="" > isolation-level="ReadCommitted" > pool-minsize="2" > pool-maxsize="250" > time-between-eviction-runs-millis="600000"/> > </datasource> > > Calling https://localhost:8443/webtools/control/view/ModelInduceFromDb > with test_mysql as paramenter > > the server returns a "java.lang.NullPointerException". > > In ofbiz.log I found this lines: > > 20141203140027648 |-0.0.0.0-8443-exec-3 |DatabaseUtil |E| Unable > to establish a connection with the database for helperName > [test_mysql]... Error was: org.ofbiz.entity.GenericEntityException: > com.mysql.jdbc.Driver (com.mysql.jdbc.Driver) > 20141203140027648 |-0.0.0.0-8443-exec-3 |DatabaseUtil |E| Unable > to establish a connection with the database, no additional information > available. > 20141203140027650 |-0.0.0.0-8443-exec-3 |JspViewHandler |E| > ServletException rendering JSP view > > > Otherwise a simple java demo like this: > > Class.forName("com.mysql.jdbc.Driver"); > String host = "localhost"; > String user = "root"; > String pass = ""; > String db = "wp_platfo"; > String conString = "jdbc:mysql://" + host + "/" + > db + ""; > Connection con = > DriverManager.getConnection(conString, user, pass); > > System.out.println("conString: " + conString); > > connects without problems (I simply copied the conString into the > ofbiz-engines jdbc-uri field, so this should work!?). > > Why could the connection fail? > > Thank you! > > > > > > > > > -- *THINH CHU THI (Ms)* *Developer**Email:* [hidden email] | *Mobile:* (+84) 989 466 070 *OLBIUS., JSC* *Tel:* (+84) 9 88 99 3333 *Address:* Room 2508, M3-M4 building, No 91, Nguyen Chi Thanh St., Ha Noi City, Viet Nam *Website:* http://olbius.vn |
Yes! Have you done it yet?
On Thu, Dec 4, 2014 at 8:15 PM, Len Shein <[hidden email]> wrote: > Did you also create a delegator for the "test_mysql" datasource? > > > > <delegator name="test_mysql" 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="test_mysql"/> > > </delegator> > > > > <datasource name="test_mysql" > > 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/wp_platfo?autoReconnect=true" > > jdbc-username="root" > > jdbc-password="root" > > isolation-level="ReadCommitted" > > pool-minsize="2" > > pool-maxsize="250" > > time-between-eviction-runs-millis="600000 > > </datasource> > > > > Regards > > Len > > -----Original Message----- > From: Thinh CHU THI [mailto:[hidden email]] > Sent: Wednesday, December 03, 2014 8:56 PM > To: [hidden email] > Subject: Re: null pointer from external mysql datasource connection > > > > Hello, > > You try with "jdbc-password" attribute is not null. > > > > On Wed, Dec 3, 2014 at 8:21 PM, [hidden email] <[hidden email]> > > wrote: > > > > > Hi All, > > > > > > trying to define an external datasource > > > and to connect to the external mysql-database, > > > ofbiz states a "null-pointer exception". > > > > > > Here is the datasource, which I appended into > > > framework/entity/config/entityengine.xml: > > > > > > <datasource name="test_mysql" > > > 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="main"/> > > > <inline-jdbc > > > jdbc-driver="com.mysql.jdbc.Driver" > > > jdbc-uri="jdbc:mysql://localhost/wp_platfo" > > > jdbc-username="root" > > > jdbc-password="" > > > isolation-level="ReadCommitted" > > > pool-minsize="2" > > > pool-maxsize="250" > > > time-between-eviction-runs-millis="600000"/> > > > </datasource> > > > > > > Calling https://localhost:8443/webtools/control/view/ModelInduceFromDb > > > with test_mysql as paramenter > > > > > > the server returns a "java.lang.NullPointerException". > > > > > > In ofbiz.log I found this lines: > > > > > > 20141203140027648 |-0.0.0.0-8443-exec-3 |DatabaseUtil |E| Unable > > > to establish a connection with the database for helperName > > > [test_mysql]... Error was: org.ofbiz.entity.GenericEntityException: > > > com.mysql.jdbc.Driver (com.mysql.jdbc.Driver) > > > 20141203140027648 |-0.0.0.0-8443-exec-3 |DatabaseUtil |E| Unable > > > to establish a connection with the database, no additional information > > > available. > > > 20141203140027650 |-0.0.0.0-8443-exec-3 |JspViewHandler |E| > > > ServletException rendering JSP view > > > > > > > > > Otherwise a simple java demo like this: > > > > > > Class.forName("com.mysql.jdbc.Driver"); > > > String host = "localhost"; > > > String user = "root"; > > > String pass = ""; > > > String db = "wp_platfo"; > > > String conString = "jdbc:mysql://" + host + "/" + > > > db + ""; > > > Connection con = > > > DriverManager.getConnection(conString, user, pass); > > > > > > System.out.println("conString: " + conString); > > > > > > connects without problems (I simply copied the conString into the > > > ofbiz-engines jdbc-uri field, so this should work!?). > > > > > > Why could the connection fail? > > > > > > Thank you! > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > *THINH CHU THI (Ms)* > > > > *Developer**Email:* [hidden email] | *Mobile:* (+84) 989 466 070 > > > > *OLBIUS., JSC* > > *Tel:* (+84) 9 88 99 3333 > > *Address:* Room 2508, M3-M4 building, No 91, Nguyen Chi Thanh St., Ha Noi > > City, Viet Nam > > *Website:* http://olbius.vn > > -- *THINH CHU THI (Ms)* *Developer**Email:* [hidden email] | *Mobile:* (+84) 989 466 070 *OLBIUS., JSC* *Tel:* (+84) 9 88 99 3333 *Address:* Room 2508, M3-M4 building, No 91, Nguyen Chi Thanh St., Ha Noi City, Viet Nam *Website:* http://olbius.vn |
Free forum by Nabble | Edit this page |