You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Tino Schöllhorn <t....@tiscali.de> on 2004/01/29 10:54:58 UTC
VerifyMappingsTask proposal
Hi,
yesterday I have had some weird problems using the verfiymappings-task
which is included in OJB. The problem was that it could not find the
super-class of my persistent-classes although I provided a correct
classpath in the attribute verifyClassPath. After the task started it
stopped with the error: NoClassDefFoundError: my.class.name
So I had a look at the code and I changed it so that it works for me. I
just changed its own class-loader so that it uses the parent-ClassLoader
(probably it is now the ant-ClassLoader). But that works for me.
Now, I suppose others already can use this task correctly - so I propose
the following changes so it will run as it alread did and also in my way:
- Change of method VerifyMappingsTask.getClassLoader() so that it return
either the URLClassLoader which has been specified by the attribute
verifyClassPath or - if the attribute verifyClassPath has been omitted
it return the parent ClassLoader.
- Change of constructor DBUtility so that it has the following signature:
public DBUtility(String jdbcDriver, String url, String user, String pwd,
ClassLoader classLoader)
(It shouldn't use the URLClassLoader anyway, should it?)
I would be really glad if you could change the VerifyMappingTask so I
can use it as well.
Tino
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org
Re: VerifyMappingsTask proposal
Posted by Tino Schöllhorn <t....@tiscali.de>.
Thomas Dudziak wrote:
> On Thu, 29 Jan 2004, [ISO-8859-1] Tino Sch?llhorn wrote:
>
>
>>Hello Thomas,
>>
>>I think now the class-loading works much better than before. But I still
>>have one (smal) bug which might be a bug of the JdbcOdbcBridge as well
>>which I am using as Driver.
>>
>>When I use your new version the verifymapping task keeps telling me that
>>it can't connect to the database: "no suitable driver". So I inserted
>>the following lines in the constrcutor of DBUtility:
>>
>>try {
>> Driver driver = (Driver)jdbcDriver.newInstance();
>> DriverManager.registerDriver(driver);
>>} catch (Exception e) {
>> System.out.println("->Could'nt initialize driver!");
>>}
>>
>>... and voila now it works. Perhaps you can add these lines to the
>>constructor and then it would work fine!
>
>
> Done.
>
> Tom
Thanks!
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org
Re: VerifyMappingsTask proposal
Posted by Thomas Dudziak <to...@first.gmd.de>.
On Thu, 29 Jan 2004, [ISO-8859-1] Tino Sch�llhorn wrote:
> Hello Thomas,
>
> I think now the class-loading works much better than before. But I still
> have one (smal) bug which might be a bug of the JdbcOdbcBridge as well
> which I am using as Driver.
>
> When I use your new version the verifymapping task keeps telling me that
> it can't connect to the database: "no suitable driver". So I inserted
> the following lines in the constrcutor of DBUtility:
>
> try {
> Driver driver = (Driver)jdbcDriver.newInstance();
> DriverManager.registerDriver(driver);
> } catch (Exception e) {
> System.out.println("->Could'nt initialize driver!");
> }
>
> ... and voila now it works. Perhaps you can add these lines to the
> constructor and then it would work fine!
Done.
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org
Re: VerifyMappingsTask proposal
Posted by Tino Schöllhorn <t....@tiscali.de>.
Hello Thomas,
I think now the class-loading works much better than before. But I still
have one (smal) bug which might be a bug of the JdbcOdbcBridge as well
which I am using as Driver.
When I use your new version the verifymapping task keeps telling me that
it can't connect to the database: "no suitable driver". So I inserted
the following lines in the constrcutor of DBUtility:
try {
Driver driver = (Driver)jdbcDriver.newInstance();
DriverManager.registerDriver(driver);
} catch (Exception e) {
System.out.println("->Could'nt initialize driver!");
}
... and voila now it works. Perhaps you can add these lines to the
constructor and then it would work fine!
regards
Tino
Thomas Dudziak wrote:
> I already changed the task - though in an incompatible way: I removed the
> verifyClassPath attribute and instead added support for a nested classpath
> tag/the classpathref attribute (similar to, say, the javac tag). This way,
> it is much more flexible, and there is no need anymore to use a
> classloader directly in the task (ant has utility classes for class
> loading).
> Please give it a try and tell me if it works for you.
>
> As for the task being outdated, its core functionality should be working
> still, as it checks for instance that the columns stated in the repository
> are also present in the db, that the classes specified are present and so
> forth.
>
> Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org
Re: VerifyMappingsTask proposal
Posted by Thomas Dudziak <to...@first.gmd.de>.
I already changed the task - though in an incompatible way: I removed the
verifyClassPath attribute and instead added support for a nested classpath
tag/the classpathref attribute (similar to, say, the javac tag). This way,
it is much more flexible, and there is no need anymore to use a
classloader directly in the task (ant has utility classes for class
loading).
Please give it a try and tell me if it works for you.
As for the task being outdated, its core functionality should be working
still, as it checks for instance that the columns stated in the repository
are also present in the db, that the classes specified are present and so
forth.
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org