db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Tilsted <til...@daimi.au.dk>
Subject Re: How do I put the postgresql driver(jar) where maven can find it. (Working now)
Date Sun, 04 Jan 2009 00:25:39 GMT
Oh, and I got it working now.

I should have had a project.xml file, but I somehow forgot to include it 
from my previous project using torque, and then I forgot I used to have 
a project.xml file. DOH!

Well, I added my template project.xml file, and then added the 
dependency for postgresql to that, and now the driver is loading correct.

Thanks for all the help

Martin


Martin Tilsted wrote:
> Thomas Vandahl wrote:
>> Martin Tilsted wrote:
>>  
>>> java.lang.ClassNotFoundException: org.postgresql.Driver
>>>     
>>
>> Maven should have setup a repository where it downloads all kinds of
>> dependencies. Normally this is ~/.maven/repository. You will need to add
>> a dependency entry to your project.xml like in
>>
>> ---8<---
>>     <dependency>
>>       <groupId>postgresql</groupId>
>>       <artifactId>postgresql</artifactId>
>>       <version>8.3-603.jdbc4</version>
>>     </dependency>
>> ---8<---
>>
>>   
> My ~/.maven/repository only contains jar files but I do have a 
> ~/.maven/cache/maven-torque-plugin-3.3/project.xml
> which is the only project.xml file I could find that have anything to 
> do with torque.
>
> I added the xml code from above to project.xml, and it did download 
> the postgresql.jar file, and when running
> maven -X torque:jdbc
> i get
> adding dependency 
> /home/tiller/.maven/repository/postgresql/jars/postgresql-8.3-603.jdbc4.jar 
> into project classloader
> But I still get the
> class not found exception.
> Full stacktrace:
> Errors stack :
>
> >> Unable to obtain goal [torque:jdbc]
> >> File...... 
> file:/home/tiller/.maven/cache/maven-torque-plugin-3.3/plugin.jelly
> >> Element... torque-jdbc-transform
> >> Line...... 522
> >> Column.... 7
> >> java.lang.ClassNotFoundException: org.postgresql.Driver
> >> org.postgresql.Driver
>
> Exception stack traces :
> org.apache.maven.werkz.UnattainableGoalException: Unable to obtain 
> goal [torque:jdbc]
>        at org.apache.maven.werkz.Goal.fire(Goal.java:698)
>        at org.apache.maven.werkz.Goal.attain(Goal.java:623)
>        at 
> org.apache.maven.plugin.PluginManager.attainGoals(PluginManager.java:712)
>        at 
> org.apache.maven.MavenSession.attainGoals(MavenSession.java:265)
>        at org.apache.maven.cli.App.doMain(App.java:307)
>        at org.apache.maven.cli.App.main(App.java:217)
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
>
>        at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

>
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at com.werken.forehead.Forehead.run(Forehead.java:551)
>        at com.werken.forehead.Forehead.main(Forehead.java:581)
> Caused by: org.apache.commons.jelly.JellyTagException: 
> file:/home/tiller/.maven/cache/maven-torque-plugin-3.3/plugin.jelly:522:7: 
> <torque-jdbc-transform> java.lang.ClassNotFoundException: 
> org.postgresql.Driver
>        at 
> org.apache.commons.jelly.impl.TagScript.handleException(TagScript.java:681) 
>
>        at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:262)
>        at 
> org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:95)
>        at 
> org.apache.maven.jelly.tags.werkz.MavenGoalTag.runBodyTag(MavenGoalTag.java:83) 
>
>        at 
> org.apache.maven.jelly.tags.werkz.MavenGoalTag$MavenGoalAction.performAction(MavenGoalTag.java:116)

>
>        at org.apache.maven.werkz.Goal.fire(Goal.java:691)
>        ... 11 more
> Caused by: java.lang.ClassNotFoundException: org.postgresql.Driver
>        at 
> org.apache.torque.task.TorqueJDBCTransformTask.execute(TorqueJDBCTransformTask.java:171)

>
>        at org.apache.tools.ant.Task.perform(Task.java:364)
>        at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:195)
>        at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:250)
>        ... 15 more
> Caused by: java.lang.ClassNotFoundException: org.postgresql.Driver
>        at 
> org.apache.tools.ant.AntClassLoader.findClassInComponents(AntClassLoader.java:1166) 
>
>        at 
> org.apache.tools.ant.AntClassLoader.findClass(AntClassLoader.java:1107)
>        at 
> org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:977)
>        at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
>        at java.lang.Class.forName0(Native Method)
>        at java.lang.Class.forName(Class.java:169)
>        at 
> org.apache.torque.task.TorqueJDBCTransformTask.generateXML(TorqueJDBCTransformTask.java:184)

>
>        at 
> org.apache.torque.task.TorqueJDBCTransformTask.execute(TorqueJDBCTransformTask.java:161)

>
>        ... 18 more
>
> ------------------- And my build.properties in case that should matter 
> -------
> maven.compile.source = 1.6
> maven.compile.target = 1.6
> maven.compile.debug = on
> maven.compile.optimize = off
> maven.compile.deprecation = off
> maven.compile.encoding = UTF-8
> maven.compile.source = 1.6
> maven.compile.target = 1.6
>
> #Torque setup
> torque.project=test
> torque.java.dir =    src
> torque.sql.dir  = src/sql
> torque.output.dir = src/sql
> torque.schema.dir =    src/schema
> torque.contextProperties =    build.properties
>
> torque.addSaveMethod =        true
> torque.runOnlyOnSchemaChange =    true
> torque.saveException =        Exception
> torque.addIntakeRetrievable =    true
> torque.retrievableInterface =    org.apache.turbine.om.Retrievable
>
> #
> # Initial ID values for the ID_TABLE
> #
> initialID = 1100
> initialIDValue = 100
> initialIDStep = 10
>
> torque.database=postgresql
>
> torque.targetPackage=test.auto
> torque.basePrefix=Base
> torque.base = Base
>
> torque.database.driver=org.postgresql.Driver
>
> torque.database.url = jdbc:postgresql://127.0.0.1:5432/test
> torque.database.user=test
> torque.database.host=localhost
> ------------ CONFIG END ----------
>
>> This version is available in the central repository so you will not need
>> to download it yourself.
>>
>>  
>>> An other thing is: I removed my .maven and then did a
>>> maven torque:jdbc
>>> which result in the file
>>> ./cache/maven-torque-plugin-3.3-RC2
>>> But torque-3.3 have been released, so why does it fetch the old RC2 
>>> file?
>>>     
>>
>> Well, this depends on the entries in your project.xml. Find the
>> dependency on maven-torque-plugin and change the version to 3.3. I
>> recommend to delete the 3.3-RC2-version from the cache first.
>>   
> Just for the reference in case someone need this.
>
> What I did not understand was that if I delete ~/.maven and I don't 
> have any project.xml file(I don't) how did
> maven know what to do with maven torque:jdbc and why did it download 
> the RC2 version.
>
> The answer is that maven caches files it download in 
> /usr/local/maven-1.1/plugins and I had for a long time ago downloaded
> the rc2 version, so it just used that because I had not  added an 
> other torque file to maven.
>
> So my solution was simply to do a reinstall of my /usr/local/maven and 
> then do a
>
> maven plugin:download -DartifactId=maven-torque-plugin 
> -DgroupId=torque -Dversion=3.3
>
>
> To get the correct new version of torque.
>
> Martin
>
>
>
>
>
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message