简体   繁体   中英

Grails with MySQL throwing error

I am trying to use MySQL with Grails.. as per the documentation on grails i have downloaded the MySQL connector and placed the jar file at the path grails-app/lib.

But while running the application i am getting a lot of errors. Some of them are as follows which I think if solved can solve the rest of them.

| Loading Grails 2.0.3
| Configuring classpath.
| Environment set to development.....
| Packaging Grails application.....
| Compiling 236 source files.
| Error Compilation error: startup failed:
Compile error during compilation with javac.
C:\xp\sst workspace\racetrack\grails-app\lib\src\com\mysql\jdbc\integration\c3p0\MysqlConnectionTester.java:31: error: package com.mchange.v2.c3p0 does not exist
import com.mchange.v2.c3p0.C3P0ProxyConnection;
                          ^
C:\xp\sst workspace\racetrack\grails-app\lib\src\com\mysql\jdbc\integration\c3p0\MysqlConnectionTester.java:32: error: package com.mchange.v2.c3p0 does not exist
import com.mchange.v2.c3p0.QueryConnectionTester;
                          ^
C:\xp\sst workspace\racetrack\grails-app\lib\src\com\mysql\jdbc\integration\c3p0\MysqlConnectionTester.java:44: error: cannot find symbol
public final class MysqlConnectionTester implements QueryConnectionTester {
                                                    ^
  symbol: class QueryConnectionTester
C:\xp\sst workspace\racetrack\grails-app\lib\src\com\mysql\jdbc\integration\jboss\ExtendedMysqlExceptionSorter.java:28: error: package org.jboss.resource.adapter.jdbc.vendor does not exist
import org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter;
                                             ^
.......... etc
44 errors
2 warnings
1 error

Please help me solving this problem...

  1. Where does the documentation say grails-app/lib ? I believe it should just be lib/
  2. Are you sure you put the binary jar in there, and not some sort of source code jar?

You should remove whatever you did inside grails-app , then simply uncomment the line:

    // runtime 'mysql:mysql-connector-java:5.1.16'

in grails-app/conf/BuildConfig.groovy

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM