openmeetings-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitry Zamula <club.brant...@gmail.com>
Subject Re: Fix build process bug
Date Wed, 18 Apr 2012 09:30:22 GMT
Command-line version of MappingTool did not give an answers. In digging the
source code, I found that, in any case, AntClassLoader. Bearing in mind
that change a property "openjpa.ConnectionDriverName" from
"org.apache.commons.dbcp.BasicDataSource" to "com.mysql.jdbc.Driver" helps,
I came to the conclusion that the problem is not in classcoader, and to use
the driver.
I asked this situation in OpenJPA mailing list, but not yet received a
reply (unfortunately, the discussion on the OpenJPA mailing list are not so
rapidly as in Openmeetings).

I have not quite elegant solution to this problem. I could use ant-task
"ReplaceRegExp" and write a regexp, which changes the line
org.apache.commons.dbcp.BasicDataSource on the right driver (from
openjpa.ConnectionProperties), and at the end of the ant-target, gets all
it was.
Despite the "ugliness" of the decision, I would still finish the task, and
put a patch that is required to participate in GSoC.

2012/4/15 Maxim Solodovnik <solomax666@gmail.com>

> 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" <club.brantner@gmail.com> 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 <solomax666@gmail.com>
> >
> > > 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 <club.brantner@gmail.com>
> > >
> > > > 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 <solomax666@gmail.com>
> > > >
> > > > > I'll try to read documentation regarding this task later today,
> never
> > > use
> > > > > it before
> > > > > On Apr 13, 2012 3:02 PM, "Dmitry Zamula" <club.brantner@gmail.com>
> > > > 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 <solomax666@gmail.com>
> > > > > >
> > > > > > > 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" <
> > club.brantner@gmail.com
> > > >
> > > > > > 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
> > >
> >
> >
> >
> > --
> > _________________________________________________________
> >
> > С уважением,
> >
> > Замула Дмитрий
> >
>



-- 
_________________________________________________________

С уважением,

Замула Дмитрий

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message