我真的是Grails技術的初學者。我爲Windows 64位安裝了IDE Groovy/Grails Tool Suite™(GGTS,Grails 2.4.4)。使用Grail 2.4.4配置MySQL數據庫(無法創建池的初始連接)
有關JDK和Grails的環境路徑已經正確更新。
我創建了一個名爲「測試」的新項目,添加了名爲「test.User」一個新的域類如下:
package test
class User {
Integer id
String firstName
String lastName
static constraints = {
id(blank:false, unique:true)
firstName(blank:false)
lastName(blank:false)
}
}
應用於靜態腳手架生成帶有CRUD操作關聯的相應UserController中和看法。
要檢查我的數據模型是否與H2數據庫一起工作,我對DataSource.groovy文件進行了一些更新,它的工作原理是:我添加了一個新用戶拋出應用程序,並在我的表上運行SELECT *命令時USER(使用grails dbconsole),並顯示我的新用戶條目。所以,直到這裏一切都好!
但現在我想用另一個SQL數據庫連接我的應用程序使用不同的JDBC連接器。我選擇(爲了兼容性的緣故)我BuildConfig.groovy文件中提出的一個註釋去掉它:
runtime mysql:mysql-connector-java:5.1.29
當我運行應用程序「運行應用程序」(默認情況下,我認爲我們是在開發環境)我注意到依賴關係mysql-connector-java-5.1.29.jar已被添加到我的.m2目錄(C:\ Users \ my_user_name.m2 \ repository \ mysql \ mysql-connector-java \ 5.1.29)中。所以我認爲依賴關係在Grails中的一種MAVEN文件中正確註冊。但是該文件不會出現在ivy-cache目錄中。這是正常的嗎?
我BuildConfig.groovy文件內容:
grails.servlet.version = "3.0" // Change depending on target container compliance (2.5 or 3.0)
grails.project.class.dir = "target/classes"
grails.project.test.class.dir = "target/test-classes"
grails.project.test.reports.dir = "target/test-reports"
grails.project.work.dir = "target/work"
grails.project.target.level = 1.6
grails.project.source.level = 1.6
//grails.project.war.file = "target/${appName}-${appVersion}.war"
grails.project.fork = [
// configure settings for compilation JVM, note that if you alter the Groovy version forked compilation is required
// compile: [maxMemory: 256, minMemory: 64, debug: false, maxPerm: 256, daemon:true],
// configure settings for the test-app JVM, uses the daemon by default
test: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, daemon:true],
// configure settings for the run-app JVM
run: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
// configure settings for the run-war JVM
war: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256, forkReserve:false],
// configure settings for the Console UI JVM
console: [maxMemory: 768, minMemory: 64, debug: false, maxPerm: 256]
]
grails.project.dependency.resolver = "maven" // or ivy
grails.project.dependency.resolution = {
// inherit Grails' default dependencies
inherits("global") {
// specify dependency exclusions here; for example, uncomment this to disable ehcache:
// excludes 'ehcache'
}
log "error" // log level of Ivy resolver, either 'error', 'warn', 'info', 'debug' or 'verbose'
checksums true // Whether to verify checksums on resolve
legacyResolve false // whether to do a secondary resolve on plugin installation, not advised and here for backwards compatibility
repositories {
inherits true // Whether to inherit repository definitions from plugins
grailsPlugins()
grailsHome()
mavenLocal()
grailsCentral()
mavenCentral()
// uncomment these (or add new ones) to enable remote dependency resolution from public Maven repositories
//mavenRepo "http://repository.codehaus.org"
//mavenRepo "http://download.java.net/maven/2/"
//mavenRepo "http://repository.jboss.com/maven2/"
}
dependencies {
// specify dependencies here under either 'build', 'compile', 'runtime', 'test' or 'provided' scopes e.g.
runtime 'mysql:mysql-connector-java:5.1.29'
// runtime 'org.postgresql:postgresql:9.3-1101-jdbc41'
//test "org.grails:grails-datastore-test-support:1.0.2-grails-2.4"
}
plugins {
// plugins for the build system only
build ":tomcat:7.0.55"
// plugins for the compile step
compile ":scaffolding:2.1.2"
compile ':cache:1.1.8'
compile ":asset-pipeline:1.9.9"
// plugins needed at runtime but not for compilation
runtime ":hibernate4:4.3.6.1" // or ":hibernate:3.6.10.18"
runtime ":database-migration:1.4.0"
runtime ":jquery:1.11.1"
// Uncomment these to enable additional asset-pipeline capabilities
//compile ":sass-asset-pipeline:1.9.0"
//compile ":less-asset-pipeline:1.10.0"
//compile ":coffee-asset-pipeline:1.8.0"
//compile ":handlebars-asset-pipeline:1.3.0.3"
}
}
關於DataSource.groovy文件我換成關於驅動程序名稱行:
driverClassName = "org.h2.Driver"
通過
driverClassName = "com.mysql.jdbc.Driver"
和每個環境(我知道我只使用開發環境,但它只是爲了避免一些錯誤)再次
url = "jdbc:h2:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
通過
url = "jdbc:mysql://localhost/test"
我還添加僅低於默認的用戶名和密碼(如root用戶)+驅動程序類的名稱如下(爲每個環境中:我更換了以下線):
driverClassName = "com.mysql.jdbc.Driver"
username = "root"
password = ""
這是我的數據源。常規文件內容:
dataSource {
pooled = true
jmxExport = true
//driverClassName = "org.h2.Driver"
driverClassName = "com.mysql.jdbc.Driver"
username = "sa"
password = ""
}
hibernate {
cache.use_second_level_cache = true
cache.use_query_cache = false
// cache.region.factory_class = 'net.sf.ehcache.hibernate.EhCacheRegionFactory' // Hibernate 3
cache.region.factory_class = 'org.hibernate.cache.ehcache.EhCacheRegionFactory' // Hibernate 4
singleSession = true // configure OSIV singleSession mode
flush.mode = 'manual' // OSIV session flush mode outside of transactional context
}
// environment specific settings
environments {
development {
dataSource {
dbCreate = "update" // one of 'create', 'create-drop', 'update', 'validate', ''
//url = "jdbc:h2:mem:devDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
url = "jdbc:mysql://localhost/test"
driverClassName = "com.mysql.jdbc.Driver"
username = "root"
password = ""
}
}
test {
dataSource {
dbCreate = "update"
//url = "jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
url = "jdbc:mysql://localhost/test"
driverClassName = "com.mysql.jdbc.Driver"
username = "root"
password = ""
}
}
production {
dataSource {
dbCreate = "update"
//url = "jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE"
url = "jdbc:mysql://localhost/test"
driverClassName = "com.mysql.jdbc.Driver"
username = "root"
password = ""
properties {
// See http://grails.org/doc/latest/guide/conf.html#dataSource for documentation
jmxEnabled = true
initialSize = 5
maxActive = 50
minIdle = 5
maxIdle = 25
maxWait = 10000
maxAge = 10 * 60000
timeBetweenEvictionRunsMillis = 5000
minEvictableIdleTimeMillis = 60000
validationQuery = "SELECT 1"
validationQueryTimeout = 3
validationInterval = 15000
testOnBorrow = true
testWhileIdle = true
testOnReturn = false
jdbcInterceptors = "ConnectionState"
defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
}
}
}
}
現在,當我跑,我有以下錯誤的應用程序:
ERROR pool.ConnectionPool - Unable to create initial connections of pool.
這裏是整個錯誤堆棧:
2016-08-23 16:18:58,040 [localhost-startStop-1] ERROR pool.ConnectionPool - Unable to create initial connections of pool.
Message: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Line | Method
->> 411 | handleNewInstance in com.mysql.jdbc.Util
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1129 | createCommunicationsException in com.mysql.jdbc.SQLError
| 358 | <init> . . . . . . . . . . . in com.mysql.jdbc.MysqlIO
| 2498 | coreConnect in com.mysql.jdbc.ConnectionImpl
| 2535 | connectOneTryOnly . . . . . . in ''
| 2320 | createNewIO in ''
| 834 | <init> . . . . . . . . . . . in ''
| 46 | <init> in com.mysql.jdbc.JDBC4Connection
| 411 | handleNewInstance . . . . . . in com.mysql.jdbc.Util
| 416 | getInstance in com.mysql.jdbc.ConnectionImpl
| 347 | connect . . . . . . . . . . . in com.mysql.jdbc.NonRegisteringDriver
| 266 | run in java.util.concurrent.FutureTask
| 1142 | runWorker . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 617 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . . . . . . . . . . . in java.lang.Thread
Caused by ConnectException: Connection refused: connect
->> 79 | socketConnect in java.net.DualStackPlainSocketImpl
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 345 | doConnect in java.net.AbstractPlainSocketImpl
| 206 | connectToAddress . . . . . . in ''
| 188 | connect in ''
| 172 | connect . . . . . . . . . . . in java.net.PlainSocketImpl
| 392 | connect in java.net.SocksSocketImpl
| 589 | connect . . . . . . . . . . . in java.net.Socket
| 538 | connect in ''
| 434 | <init> . . . . . . . . . . . in ''
| 244 | <init> in ''
| 256 | connect . . . . . . . . . . . in com.mysql.jdbc.StandardSocketFactory
| 308 | <init> in com.mysql.jdbc.MysqlIO
| 2498 | coreConnect . . . . . . . . . in com.mysql.jdbc.ConnectionImpl
| 2535 | connectOneTryOnly in ''
| 2320 | createNewIO . . . . . . . . . in ''
| 834 | <init> in ''
| 46 | <init> . . . . . . . . . . . in com.mysql.jdbc.JDBC4Connection
| 411 | handleNewInstance in com.mysql.jdbc.Util
| 416 | getInstance . . . . . . . . . in com.mysql.jdbc.ConnectionImpl
| 347 | connect in com.mysql.jdbc.NonRegisteringDriver
| 266 | run . . . . . . . . . . . . . in java.util.concurrent.FutureTask
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Error |
2016-08-23 16:19:00,132 [localhost-startStop-1] ERROR pool.ConnectionPool - Unable to create initial connections of pool.
Message: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Line | Method
->> 411 | handleNewInstance in com.mysql.jdbc.Util
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1129 | createCommunicationsException in com.mysql.jdbc.SQLError
| 358 | <init> . . . . . . . . . . . in com.mysql.jdbc.MysqlIO
| 2498 | coreConnect in com.mysql.jdbc.ConnectionImpl
| 2535 | connectOneTryOnly . . . . . . in ''
| 2320 | createNewIO in ''
| 834 | <init> . . . . . . . . . . . in ''
| 46 | <init> in com.mysql.jdbc.JDBC4Connection
| 411 | handleNewInstance . . . . . . in com.mysql.jdbc.Util
| 416 | getInstance in com.mysql.jdbc.ConnectionImpl
| 347 | connect . . . . . . . . . . . in com.mysql.jdbc.NonRegisteringDriver
| 266 | run in java.util.concurrent.FutureTask
| 1142 | runWorker . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 617 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . . . . . . . . . . . in java.lang.Thread
Caused by ConnectException: Connection refused: connect
->> 79 | socketConnect in java.net.DualStackPlainSocketImpl
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 345 | doConnect in java.net.AbstractPlainSocketImpl
| 206 | connectToAddress . . . . . . in ''
| 188 | connect in ''
| 172 | connect . . . . . . . . . . . in java.net.PlainSocketImpl
| 392 | connect in java.net.SocksSocketImpl
| 589 | connect . . . . . . . . . . . in java.net.Socket
| 538 | connect in ''
| 434 | <init> . . . . . . . . . . . in ''
| 244 | <init> in ''
| 256 | connect . . . . . . . . . . . in com.mysql.jdbc.StandardSocketFactory
| 308 | <init> in com.mysql.jdbc.MysqlIO
| 2498 | coreConnect . . . . . . . . . in com.mysql.jdbc.ConnectionImpl
| 2535 | connectOneTryOnly in ''
| 2320 | createNewIO . . . . . . . . . in ''
| 834 | <init> in ''
| 46 | <init> . . . . . . . . . . . in com.mysql.jdbc.JDBC4Connection
| 411 | handleNewInstance in com.mysql.jdbc.Util
| 416 | getInstance . . . . . . . . . in com.mysql.jdbc.ConnectionImpl
| 347 | connect in com.mysql.jdbc.NonRegisteringDriver
| 266 | run . . . . . . . . . . . . . in java.util.concurrent.FutureTask
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Error |
2016-08-23 16:19:02,194 [localhost-startStop-1] ERROR pool.ConnectionPool - Unable to create initial connections of pool.
Message: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Line | Method
->> 411 | handleNewInstance in com.mysql.jdbc.Util
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1129 | createCommunicationsException in com.mysql.jdbc.SQLError
| 358 | <init> . . . . . . . . . . . in com.mysql.jdbc.MysqlIO
| 2498 | coreConnect in com.mysql.jdbc.ConnectionImpl
| 2535 | connectOneTryOnly . . . . . . in ''
| 2320 | createNewIO in ''
| 834 | <init> . . . . . . . . . . . in ''
| 46 | <init> in com.mysql.jdbc.JDBC4Connection
| 411 | handleNewInstance . . . . . . in com.mysql.jdbc.Util
| 416 | getInstance in com.mysql.jdbc.ConnectionImpl
| 347 | connect . . . . . . . . . . . in com.mysql.jdbc.NonRegisteringDriver
| 266 | run in java.util.concurrent.FutureTask
| 1142 | runWorker . . . . . . . . . . in java.util.concurrent.ThreadPoolExecutor
| 617 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . . . . . . . . . . . in java.lang.Thread
Caused by ConnectException: Connection refused: connect
->> 79 | socketConnect in java.net.DualStackPlainSocketImpl
Error |
2016-08-23 16:19:02,205 [localhost-startStop-1] ERROR context.GrailsContextLoaderListener - Error initializing the application: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Message: Error creating bean with name 'transactionManagerPostProcessor': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Line | Method
->> 266 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
->> 266 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'hibernateProperties' while setting bean property 'hibernateProperties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
->> 266 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'hibernateProperties': Cannot resolve reference to bean 'dialectDetector' while setting bean property 'properties' with key [hibernate.dialect]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
->> 266 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by BeanCreationException: Error creating bean with name 'dialectDetector': Invocation of init method failed; nested exception is org.springframework.jdbc.support.MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
->> 266 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by MetaDataAccessException: Error while extracting DatabaseMetaData; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
->> 266 | run in java.util.concurrent.FutureTask
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Caused by CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
->> 411 | handleNewInstance in com.mysql.jdbc.Util
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1129 | createCommunicationsException in com.mysql.jdbc.SQLError
| 358 | <init> . in com.mysql.jdbc.MysqlIO
| 2498 | coreConnect in com.mysql.jdbc.ConnectionImpl
| 2535 | connectOneTryOnly in ''
| 2320 | createNewIO in ''
| 834 | <init> . in ''
| 46 | <init> in com.mysql.jdbc.JDBC4Connection
| 411 | handleNewInstance in com.mysql.jdbc.Util
| 416 | getInstance in com.mysql.jdbc.ConnectionImpl
| 347 | connect . in com.mysql.jdbc.NonRegisteringDriver
| 266 | run in java.util.concurrent.FutureTask
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run . . . in java.lang.Thread
Caused by ConnectException: Connection refused: connect
->> 79 | socketConnect in java.net.DualStackPlainSocketImpl
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 345 | doConnect in java.net.AbstractPlainSocketImpl
| 206 | connectToAddress in ''
| 188 | connect in ''
| 172 | connect . in java.net.PlainSocketImpl
| 392 | connect in java.net.SocksSocketImpl
| 589 | connect . in java.net.Socket
| 538 | connect in ''
| 434 | <init> . in ''
| 244 | <init> in ''
| 256 | connect . in com.mysql.jdbc.StandardSocketFactory
| 308 | <init> in com.mysql.jdbc.MysqlIO
| 2498 | coreConnect in com.mysql.jdbc.ConnectionImpl
| 2535 | connectOneTryOnly in ''
| 2320 | createNewIO in ''
| 834 | <init> in ''
| 46 | <init> . in com.mysql.jdbc.JDBC4Connection
| 411 | handleNewInstance in com.mysql.jdbc.Util
| 416 | getInstance in com.mysql.jdbc.ConnectionImpl
| 347 | connect in com.mysql.jdbc.NonRegisteringDriver
| 266 | run . . . in java.util.concurrent.FutureTask
| 1142 | runWorker in java.util.concurrent.ThreadPoolExecutor
| 617 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker
^ 745 | run in java.lang.Thread
Error |
Forked Grails VM exited with errorJava HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
看來Grails中找不到司機或類似的東西。但是我們已經看到JAR文件已經在.m2目錄中註冊過了。我不知道一兩件事:這是否JAR文件必須出現在Grails的依賴關係列表:
整個名單上沒有圖像,但該文件沒有出現在列表中。這是正常的嗎?該文件只能出現在.m2目錄中(在Ivy-cache中,這是相同的,該文件不存在)?當我運行該應用程序時,您認爲依賴關係是否可用? Grails是否承認驅動程序會拋出類路徑?
我真的迷路了。
非常感謝您的幫助。
請注意,MySQL JDBC Driver類會顯示在您的錯誤跟蹤中。這表明您的應用程序正在使用MySQL JDBC jar *。找不到JDBC驅動程序完全是另一個例外。問題是您的應用程序無法連接到您的MySQL實例。您是否正確配置了數據源(URL,憑證)?您的示例代碼爲MySQL根用戶顯示一個空白密碼... – jstell