Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Error java.sql.SQLException: No suitable driver found for jdbc:mysql:XXXXXXXXXXXX (After upgrade to scout 11)
Error java.sql.SQLException: No suitable driver found for jdbc:mysql:XXXXXXXXXXXX [message #1839856] Tue, 30 March 2021 10:36 Go to next message
Oueslati Anis is currently offline Oueslati AnisFriend
Messages: 134
Registered: June 2014
Location: Paris
Senior Member
Hello,
I have the following error after upgrading to scout 11 on prod.

org.eclipse.scout.rt.platform.exception.BeanCreationException: Exception while invoking @PostConstruct method public void com.scout.app.server.db.sql.DatabaseSetupService.autoCreateDatabase() throws java.sql.SQLException
        at org.eclipse.scout.rt.platform.internal.BeanInstanceUtil.translateException(BeanInstanceUtil.java:171)
        at org.eclipse.scout.rt.platform.internal.BeanInstanceUtil.initializeBeanInstance(BeanInstanceUtil.java:106)
        at org.eclipse.scout.rt.platform.internal.BeanInstanceUtil.initializeBeanInstance(BeanInstanceUtil.java:77)
        at org.eclipse.scout.rt.platform.internal.SingeltonBeanInstanceProducer.createInstance(SingeltonBeanInstanceProducer.java:236)
        at org.eclipse.scout.rt.platform.internal.SingeltonBeanInstanceProducer.getOrCreateInstance(SingeltonBeanInstanceProducer.java:112)
        at org.eclipse.scout.rt.platform.internal.SingeltonBeanInstanceProducer.lambda$0(SingeltonBeanInstanceProducer.java:95)
        at org.eclipse.scout.rt.platform.internal.BeanInstanceUtil.createAndAssertNoCircularDependency(BeanInstanceUtil.java:149)
        at org.eclipse.scout.rt.platform.internal.SingeltonBeanInstanceProducer.produce(SingeltonBeanInstanceProducer.java:95)
        at org.eclipse.scout.rt.platform.internal.BeanImplementor.getInstance(BeanImplementor.java:98)
        at org.eclipse.scout.rt.platform.internal.BeanManagerImplementor.startCreateImmediatelyBeans(BeanManagerImplementor.java:338)
        at org.eclipse.scout.rt.platform.internal.PlatformImplementor.startCreateImmediatelyBeans(PlatformImplementor.java:242)
        at org.eclipse.scout.rt.platform.internal.PlatformImplementor.start(PlatformImplementor.java:141)
        at org.eclipse.scout.rt.platform.internal.PlatformStarter.run(PlatformStarter.java:30)
Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql:XXXXXXXXXXXX
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:702)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:251)
        at com.scout.app.server.db.sql.DatabaseSetupService.autoCreateDatabase(DatabaseSetupService.java:66)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at org.eclipse.scout.rt.platform.internal.BeanInstanceUtil.initializeBeanInstance(BeanInstanceUtil.java:103)
        ... 11 common frames omitted


This is not happening on dev environment, only when deploying to tomcat.
Database for dev is same used with tomcat and they are on same machine.
Does anyone have any idea how to solve this issue.
Kind Regards
Re: Error java.sql.SQLException: No suitable driver found for jdbc:mysql:XXXXXXXXXXXX [message #1839871 is a reply to message #1839856] Tue, 30 March 2021 16:27 Go to previous messageGo to next message
Matthias OtterbachFriend
Messages: 58
Registered: August 2015
Location: Munich
Member
Sounds to me if the JDBC driver cannot be found for MySQL. Scout itself does not provide any dependencies to the database drivers because people may use different databases. If you add the MySQL driver as dependency (to the class path) this may help, e.g.

<dependency>
    <groupId>mysql</groupId>
    <artifactId>mysql-connector-java</artifactId>
    <version>8.0.23</version>
</dependency>
Re: Error java.sql.SQLException: No suitable driver found for jdbc:mysql:XXXXXXXXXXXX [message #1839878 is a reply to message #1839871] Tue, 30 March 2021 19:05 Go to previous messageGo to next message
Oueslati Anis is currently offline Oueslati AnisFriend
Messages: 134
Registered: June 2014
Location: Paris
Senior Member
Hello,
No, that is not the problem, the application was working fine with version 10 and the driver exists like you mentioned, I noticed the issue after upgrading to 11.
Kind Regards
Re: Error java.sql.SQLException: No suitable driver found for jdbc:mysql:XXXXXXXXXXXX [message #1839941 is a reply to message #1839878] Thu, 01 April 2021 14:49 Go to previous messageGo to next message
Oueslati Anis is currently offline Oueslati AnisFriend
Messages: 134
Registered: June 2014
Location: Paris
Senior Member
Hello,
I solved the issue by adding
Class.forName("com.mysql.cj.jdbc.Driver");
to the DatabaseSetupService just before calling the driver to establish the connection and it works now.
Kind Regards
Re: Error java.sql.SQLException: No suitable driver found for jdbc:mysql:XXXXXXXXXXXX [message #1839943 is a reply to message #1839941] Thu, 01 April 2021 15:25 Go to previous message
Andre Wegmueller is currently offline Andre WegmuellerFriend
Messages: 204
Registered: September 2012
Location: Baden-Dättwil, Switzerla...
Senior Member
Thanks for posting your solution here!

André


Eclipse Scout Homepage | Documentation | GitHub
Previous Topic:JS - Java questions
Next Topic:REST Client: fetching data and populating a table
Goto Forum:
  


Current Time: Sat Nov 09 01:37:07 GMT 2024

Powered by FUDForum. Page generated in 0.09133 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top