It seems mysql jdbc diver is missing , you need to place mysql jdbc driver at location "framework/entity/lib/jdbc/“ for this simply run following ant target it will download mysql jar and put to to right place: {code} ./ant download-mySQL-JDBC {code}
Thanks & Regards — Deepak Dixit > On Dec 17, 2014, at 4:50 PM, i...@agentur-m3.de wrote: > > Thank you Youssef! > > now I understood that the delegator name ="default" > together with the group statements > should cause ofbiz to read of the records > of the external database (what is exactly > what I want to achieve). > > With the new datasource definition now there are still (and also some > new) error messages concerning the database driver and about the > connection to the external database: > > at java.lang.Thread.run(Thread.java:745) [?:1.7.0_65] > 20141217120652329 |OFBiz-config-0 |DatabaseUtil |E| Unable > to establish a connection with the database for helperName [platfo]... > Error was: org.ofbiz.entity.GenericEntityException: > com.mysql.jdbc.Driver (com.mysql.jdbc.Driver) > 20141217120652329 |OFBiz-config-0 |DatabaseUtil |E| Unable > to establish a connection with the database, no additional information > available. > 20141217120652329 |OFBiz-config-0 |DatabaseUtil |E| Could > not get table name information from the database, aborting. > 20141217120652329 |OFBiz-config-2 |BCPConnectionFactory|E| null > java.lang.ClassNotFoundException: Cached loader got a known bad class > name: com.mysql.jdbc.Driver > at > org.ofbiz.base.util.CachedClassLoader.loadClass(CachedClassLoader.java:182) > ~[ofbiz-base.jar:?] > at > org.ofbiz.base.util.CachedClassLoader.loadClass(CachedClassLoader.java:162) > ~[ofbiz-base.jar:?] > at java.lang.Class.forName0(Native Method) ~[?:1.7.0_65] > at java.lang.Class.forName(Class.java:274) ~[?:1.7.0_65] > at > org.ofbiz.entity.connection.DBCPConnectionFactory.getConnection(DBCPConnectionFactory.java:87) > [ofbiz-entity-test.jar:?] > at > org.ofbiz.entity.jdbc.ConnectionFactory.getManagedConnection(ConnectionFactory.java:121) > [ofbiz-entity-test.jar:?] > at > org.ofbiz.geronimo.GeronimoTransactionFactory.getConnection(GeronimoTransactionFactory.java:83) > [ofbiz-geronimo.jar:?] > at > org.ofbiz.entity.transaction.TransactionFactory.getConnection(TransactionFactory.java:82) > [ofbiz-entity-test.jar:?] > at > org.ofbiz.entity.jdbc.ConnectionFactory.getConnection(ConnectionFactory.java:97) > [ofbiz-entity-test.jar:?] > at > org.ofbiz.entity.jdbc.DatabaseUtil.getConnection(DatabaseUtil.java:135) > [ofbiz-entity-test.jar:?] > at > org.ofbiz.entity.jdbc.DatabaseUtil.getConnectionLogged(DatabaseUtil.java:155) > [ofbiz-entity-test.jar:?] > at > org.ofbiz.entity.jdbc.DatabaseUtil.getTableNames(DatabaseUtil.java:977) > [ofbiz-entity-test.jar:?] > at org.ofbiz.entity.jdbc.DatabaseUtil.checkDb(DatabaseUtil.java:189) > [ofbiz-entity-test.jar:?] > at org.ofbiz.entity.jdbc.DatabaseUtil.checkDb(DatabaseUtil.java:178) > [ofbiz-entity-test.jar:?] > at org.ofbiz.entity.datasource.GenericDAO.checkDb(GenericDAO.java:1234) > [ofbiz-entity-test.jar:?] > at > org.ofbiz.entity.datasource.GenericHelperDAO.checkDataSource(GenericHelperDAO.java:200) > [ofbiz-entity-test.jar:?] > at > org.ofbiz.entity.GenericDelegator.initializeOneGenericHelper(GenericDelegator.java:286) > [ofbiz-entity-test.jar:?] > at > org.ofbiz.entity.GenericDelegator.access$000(GenericDelegator.java:87) > [ofbiz-entity-test.jar:?] > at org.ofbiz.entity.GenericDelegator$1.call(GenericDelegator.java:297) > [ofbiz-entity-test.jar:?] > at org.ofbiz.entity.GenericDelegator$1.call(GenericDelegator.java:295) > [ofbiz-entity-test.jar:?] > at java.util.concurrent.FutureTask.run(FutureTask.java:262) [?:1.7.0_65] > at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) > [?:1.7.0_65] > at > java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) > [?:1.7.0_65] > at > java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) > [?:1.7.0_65] > at > java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) > [?:1.7.0_65] > at java.lang.Thread.run(Thread.java:745) [?:1.7.0_65] > eadPoolExecutor.java:615) [?:1.7.0_65] > at java.lang.Thread.run(Thread.java:745) [?:1.7.0_65] > > -------------------------------------------------------------------------------- > > My changeddatasource definition: > <datasource name="platfo" > > 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"/> > <read-data reader-name="main"/> > <inline-jdbc > jdbc-driver="com.mysql.jdbc.Driver" > jdbc-uri="jdbc:mysql://127.0.0.1:3306/wp_platfo" > jdbc-username="test" > jdbc-password="test" > isolation-level="ReadCommitted" > pool-minsize="2" > pool-maxsize="250" > time-between-eviction-runs-millis="600000" /> > </datasource> > > > and delegator: > > > <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="platfo"/> > <group-map group-name="org.ofbiz.olap" > datasource-name="platfo"/> > <group-map group-name="org.ofbiz.tenant" > datasource-name="platfo"/> > </delegator> > > > > Thanks again! > > > > Am 12.12.2014 um 17:46 schrieb Youssef Khaye: >> I will try to answer, even if i don't understand your use case at 100% >> >> Hi for your second question the answer is no. >> >> For your first question you should show us your entityengine.xml >> There is two different cases where you can use a second database. >> >> >> Case 1 use a diffrent delegator (from your first post, i think that you >> fill in this case), to get record you should instanciate >> >> a delegator using the name you declared in entityegine.xml >> <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="localpostgres"/> >> <group-map group-name="org.ofbiz.olap" >> datasource-name="localpostgres"/> >> <group-map group-name="org.ofbiz.tenant" >> datasource-name="localpostgres"/> >> </delegator> >> >> <delegator name="mysqlDb" entity-model-reader="main" >> entity-group-reader="main" entity-eca-reader="main" >> distributed-cache-clear-enabled="false"> >> <group-map group-name="com.custom datasource-name="sqlDataSource"/> >> </delegator> >> >> then in your service >> delegator = delagtor.geInstance("mysqlDb") >> then use the entity API to get record from your DB. >> >> >> Case 2 >> In the same delegator you may assign a diffrent dataSource, that point >> to the external DB, to a given package. >> >> <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="localpostgres"/> >> <group-map group-name="com.custom datasource-name="sqlDataSource"/> >> <group-map group-name="org.ofbiz.olap" >> datasource-name="localpostgres"/> >> <group-map group-name="org.ofbiz.tenant" >> datasource-name="localpostgres"/> >> </delegator> >> In this case the defeault delegator you get in a service can fetch >> record from any entity in the com.custom package. >> >> Personnaly, I use the first one if I need the external database in >> limited area of my OFBiz. >> >> The second one is suitable if you need to access your external db in >> many areas of your OFBiz >> >> >> Le 12/12/2014 09:03, i...@agentur-m3.de a écrit : >>> Hi All! >>> >>> after setting up the connection with an external database >>> without errors I have two more questions, on which I >>> could not find some specific information: >>> >>> (1) after setting up an entity, a delegator and >>> I datasource, which seem to work together now, >>> how (or where?) is the exchange of RECORDS with the >>> external database? ofbiz does not seem to >>> automatically detect and show the records from the >>> mysql-database. >>> Maybe my entity definitions are still wrong, >>> but then without error messages. >>> However: no records are imported or displayed >>> in the view. So: how can I get them from the mysql-database? >>> >>> Also unexpected to me: when I create new records in ofbiz, >>> they are displayed in ofbiz after creation (as one would >>> expect for any regular entity) but they are not transferred to >>> to the external mysql-database (which I guess could be >>> the purpose of a entity with associated externally >>> referenced datasource). >>> >>> So it seems that ofbiz did recognize the structure of >>> the external mysql-database, but then ignores to >>> exchange the data between ofbiz and the database. >>> >>> So how does ofbiz exchange records between >>> ofbiz and the external database (in a synchronized way)? >>> >>> Is there further setup or custom implmentation necessary? >>> >>> (2) the setup of a datasource is placed in entityengine.xml >>> in the framework/entity/config folder. >>> Is there a way to extend it with entries >>> defined in hot-deploy/.../entitydef/config/entityengine.xml ? >>> >>> I tried to setup another entityengine.xml there, >>> but this approach seemed to be ignored by ofbiz. >>> >>> >>> Thank you! >>> >>> >>> >>> >>> >>> >>> >>> >>> >> >> >
smime.p7s
Description: S/MIME cryptographic signature