Return-Path: X-Original-To: apmail-incubator-openmeetings-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-openmeetings-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E9C6F92F9 for ; Wed, 18 Apr 2012 16:40:16 +0000 (UTC) Received: (qmail 2587 invoked by uid 500); 18 Apr 2012 16:40:16 -0000 Delivered-To: apmail-incubator-openmeetings-dev-archive@incubator.apache.org Received: (qmail 2559 invoked by uid 500); 18 Apr 2012 16:40:16 -0000 Mailing-List: contact openmeetings-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: openmeetings-dev@incubator.apache.org Delivered-To: mailing list openmeetings-dev@incubator.apache.org Received: (qmail 2550 invoked by uid 99); 18 Apr 2012 16:40:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Apr 2012 16:40:16 +0000 X-ASF-Spam-Status: No, hits=2.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of solomax666@gmail.com designates 209.85.217.175 as permitted sender) Received: from [209.85.217.175] (HELO mail-lb0-f175.google.com) (209.85.217.175) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 18 Apr 2012 16:40:07 +0000 Received: by lbjn8 with SMTP id n8so2390699lbj.6 for ; Wed, 18 Apr 2012 09:39:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=crlq07JkfVQentkdhEO8bwfJowdI1MF+InM3q66uNt8=; b=vc70dHxQrKQFCPkiYeWsE9rO61oGc/XrfcWybJy+UcpCmPSTcmijXCYvQezLwiyblj NLFd+ckYUXKoMTml89p3869jhvnYIEmU4qEO8VfLdNm+cTOB+bt5zSibIueIK54AKV5/ QH04IjAGPBzMgEtHe0bhyZpUB7VqpTHKhNLArjGg06NjyebxW/jK7o8KP/0+gQDp8hVz wJRSi/GG8rESU1/ER+r0lWahDGJQrtLL1yQgFTviO9zDEa1jrM19z37tZPHYyK9sluBJ VAhhRykFlNZHsmk1ui1z0JIs4Fv77asIuwoHi/BEtbyZiZ8bYuyX9WayEkrMXHEEO25X HSbA== MIME-Version: 1.0 Received: by 10.152.106.44 with SMTP id gr12mr2693053lab.28.1334767187326; Wed, 18 Apr 2012 09:39:47 -0700 (PDT) Received: by 10.112.107.71 with HTTP; Wed, 18 Apr 2012 09:39:47 -0700 (PDT) Received: by 10.112.107.71 with HTTP; Wed, 18 Apr 2012 09:39:47 -0700 (PDT) In-Reply-To: References: Date: Wed, 18 Apr 2012 23:39:47 +0700 Message-ID: Subject: Re: Fix build process bug From: Maxim Solodovnik To: openmeetings-dev@incubator.apache.org Content-Type: multipart/alternative; boundary=f46d04088e5f0ef8d104bdf6b4c4 --f46d04088e5f0ef8d104bdf6b4c4 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I guess I'll better use "drop database", I don't really like regex in ant - maintenance will be not easy On Apr 18, 2012 11:33 PM, "Alexei Fedotov" wrote= : > Dmitry, would you please make a patch? > 18.04.2012 19:31 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82= =D0=B5=D0=BB=D1=8C "Dmitry Zamula" > =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB: > > > Here is my "ugly-solution": > > > > > > > classname=3D"org.apache.openjpa.jdbc.ant.MappingToolTask"> > > > > > > > > > > > > match=3D"(org.apache.commons.dbcp.BasicDataSource)([\s\S]*)(DriverClassNa= me=3D)([a-zA-Z.]*[^,\s]*)" > > replace=3D"\4\2\3\4"/> > > > > > > > > > > > > > match=3D"ConnectionDriverName" value=3D"[a-zA-Z.]*" > > replace=3D"ConnectionDriverName" > > value=3D"org.apache.commons.dbcp.BasicDataSource"/> > > > > > > > > I tested it, it works (drops all tables). Only in the case of oracle > > persistence.xml, it should add the line > "openjpa.ConnectionDriverName" ... > > > > 2012/4/18 Alexei Fedotov > > > > > Hello Dmitry, > > > > > > Answering questions sequentially, without paying attention to your > later > > > progress. Discard answers if they come late. > > > > > > Why ant cannot find file persistence.xml? > > > > > > Ant is controversal. IMHO. > > > > > > Some values are assigned dynamicly, others are pre-calculated before > the > > > build process starts. > > > > > > This includes file tree. Ant believes it could match most dependencie= s > > > including copied files before the build process starts. This does not > > live > > > well with most custom tasks (if they have side effects) and external > > tools > > > which copy or modify files. > > > > > > This also includes checking if the file located by tge path in the > > property > > > exists. > > > > > > This sometimes gives the problems you describe. > > > 18.04.2012 13:30 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1= =82=D0=B5=D0=BB=D1=8C "Dmitry Zamula" > > > > =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB: > > > > > > > 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, an= d > to > > > use > > > > the driver. > > > > I asked this situation in OpenJPA mailing list, but not yet receive= d > a > > > > reply (unfortunately, the discussion on the OpenJPA mailing list ar= e > > 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, ge= ts > > 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 > > > > > > > > > I also think so. > > > > > According to the Google and MappingTool sources it's using some n= on > > > > > 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" > > > > wrote: > > > > > > > > > > > The problem was in persistent.xml (I tested only with mysql). > First > > > of > > > > > all, > > > > > > there was no > > > (url > > > > > was > > > > > > inside the property name =3D "openjpa.ConnectionProperties"). > > > > > > But the main problem - MappingToolTask can not use a connection > > from > > > > > pool. > > > > > > With > > > > > value=3D"com.mysql.jdbc.Driver"/> it works, but value =3D > > > > > > "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 > > > > > > > > > > > > > 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_inte= gration.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.jav= a:211) > > > > > > > at > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > org.apache.openjpa.lib.conf.Configurations.newInstance(Configurations.jav= a:170) > > > > > > > at > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSource= Factory.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 exceptio= n > is > > > > > > changing > > > > > > > primary key on table, which is not often) > > > > > > > > > > > > > > 2012/4/13 Dmitry Zamula > > > > > > > > > > > > > > > Ok, thank you. I used this documentation, and may be it wil= l > be > > > > > > > interesting > > > > > > > > to you: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manual/r= ef_guide_mapping.html#ref_guide_mapping_mappingtool > > > > > > > > > > > > > > > > 2012/4/13 Maxim Solodovnik > > > > > > > > > > > > > > > > > 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 > > > > > > > > > > > > > > > > > > > > > Persistence.xml is copied to its location by one of t= he > > 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 syste= m, > > > there > > > > > is > > > > > > a > > > > > > > > > > > > duplicate information in database(in particular, th= is > > > > affects > > > > > > the > > > > > > > > > > > interface > > > > > > > > > > > > - double buttons, menus, etc.). I wrote new target = in > > > > > > build.xml: > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > classname=3D"org.apache.openjpa.jdbc.ant.MappingToolTask"> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > propertiesFile=3D"${dist.persistence.dir}/persistence.xml" > > > > > > > > > > /> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > 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? > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > _______________________________________________________= __ > > > > > > > > > > > > > > > > > > > > =D0=A1 =D1=83=D0=B2=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5= =D0=BC, > > > > > > > > > > > > > > > > > > > > =D0=97=D0=B0=D0=BC=D1=83=D0=BB=D0=B0 =D0=94=D0=BC=D0=B8= =D1=82=D1=80=D0=B8=D0=B9 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > _________________________________________________________ > > > > > > > > > > > > > > > > =D0=A1 =D1=83=D0=B2=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=D0= =BC, > > > > > > > > > > > > > > > > =D0=97=D0=B0=D0=BC=D1=83=D0=BB=D0=B0 =D0=94=D0=BC=D0=B8=D1= =82=D1=80=D0=B8=D0=B9 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > WBR > > > > > > > Maxim aka solomax > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > _________________________________________________________ > > > > > > > > > > > > =D0=A1 =D1=83=D0=B2=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC, > > > > > > > > > > > > =D0=97=D0=B0=D0=BC=D1=83=D0=BB=D0=B0 =D0=94=D0=BC=D0=B8=D1=82= =D1=80=D0=B8=D0=B9 > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > _________________________________________________________ > > > > > > > > =D0=A1 =D1=83=D0=B2=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC, > > > > > > > > =D0=97=D0=B0=D0=BC=D1=83=D0=BB=D0=B0 =D0=94=D0=BC=D0=B8=D1=82=D1=80= =D0=B8=D0=B9 > > > > > > > > > > > > > > > -- > > _________________________________________________________ > > > > =D0=A1 =D1=83=D0=B2=D0=B0=D0=B6=D0=B5=D0=BD=D0=B8=D0=B5=D0=BC, > > > > =D0=97=D0=B0=D0=BC=D1=83=D0=BB=D0=B0 =D0=94=D0=BC=D0=B8=D1=82=D1=80=D0= =B8=D0=B9 > > > --f46d04088e5f0ef8d104bdf6b4c4--