I also think so. According to the Google and MappingTool sources it's using some non standard classloader. I tried to bypass it, but wasn't succeed (need more time).
Maybe running command -line version of MappingTool can give more information? On Apr 15, 2012 1:48 AM, "Dmitry Zamula" <[email protected]> wrote: > The problem was in persistent.xml (I tested only with mysql). First of all, > there was no <property name="openjpa.ConnectionURL" value="..."/> (url was > inside the property name = "openjpa.ConnectionProperties"). > But the main problem - MappingToolTask can not use a connection from pool. > With <property name="openjpa.ConnectionDriverName" > value="com.mysql.jdbc.Driver"/> it works, but value = > "org.apache.commons.dbcp.BasicDataSource" does not work. Classpath contains > all required libraries. > I think this is a bug in openjpa. > > 2012/4/14 Maxim Solodovnik <[email protected]> > > > OK > > tried that. > > > > We are using openjpa 2.2.0 > > Here is documentation from it: > > > > > http://openjpa.apache.org/builds/2.2.0/apache-openjpa/docs/ref_guide_integration.html#ref_guide_integration_mappingtool > > > > I slightly modified your code and was able to reproduce your result: > > A connection could not be obtained for driver class > > "org.apache.commons.dbcp.BasicDataSource" and URL "null". > > > > But > > according to my stacktace to lowest exception is: > > Caused by: java.lang.IllegalArgumentException: > > java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource > > at serp.util.Strings.toClass(Strings.java:164) > > at serp.util.Strings.toClass(Strings.java:108) > > at > > > > > org.apache.openjpa.lib.conf.Configurations.newInstance(Configurations.java:211) > > at > > > > > org.apache.openjpa.lib.conf.Configurations.newInstance(Configurations.java:170) > > at > > > > > org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:114) > > > > > > This means there is something wrong with MappingTool > classpath/classloader > > > > Unfortunately I have no time right now to dig this. > > Currently I simply drop database before running install. > > > > please NOTE it is not necessary to run install every time you rebuild OM, > > it works as expected without reinstalling. (the only exception is > changing > > primary key on table, which is not often) > > > > 2012/4/13 Dmitry Zamula <[email protected]> > > > > > Ok, thank you. I used this documentation, and may be it will be > > interesting > > > to you: > > > > > > > > > http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manual/ref_guide_mapping.html#ref_guide_mapping_mappingtool > > > > > > 2012/4/13 Maxim Solodovnik <[email protected]> > > > > > > > I'll try to read documentation regarding this task later today, never > > use > > > > it before > > > > On Apr 13, 2012 3:02 PM, "Dmitry Zamula" <[email protected]> > > > wrote: > > > > > > > > > Yes, but now in ${dist.persistence.dir} I already have a > > > persistence.xml. > > > > > And MappingToolTask does not see it. > > > > > > > > > > 2012/4/13 Maxim Solodovnik <[email protected]> > > > > > > > > > > > Persistence.xml is copied to its location by one of the ant > tasks. > > > You > > > > > need > > > > > > to add dependency to this task (have no sources right now, can > tell > > > > exact > > > > > > task name later today) > > > > > > On Apr 13, 2012 2:23 PM, "Dmitry Zamula" < > [email protected] > > > > > > > > wrote: > > > > > > > > > > > > > Hello! > > > > > > > > > > > > > > I want to fix bug - after a few builds of the system, there is > a > > > > > > > duplicate information in database(in particular, this affects > the > > > > > > interface > > > > > > > - double buttons, menus, etc.). I wrote new target in > build.xml: > > > > > > > > > > > > > > <target name="refresh"> > > > > > > > <taskdef name="tablerefresh" > > > > > > > classname="org.apache.openjpa.jdbc.ant.MappingToolTask"> > > > > > > > <classpath refid="jpa.enhancement.classpath" /> > > > > > > > </taskdef> > > > > > > > <tablerefresh schemaAction="refresh"> > > > > > > > <config > > > propertiesFile="${dist.persistence.dir}/persistence.xml" > > > > > /> > > > > > > > </tablerefresh> > > > > > > > <echo message="Table refreshing complete." /> > > > > > > > </target> > > > > > > > > > > > > > > But, MappingToolTask cant find persistence.xml (Error: A > > connection > > > > > could > > > > > > > not be obtained for driver class > > > > > > "org.apache.commons.dbcp.BasicDataSource" > > > > > > > and URL "null"). > > > > > > > Does anyone have any ideas why this is happening? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > _________________________________________________________ > > > > > > > > > > С уважением, > > > > > > > > > > Замула Дмитрий > > > > > > > > > > > > > > > > > > > > > -- > > > _________________________________________________________ > > > > > > С уважением, > > > > > > Замула Дмитрий > > > > > > > > > > > -- > > WBR > > Maxim aka solomax > > > > > > -- > _________________________________________________________ > > С уважением, > > Замула Дмитрий >
