2015-07-28 12 views
12

Tôi đã triển khai ứng dụng Grails 2.2.1 vào máy chủ từ xa. Sau một vài giờ, khi tôi truy cập vào trang chủ của ứng dụng, tôi thấy ngoại lệ sau:ngoại lệ ống bị hỏng với MySql trong ứng dụng Grails

Error 500: Internal Server Error 

URI 
    /DocGemStudioZoccali/ 
Class 
    java.net.SocketException 
Message 
    Broken pipe 

Trace 

    Line | Method 
->> 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
| 615 | run  in java.util.concurrent.ThreadPoolExecutor$Worker 
^ 722 | run . . . in java.lang.Thread 

Caused by GroovyPagesException: Error processing GroovyPageView: could not execute query; nested exception is org.hibernate.exception.JDBCConnectionException: could not execute query 
->> 631 | runWorker in /index.gsp 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

Caused by DataAccessResourceFailureException: could not execute query; nested exception is org.hibernate.exception.JDBCConnectionException: could not execute query 
->> 108 | doCall in org.grails.datastore.gorm.GormStaticApi$_methodMissing_closure2 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|  25 | doCall in gsp_docGemStudioZoccaliindex_gsp$_run_closure1 
|  38 | run . . . in gsp_docGemStudioZoccaliindex_gsp 
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor 
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker 
^ 722 | run  in java.lang.Thread 

Caused by JDBCConnectionException: could not execute query 
->> 108 | doCall in org.grails.datastore.gorm.GormStaticApi$_methodMissing_closure2 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
|  25 | doCall in gsp_docGemStudioZoccaliindex_gsp$_run_closure1 
|  38 | run . . . in gsp_docGemStudioZoccaliindex_gsp 
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor 
| 615 | run . . . in java.util.concurrent.ThreadPoolExecutor$Worker 
^ 722 | run  in java.lang.Thread 

Caused by CommunicationsException: The last packet successfully received from the server was 138,684,859 milliseconds ago. The last packet sent successfully to the server was 138,684,859 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem. 
->> 411 | handleNewInstance in com.mysql.jdbc.Util 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
| 1116 | createCommunicationsException in com.mysql.jdbc.SQLError 
| 3851 | send . . in com.mysql.jdbc.MysqlIO 
| 2471 | sendCommand in  '' 
| 2651 | sqlQueryDirect in  '' 
| 2683 | execSQL in com.mysql.jdbc.ConnectionImpl 
| 2144 | executeInternal in com.mysql.jdbc.PreparedStatement 
| 2310 | executeQuery in  '' 
|  96 | executeQuery in org.apache.commons.dbcp.DelegatingPreparedStatement 
| 108 | doCall in org.grails.datastore.gorm.GormStaticApi$_methodMissing_closure2 
|  25 | doCall . in gsp_docGemStudioZoccaliindex_gsp$_run_closure1 
|  38 | run  in gsp_docGemStudioZoccaliindex_gsp 
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor 
| 615 | run  in java.util.concurrent.ThreadPoolExecutor$Worker 
^ 722 | run . . . in java.lang.Thread 

Caused by SocketException: Broken pipe 
->> 109 | socketWrite in java.net.SocketOutputStream 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
| 153 | write  in  '' 
|  82 | flushBuffer in java.io.BufferedOutputStream 
| 140 | flush  in  '' 
| 3832 | send . . in com.mysql.jdbc.MysqlIO 
| 2471 | sendCommand in  '' 
| 2651 | sqlQueryDirect in  '' 
| 2683 | execSQL in com.mysql.jdbc.ConnectionImpl 
| 2144 | executeInternal in com.mysql.jdbc.PreparedStatement 
| 2310 | executeQuery in  '' 
|  96 | executeQuery in org.apache.commons.dbcp.DelegatingPreparedStatement 
| 108 | doCall in org.grails.datastore.gorm.GormStaticApi$_methodMissing_closure2 
|  25 | doCall . in gsp_docGemStudioZoccaliindex_gsp$_run_closure1 
|  38 | run  in gsp_docGemStudioZoccaliindex_gsp 
| 1145 | runWorker in java.util.concurrent.ThreadPoolExecutor 
| 615 | run  in java.util.concurrent.ThreadPoolExecutor$Worker 
^ 722 | run . . . in java.lang.Thread 

Tôi đã cố giải quyết vấn đề như đã thấy trong câu hỏi khác trong SO, nhưng nó không hoạt động cho tôi.

Dưới đây là những gì tôi đã thực hiện bên trong tập tin cấu hình:

dataSource { 
     dbCreate = "update" 
     url = "jdbc:mysql://urlofapp/myappname?useUnicode=yes&characterEncoding=UTF-8" 
     username = "root" 
     password = "root" 
     //run the evictor every 30 minutes and evict any connections older than 30 minutes. 
     minEvictableIdleTimeMillis=1800000 
     timeBetweenEvictionRunsMillis=1800000 
     numTestsPerEvictionRun=3 
     //test the connection while its idle, before borrow and return it 
     testOnBorrow=true 
     testWhileIdle=true 
     testOnReturn=true 
     validationQuery="SELECT 1" 
    } 

Chú ý rằng, nếu tôi làm mới trang, mọi thứ hoạt động một cách chính xác. Có ai biết gì để giải quyết vấn đề này không?

EDIT 1:

tôi đã chỉnh sửa các tập tin my.cnf trong /etc thư mục, thêm những điều sau đây:

wait_timeout = 28800 
interactive_timeout = 28800 

nhưng có gì thay đổi

EDIT 2:

Đây là dữ liệu thực tế sourc e tôi đang sử dụng. đường ống bị hỏng vẫn xuất hiện

dataSource { 
    dbCreate = "update" 
    url = "jdbc:mysql://urlofapp/myappname?useUnicode=yes&characterEncoding=UTF-8&autoReconnect=true" 
    username = "root" 
    password = "root" 
    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;StatementCache(max=200)" 
    defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED 
} 

EDIT 3:

Đây là stacktrace sau khi đề nghị được đưa ra bởi James Kleeh

2015-12-04 17:41:36,924 [http-bio-8080-exec-63] ERROR context.GrailsContextLoader - 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 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Cannot resolve reference to bean 'dataSourceUnproxied' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceUnproxied': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'maxAge' of bean class [org.apache.commons.dbcp.BasicDataSource]: Bean property 'maxAge' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 
org.springframework.beans.factory.BeanCreationException: 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 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Cannot resolve reference to bean 'dataSourceUnproxied' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceUnproxied': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'maxAge' of bean class [org.apache.commons.dbcp.BasicDataSource]: Bean property 'maxAge' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
     at java.lang.Thread.run(Thread.java:722) 
Caused by: 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 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Cannot resolve reference to bean 'dataSourceUnproxied' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceUnproxied': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'maxAge' of bean class [org.apache.commons.dbcp.BasicDataSource]: Bean property 'maxAge' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 
     ... 3 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Cannot resolve reference to bean 'dataSourceUnproxied' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceUnproxied': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'maxAge' of bean class [org.apache.commons.dbcp.BasicDataSource]: Bean property 'maxAge' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 
     ... 3 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Cannot resolve reference to bean 'dataSourceUnproxied' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceUnproxied': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'maxAge' of bean class [org.apache.commons.dbcp.BasicDataSource]: Bean property 'maxAge' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 
     ... 3 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceUnproxied': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'maxAge' of bean class [org.apache.commons.dbcp.BasicDataSource]: Bean property 'maxAge' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 
     ... 3 more 
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'maxAge' of bean class [org.apache.commons.dbcp.BasicDataSource]: Bean property 'maxAge' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 
     ... 3 more 
2015-12-04 17:41:36,931 [http-bio-8080-exec-63] ERROR context.GrailsContextLoader - Error initializing Grails: 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 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Cannot resolve reference to bean 'dataSourceUnproxied' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceUnproxied': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'maxAge' of bean class [org.apache.commons.dbcp.BasicDataSource]: Bean property 'maxAge' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 
org.springframework.beans.factory.BeanCreationException: 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 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Cannot resolve reference to bean 'dataSourceUnproxied' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceUnproxied': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'maxAge' of bean class [org.apache.commons.dbcp.BasicDataSource]: Bean property 'maxAge' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
     at java.lang.Thread.run(Thread.java:722) 
Caused by: 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 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Cannot resolve reference to bean 'dataSourceUnproxied' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceUnproxied': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'maxAge' of bean class [org.apache.commons.dbcp.BasicDataSource]: Bean property 'maxAge' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 
     ... 3 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory': Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Cannot resolve reference to bean 'dataSourceUnproxied' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceUnproxied': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'maxAge' of bean class [org.apache.commons.dbcp.BasicDataSource]: Bean property 'maxAge' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 
     ... 3 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Cannot resolve reference to bean 'dataSourceUnproxied' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceUnproxied': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'maxAge' of bean class [org.apache.commons.dbcp.BasicDataSource]: Bean property 'maxAge' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 
     ... 3 more 
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSourceUnproxied': Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'maxAge' of bean class [org.apache.commons.dbcp.BasicDataSource]: Bean property 'maxAge' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 
     ... 3 more 
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'maxAge' of bean class [org.apache.commons.dbcp.BasicDataSource]: Bean property 'maxAge' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? 
     ... 3 more 
Dec 04, 2015 5:41:36 PM org.apache.catalina.core.StandardContext startInternal 
SEVERE: Error listenerStart 
Dec 04, 2015 5:41:36 PM org.apache.catalina.core.StandardContext startInternal 
SEVERE: Context [/DocGemStudioTest] startup failed due to previous errors 
2015-12-04 17:41:36,955 [http-bio-8080-exec-63] WARN lifecycle.ShutdownOperations - Error occurred running shutdown operation: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext 
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext 
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
     at java.lang.Thread.run(Thread.java:722) 
Dec 04, 2015 5:41:36 PM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc 
SEVERE: The web application [/DocGemStudioTest] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered. 

EDIT 4:

Tôi đã chỉnh sửa khối properties và bây giờ ứng dụng bắt đầu. Tôi cần kiểm tra xem lỗi có xảy ra sau vài giờ không.

properties{ 
       minIdle = 5 
       maxIdle = 25 
       maxWait = 10000 

       timeBetweenEvictionRunsMillis = 5000 
       minEvictableIdleTimeMillis = 60000 
       validationQuery = "SELECT 1" 
       validationQueryTimeout = 3 

       testOnBorrow = true 
       testWhileIdle = true 
       testOnReturn = false 

       defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED 
     } 
+0

Cậu cố ý để lại trong "urlofapp/myappname?" trong url dataSource của bạn để ẩn nó cho câu hỏi này? Hay đây là vấn đề về cắt và dán? – dspano

+0

Tôi chỉ sử dụng "urlofapp/myappname" thay vì tên thật chỉ cho câu hỏi, rõ ràng là – FrancescoDS

+0

Ví dụ mysql của bạn có chấp nhận các kết nối từ máy chủ từ xa không? bạn có thay đổi cấu hình mặc định không? –

Trả lời

-2

Trông với tôi như MySQL là thời điểm ra kết nối đến bạn. Có lẽ không nhiều bạn có thể làm về điều đó.

Bạn có thể xem xét đóng kết nối nếu không có lưu lượng truy cập trên đó trong một thời gian và sau đó mở lại khi cần thiết một lần nữa không?

+0

Bạn có ý nghĩa gì với "bạn"? Bạn có nghĩa là không thể giải quyết nó theo cách khác? – FrancescoDS

+0

Tôi đang nói rằng có vẻ như thời gian chờ đang diễn ra ở phía MySQL của kết nối. Trừ khi bạn kiểm soát cấu hình của MySQL, có thể có rất ít bạn có thể làm về nó khác mà thay đổi cách tiếp cận của bạn như thế nào * bạn * đang xử lý kết nối. Đây thực chất là câu trả lời giống như câu trả lời của stenix vào ngày 4 tháng 12 năm 2015. –

1

Vì vậy, tôi tin rằng tất cả mọi thứ khác hơn dbCreate, url, username, và password nhu cầu để được trong một thuộc tính chặn:

dataSource { 
    dbCreate = "update" 
    url = "jdbc:mysql://urlofapp/myappname?useUnicode=yes&characterEncoding=UTF-8&autoReconnect=true" 
    username = "root" 
    password = "root" 
    properties { 
     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;StatementCache(max=200)" 
     defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED 
    } 
} 
+0

Tôi thử và tôi sẽ cho bạn biết. – FrancescoDS

+0

Thêm khối thuộc tính, ứng dụng không bắt đầu – FrancescoDS

+0

Đây phải là câu trả lời đúng. Bạn có nhận được bất kỳ thông báo lỗi nào khi nó không khởi động không? ValidateionQuery là các thuộc tính thực hiện thủ thuật để duy trì phiên làm việc. – stenix

1

Mặc dù, điều này sẽ là kỳ lạ nhưng nếu ứng dụng Grails và máy chủ MySQL cả hai đều trên cùng một máy sau đó sử dụng localhost hay 127.0.0. thay vì địa chỉ IP thực xxx.xxx.xxx.xxx

dataSource { 
    dbCreate = "update" 
    url = "jdbc:mysql://localhost:3306/docgem_test_db?useUnicode=yes&characterEncoding=UTF-8&autoReconnect=true" 
    // Your other properties 
} 
+0

@FrancescoDS Ban đầu tôi không nhận ra rằng bạn là tác giả của câu hỏi đang cố xóa IP của bạn khỏi bài đăng nhưng sau đó tôi đã chấp nhận chỉnh sửa của bạn. Nhưng tôi chỉ muốn cảnh báo bạn rằng IP thực của bạn vẫn hiển thị trong lịch sử chỉnh sửa câu trả lời của tôi, vì vậy hãy cân nhắc việc thêm bảo mật nếu IP của bạn có ứng dụng sản xuất hoặc cố gắng thay đổi nó nếu có thể. (Tôi cũng sẽ xóa bình luận này). –

0

Vui lòng thử dưới đây không việc bổ sung các driverClassNamedialect và tôi cũng nói thêm pooled trong trường hợp bạn cần điều đó

dataSource { 
    pooled = true 
    driverClassName = "com.mysql.jdbc.Driver" 
    dialect = "org.hibernate.dialect.MySQL5InnoDBDialect" 
    dbCreate = "update" 
    url = "jdbc:mysql://urlofapp/myappname? useUnicode=yes&characterEncoding=UTF-8&autoReconnect=true" 
    username = "root" 
    password = "root" 
    properties { 
     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;StatementCache(max=200)" 
     defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED 
} 

}

Các vấn đề liên quan