Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.6
-
None
-
None
-
macos 10.5, java 1.6
Description
The following script fails with a ClassNotFoundException. The script has no problem instantiating the com.mysql.jdbc.Driver class, but groovy.sql.Sql can't do the same. This may be related to GROOVY-3413.
import java.net.URL import java.net.URLClassLoader def cp = [] cp << new URL("file:mysql-connector-java-5.1.6-bin.jar") def loader = new URLClassLoader(cp as URL[], this.class.classLoader) def shell = new GroovyShell(loader) def script = """ assert null != new com.mysql.jdbc.Driver() """ shell.evaluate(script) script = """ import groovy.sql.Sql assert null != Sql.newInstance("jdbc:mysql://localhost:3306/db", "user", "pass", "com.mysql.jdbc.Driver") """ shell.evaluate(script)