But it's not working for me. Can someone try out the attached POM and
let me know if I'm crazy?
Instructions:
Put the POM in a directory.
Run "mvn groovy:console"
Type the following and execute:
new org.hsqldb.jdbcDriver()
groovy.sql.Sql.loadDriver('org.hsqldb.jdbcDriver')
I get this (on the second line, not the first):
Exception thrown: org.hsqldb.jdbcDriver
java.lang.ClassNotFoundException: org.hsqldb.jdbcDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadRealmClass(ClassRealm.java:174)
at org.codehaus.plexus.classworlds.strategy.DefaultStrategy.loadClass(DefaultStrategy.java:67)
at org.codehaus.plexus.classworlds.strategy.ForeignStrategy.loadClass(ForeignStrategy.java:39)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:201)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at groovy.sql.Sql.loadDriver(Sql.java:270)
at groovy.sql.Sql$loadDriver.call(Unknown Source)
at ConsoleScript1.run(ConsoleScript1:2)
My environment:
Apache Maven 2.2.0 (r788681; 2009-06-26 09:04:01-0400)
Java version: 1.6.0_16
Java home: /usr/lib/jvm/java-6-sun-1.6.0.16/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.28-15-generic" arch: "amd64" Family: "unix"
You can see in the POM I'm using Groovy 1.6.4 and Gmaven 1.0-rc-5
Any help? Thanks in advance.
Exception thrown: org.hsqldb.jdbcDriver
java.lang.ClassNotFoundException: org.hsqldb.jdbcDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadRealmClass(ClassRealm.java:174)
at org.codehaus.plexus.classworlds.strategy.DefaultStrategy.loadClass(DefaultStrategy.java:67)
at org.codehaus.plexus.classworlds.strategy.ForeignStrategy.loadClass(ForeignStrategy.java:39)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:201)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at groovy.sql.Sql.loadDriver(Sql.java:270)
at groovy.sql.Sql$loadDriver.call(Unknown Source)
at ConsoleScript0.run(ConsoleScript0:2)
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
--
Guillaume Laforge
Groovy Project Manager
Head of Groovy Development at SpringSource
http://www.springsource.com/g2one
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
On Fri, Sep 18, 2009 at 16:44, Tom Nichols <tmni...@gmail.com> wrote:
Thanks.
-Tom
Sql.newInstance( url, user, pass, driver )
But that causes the same error. In the bug report, the final comment
uses "Sql.loadDriver" before calling newInstance, but apparently that
doesn't help for me.
On Fri, Sep 18, 2009 at 11:23 AM, Guillaume Laforge
import groovy.sql.Sql
import org.hsqldb.jdbcDriver
def jdbcUrl = 'jdbc:hsqldb:mem:foo'
new Sql(new jdbcDriver().getConnection(jdbcUrl, null))
I'm actually using Oracle, not HSQL as my DB... So the connection
process was slightly different but I figured it out.
That's the second time I've been bit by the difference in how Maven
uses classloaders when it adds dependencies to the classpath. But I
suppose I might have been able to use the Class.forName variant that
accepts a classloader as well; that might have worked.
Thanks for the help.
-Tom
2009/9/18 Guillaume Laforge <glaf...@codehaus.org>: