Home grails 3.0.2 mysql connectivity
Reply: 0

grails 3.0.2 mysql connectivity

user8378
1#
user8378 Published in September 19, 2018, 3:48 am

I have installed grails 3.0.2 and xampp server on my system. I want to connect to MySql of Xampp through grails. So made some changes in application.yml file located at grails-app/conf folder now it looks like

dataSource:
pooled: true
jmxExport: true
driverClassName: "com.mysql.jdbc.JDBC4MySQLConnection"//changed driver class
username: root                            //username 
password: 123456                          //password

//now in develoment environments i changed dbCreat->update and

//url-> jdbc:mysql://localhost:3306/myDB //i have not made any changes to test and production environments

environments:

development:
    dataSource:
        dbCreate: update
        url: jdbc:mysql://localhost:3306/myDB;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
test:
    dataSource:
        dbCreate: update
        url: jdbc:h2:mem:testDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE
production:
    dataSource:
        dbCreate: update
        url: jdbc:h2:prodDb;MVCC=TRUE;LOCK_TIMEOUT=10000;DB_CLOSE_ON_EXIT=FALSE

I am new to grails so i don't know where to place mysql-connector.jar but i have added path of my mysql-connector.jar in .dependencies file located at myProject/build folder.

When i try to run my app it gives a lot of errors and in end it gives exception as

Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.JDBC4MySQLConnection at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:340) at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(Poole dConnection.java:246) ... 83 more

i am not able to understand error. If their is any step my step tutorial for mysql connection with grails 3.0.2 and jdk 1.8 please post link.

Thanks in advance.

share|improve this question
  • usually a mysql jar missing from classpath. as you are on tomcat, it usually is in the WEB-INF (sp?) folder – Drew Aug 28 '15 at 5:36
  • WEB-INF/lib folder, if on tomcat. I guess we need to know what servlet engine if there is one. – Drew Aug 28 '15 at 6:11
  • You should use 3.0.4 to ensure that this isn't something that was fixed in 3.0.3 or 3.0.4 – Burt Beckwith Aug 28 '15 at 6:48

1 Answer 1

active oldest votes
up vote 1 down vote
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.296971 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO