Hi I am using below configuration still I am getting error.
spring.datasource.url=jdbc:oracle:thin#sca00tof.us.dell.com:1521:mfg1229
spring.datasource.username=apps
spring.datasource.password=xxxx
spring.datasource.driver-class=oracle.jdbc.driver.OracleDriver
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=Oracle12cDialect
below dependency i used in pom.xml
<dependency>
<groupId>com.oracle.database.jdbc</groupId>
<artifactId>ojdbc8</artifactId>
<scope>runtime</scope>
</dependency>
still I am getting below error.
Caused by: java.lang.ClassNotFoundException: Could not load requested class : Oracle12cDialect
at org.hibernate.boot.registry.classloading.internal.AggregatedClassLoader.findClass(AggregatedClassLoader.java:210) ~[hibernate-core-5.4.23.Final.jar:5.4.23.Final]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589) ~[na:na]
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[na:na]
at java.base/java.lang.Class.forName0(Native Method) ~[na:na]
at java.base/java.lang.Clas?s.forName(Class.java:427) ~[na:na]
enter code here
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:130) ~[hibernate-core-5.4.23.Final.jar:5.4.23.Final]
... 28 common frames omitted
WHat is the problem in my configuration. instead of driver-class i also checked with driver-class-name
I checked OracleDialect, Oracle10gDialect and Oracle12cDialect . for all the 3 i am getting same error.
there is nothing like "Oracle12cDialect" dialect. you need to write in proper way. :--
in your property file it is:
spring.jpa.properties.hibernate.dialect=Oracle12cDialect
spring.datasource.driver-class=oracle.jdbc.driver.OracleDriver
spring.datasource.url=jdbc:oracle:thin#sca00tof.us.dell.com:1521:mfg1229
but it should be:--
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.Oracle12cDialect
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.url=jdbc:oracle:thin#//sca00tof.us.dell.com:1521/mfg1229
if does not work then please change to:
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.Oracle10gDialect
The dialect for Oracle12c can be use with hibernate 5.x.
You should add this to your classpath:
<!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.4.24.Final</version>
</dependency>
Please note that you need the dialect for the coreesponding Version of Oracle DB.
How ever I can't see the exact framework you are using. Please check that the obove dependency is part of your classpath. This may come with other dependencies such as JPA oder spring-data.
Also please note that your jdbc string seems to be wrong.
It should look like this:
url="jdbc:oracle:thin:#sca00tof.us.dell.com:1521:mfg1229"
See here for details: URL string format for connecting to Oracle database with JDBC
Related
I introduced the spring-boot-starter-web, used its own spring-boot-starter-logging framework, specified the configuration file in yaml, and reported startup errors
yaml:
logging:
level:
root: info
com.felix.flink.tutorial.api: debug
config: classpath:logback-spring.xml
maven:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.felix</groupId>
<artifactId>flink-tutorial-component</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>
exception:
23:45:33.009 [Thread-0] DEBUG org.springframework.boot.devtools.restart.classloader.RestartClassLoader - Created RestartClassLoader org.springframework.boot.devtools.restart.classloader.RestartClassLoader#7abaedae
Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException
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.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49)
Caused by: java.lang.NoClassDefFoundError: org/slf4j/impl/StaticLoggerBinder
at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext(LogbackLoggingSystem.java:293)
at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:118)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:238)
at org.springframework.boot.context.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:220)
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131)
at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:79)
at org.springframework.boot.SpringApplicationRunListeners.lambda$starting$0(SpringApplicationRunListeners.java:56)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
at org.springframework.boot.SpringApplicationRunListeners.doWithListeners(SpringApplicationRunListeners.java:120)
at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:56)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:299)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
at com.felix.flink.tutorial.api.FlinkTutorialApiApplication.main(FlinkTutorialApiApplication.java:15)
... 5 more
Caused by: java.lang.ClassNotFoundException: org.slf4j.impl.StaticLoggerBinder
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 22 more
Process finished with exit code 0
i have import slf4j 2.0.3 derect in the pom,but it doesn't work
SLF4J drastically changed the way its implementations are found between versions 1.x and 2.x. In 1.x, the binding class needed to provide a class named org.slf4j.impl.StaticLoggerBinder - the class that's missing. In 2.x it uses the ServiceLoader mechanism.
Spring Boot currently still uses SLF4J 1.7.36, through spring-boot-starter-web -> spring-boot-starter -> spring-boot-starter-logging. The latter depends on some SLF4J bridges, as well as logback-classic which in turn depends on SLF4J 1.7.32. I think that the 1.7.36 "wins" over the 1.7.32.
Unless one of your other dependencies has a transitive dependency on SLF4J 2.x, everything should work just fine. If you do, then you have a mix of SLF4J 1.x and 2.x, and that's simply not going to work. Replace the 2.x dependency with a 1.x dependency and you should be fine (unless you use the fluent API that was added in 2.x).
I am trying to set up Hibernate in my project to enable ORM-based storage in my database.
Right now I am simply trying to load a configuration in Hibernate to open a session. I figured that this would be an easy test to see if everything worked, after which I could start on the more daunting tasks of actually mapping my classes.
But I didn't realise that just getting to load Hibernate would already be a process that I'd get stuck on for over a day.
Yesterday I couldn't get past an issue with loading the .cfg.xml files. I would continously run into this error:
[15:40:41 ERROR]: [org.bukkit.craftbukkit.v1_19_R1.CraftServer] Unable to perform unmarshalling at line number 0 and column 0 in RESOURCE test.cfg.xml. Message: null initializing LiberCore v0.3 (Is it up to date?)
org.hibernate.internal.util.config.ConfigurationException: Unable to perform unmarshalling at line number 0 and column 0 in RESOURCE test.cfg.xml. Message: null
at org.hibernate.boot.cfgxml.internal.JaxbCfgProcessor.unmarshal(JaxbCfgProcessor.java:134) ~[?:?]
at org.hibernate.boot.cfgxml.internal.JaxbCfgProcessor.unmarshal(JaxbCfgProcessor.java:66) ~[?:?]
at org.hibernate.boot.cfgxml.internal.ConfigLoader.loadConfigXmlResource(ConfigLoader.java:57) ~[?:?]
at org.hibernate.boot.registry.StandardServiceRegistryBuilder.configure(StandardServiceRegistryBuilder.java:254) ~[?:?]
at org.hibernate.cfg.Configuration.configure(Configuration.java:260) ~[?:?]
at net.libercraft.data.database.HibernateManager.<init>(HibernateManager.java:29) ~[?:?]
at net.libercraft.data.DataManager.initializeDatabase(DataManager.java:17) ~[?:?]
at net.libercraft.main.Main.onLoad(Main.java:34) ~[?:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.loadPlugins(CraftServer.java:460) ~[purpur-1.19.2.jar:git-Purpur-1765]
at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:314) ~[purpur-1.19.2.jar:git-Purpur-1765]
at net.minecraft.server.MinecraftServer.v(MinecraftServer.java:1142) ~[purpur-1.19.2.jar:git-Purpur-1765]
at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:310) ~[purpur-1.19.2.jar:git-Purpur-1765]
at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:278) ~[?:?]
at javax.xml.bind.ContextFinder.find(ContextFinder.java:421) ~[?:?]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721) ~[?:?]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662) ~[?:?]
at org.hibernate.boot.cfgxml.internal.JaxbCfgProcessor.unmarshal(JaxbCfgProcessor.java:123) ~[?:?]
... 12 more
Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:445) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:587) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
at javax.xml.bind.ServiceLoaderUtil.nullSafeLoadClass(ServiceLoaderUtil.java:122) ~[?:?]
at javax.xml.bind.ServiceLoaderUtil.safeLoadClass(ServiceLoaderUtil.java:155) ~[?:?]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:276) ~[?:?]
at javax.xml.bind.ContextFinder.find(ContextFinder.java:421) ~[?:?]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721) ~[?:?]
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662) ~[?:?]
at org.hibernate.boot.cfgxml.internal.JaxbCfgProcessor.unmarshal(JaxbCfgProcessor.java:123) ~[?:?]
... 12 more
Googling + reading other posts first just pointed me to a bunch of libraries to add because JAXB was no longer included with java by default. So I tried adding the following (different posts pointed to different libraries which made it pretty confusing..):
<dependency>
<groupId>javax.transaction</groupId>
<artifactId>javax.transaction-api</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>javax.persistence-api</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.2.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>6.0.4.Final</version>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.25.0-GA</version>
</dependency>
This didn't change much as I just kept getting the same error.
After a bit of googling, I found something that explained about a jaxb.properties file that I could use to change the package pointing to com.sun.xml.internal.bind.v2.ContextFactory to a package that should be included. This worked for some time, at which point I just got errors that it couldn't find my cfg.xml files. When I tried placing those at a different location in my .jar, I went back to the error above however.
I also read about using a hibernate.properties file instead of using xml. However, I want to include different config files in my jar and select one based on the environment that my application is running in. For that reason I don't want to try just a simple hibernate.properties file, since that won't really allow me to customize it.
Today I decided to take a different route. Instead of providing the configuration via the xml file, I would just enter the configuration programmatically. This has solved the previous error of not being able to process the xml files.
But now I am getting new errors that I am unable to solve.
[09:22:53 ERROR]: [org.bukkit.craftbukkit.v1_19_R1.CraftServer] com/fasterxml/classmate/TypeResolver initializing LiberCore v0.3 (Is it up to date?)
java.lang.NoClassDefFoundError: com/fasterxml/classmate/TypeResolver
at org.hibernate.boot.internal.ClassmateContext.<init>(ClassmateContext.java:16) ~[?:?]
at org.hibernate.boot.internal.BootstrapContextImpl.<init>(BootstrapContextImpl.java:81) ~[?:?]
at org.hibernate.boot.internal.MetadataBuilderImpl.<init>(MetadataBuilderImpl.java:124) ~[?:?]
at org.hibernate.boot.MetadataSources.getMetadataBuilder(MetadataSources.java:158) ~[?:?]
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:673) ~[?:?]
at net.libercraft.data.database.HibernateManager.<init>(HibernateManager.java:50) ~[?:?]
at net.libercraft.data.DataManager.initializeDatabase(DataManager.java:17) ~[?:?]
at net.libercraft.main.Main.onLoad(Main.java:34) ~[?:?]
at org.bukkit.craftbukkit.v1_19_R1.CraftServer.loadPlugins(CraftServer.java:460) ~[purpur-1.19.2.jar:git-Purpur-1765]
at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:314) ~[purpur-1.19.2.jar:git-Purpur-1765]
at net.minecraft.server.MinecraftServer.v(MinecraftServer.java:1142) ~[purpur-1.19.2.jar:git-Purpur-1765]
at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:310) ~[purpur-1.19.2.jar:git-Purpur-1765]
at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: java.lang.ClassNotFoundException: com.fasterxml.classmate.TypeResolver
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:153) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:105) ~[purpur-api-1.19.2-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:520) ~[?:?]
... 13 more
After googling I found a few posts that give some solutions:
How to resolve java.lang.NoClassDefFoundError: com/fasterxml/classmate/TypeResolver while running spring boot app
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.JavaType not found
but these are not much help to me.
I tried adding the hibernate-validator library (multiple versions) but it didn't solve the error. I wouldn't know how I could swap the com.fasterxml.jackson with org.codehaus.jackson packages or even if there are org.codehaus.jackson being used in my project.
I feel like I'm doing something essentially wrong. Because in between these errors that I just can't solve, I am getting a lot more ClassNotFoundException etc. that require me to just import more maven libraries to fix them. Isn't that something that Maven should take care of by itself? Like, shouldn't it automatically load any dependant libraries for the libraries that I add to my pom.xml? Why is it requiring me to add all of those manually before my software will work.
None of the tutorial videos on youtube talk about that process, they simply tell you to add the single maven dependancy for hibernate itself. No extra libraries required. So it seems odd to me that I'm being led in that direction by these errors.
It is quite essential for me to implement an ORM solution to my project, and I'm bummed out it's going this way for me. I heard Hibernate was the best solution for this, but maybe there's different solutions for me to try out?
For some context: I'm working on a plugin for the game minecraft and the database will be used to store data about players and other game features.
Bear in mind that if you are on a recent platform 'javax' libraries may have moved to the package 'jakarta'. Try searching in your IDE/classpath what the actual implementations are! I have been successful with this.
<dependency>
<groupId>jakarta.activation</groupId>
<artifactId>javax.activation-api</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>4.0.0</version>
</dependency>
I have a app running with JDBC and get data from MySQL, but I can't build it because of this error :
java.sql.SQLException: Unknown system variable 'query_cache_size'
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964) ~[mysql-connector-java-5.1.41.jar:5.1.41]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3973) ~[mysql-connector-java-5.1.41.jar:5.1.41]
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3909) ~[mysql-connector-java-5.1.41.jar:5.1.41]
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2527) ~[mysql-connector-java-5.1.41.jar:5.1.41]
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2680) ~[mysql-connector-java-5.1.41.jar:5.1.41]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2497) ~[mysql-connector-java-5.1.41.jar:5.1.41]
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2455) ~[mysql-connector-java-5.1.41.jar:5.1.41]
at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1369) ~[mysql-connector-java-5.1.41.jar:5.1.41]
at com.mysql.jdbc.ConnectionImpl.loadServerVariables(ConnectionImpl.java:3777) ~[mysql-connector-java-5.1.41.jar:5.1.41]
at com.mysql.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:3240) ~[mysql-connector-java-5.1.41.jar:5.1.41]
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2249) ~[mysql-connector-java-5.1.41.jar:5.1.41]
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2035) ~[mysql-connector-java-5.1.41.jar:5.1.41]
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:790) ~[mysql-connector-java-5.1.41.jar:5.1.41]
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47) ~[mysql-connector-java-5.1.41.jar:5.1.41]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.8.0_131]
I have file application.properties here
#specs.dir=/specs/
#
#################### Spring Boot Data Source Configuration ############
#spring.datasource.driver-class-name=com.mysql.jdbc.Driver
#spring.datasource.url=jdbc:mysql://localhost:3306/savingbooking?useSSL=false
#spring.datasource.username=root
#spring.datasource.password=ZAQ!2wsx
#spring.datasource.initialize=true
#spring.jpa.hibernate.ddl-auto=update
#spring.jpa.properties.hibernate.format_sql=true
#spring.jpa.show-sql=true
#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQLDialect
Mysql workbench is 8.0 version
query_cache_size was removed in MySQL 8. Check the docs.
It works with JDBC driver 5.1.44.
java.sql.SQLException: Unknown system variable 'query_cache_size'
In pom file of your project, just update the version of the dependency.
For example it's 6.0.2 of mysql java connector just update it to latest one like 8.0.11
It works!!!!
I had a similar problem.
I resolved it by specifying the version in mysql dependency
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.45</version>
<scope>runtime</scope>
</dependency>
Worked like a charm for me.
Try using MySQL 8.0.3
As can be seen on the docs, the query_cache_size was removed on MySQL8. JetBrains guys have suffered the same issue, is seems to be that it is fixed by updating the driver to the version MySQL JDBC driver v 5.1.44.
For mysql 8:
mysql-connector-java-8.0.17.jar (or above)
+
db.driver=com.mysql.cj.jdbc.Driver instead of com.mysql.jdbc.Driver
I stuck on this issue, spend full one day and finally i got solution.
Solution :
1) Use exact mysql-connector-java jar or dependency as your mysql version.
2) if your mysql version is 8 or 6+ try to use this "com.mysql.cj.jdbc.Driver" driver class.
If you using MySql v8.0 then you should try fix this bug with
mysql-connector-java-5.1.9
This exception is related to pom.xml dependency.
When I use below dependency in pox.xml:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>6.0.5</version>
</dependency>
It shows exception:Caused by: java.sql.SQLException: Unknown system variable query_cache_size
But, when I use below dependency:
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.13</version>
</dependency>
It works.You have to use latest dependency
Ok so what I did as metioned above. I just added the mysql-connector-java-5.1.4 to build path and ran the project on my server and connected fine to mysql
just change the version of mysql
use this in pom.xml
<version>8.0.11</version>
Use Below mention dependency it will work for you!
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.16</version>
</dependency>
I've searched lot in the Internet but cannot find a solution to make Spring Hibernate works with SQlite (e.g: this answers https://stackoverflow.com/a/24233241/2028440 told to make a custom SQLite package and it is not ideally, I'd expect to have a .jar file as a dependency from Maven repository for SQL dialect).
I also tried this jar library https://github.com/EnigmaBridge/hibernate4-sqlite-dialect in POM as:
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.16.1</version>
</dependency>
<dependency>
<groupId>com.enigmabridge</groupId>
<artifactId>hibernate4-sqlite-dialect.git</artifactId>
<version>0.1.0</version>
</dependency>
and in application.properties:
spring.datasource.url = jdbc:sqlite:test.db
spring.datasource.driver-class-name = org.sqlite.JDBC
spring.jpa.properties.hibernate.dialect = com.enigmabridge.hibernate.dialect.SQLiteDialect
However, I got the error when running the web application from Spring boot hibernate
Caused by:
org.hibernate.boot.registry.selector.spi.StrategySelectionException: Unable to resolve name [com.enigmabridge.hibernate.dialect.SQLiteDialect] as strategy [org.hibernate.dialect.Dialect]
at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.selectStrategyImplementor(StrategySelectorImpl.java:113) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.resolveDefaultableStrategy(StrategySelectorImpl.java:162) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
at org.hibernate.boot.registry.selector.internal.StrategySelectorImpl.resolveDefaultableStrategy(StrategySelectorImpl.java:126) ~[hibernate-core-5.0.12.Final.jar:5.0.12.Final]
If anyone has some suggestions, please help, thanks!
I'm getting the following errors :
Caused by: javax.persistence.PersistenceException: Failed to load provider from META-INF/services
at javax.persistence.spi.PersistenceProviderResolverHolder$DefaultPersistenceProviderResolver.getPersistenceProviders(PersistenceProviderResolverHolder.java:115)
at javax.persistence.Persistence$PersistenceUtilImpl.isLoaded(Persistence.java:278)
at org.hibernate.validator.engine.resolver.JPATraversableResolver.isReachable(JPATraversableResolver.java:62)
at org.hibernate.validator.engine.resolver.DefaultTraversableResolver.isReachable(DefaultTraversableResolver.java:94)
at org.hibernate.validator.engine.resolver.SingleThreadCachedTraversableResolver.isReachable(SingleThreadCachedTraversableResolver.java:47)
at org.hibernate.validator.engine.ValidatorImpl.isValidationRequired(ValidatorImpl.java:757)
... 96 more
Caused by: java.lang.ClassNotFoundException: me.prettyprint.hom.CassandraPersistenceProvider
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1858)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1709)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at org.apache.geronimo.osgi.locator.ProviderLocator.loadClass(ProviderLocator.java:195)
at org.apache.geronimo.osgi.locator.ProviderLocator.locateServiceClasses(ProviderLocator.java:524)
at org.apache.geronimo.osgi.locator.ProviderLocator.getServices(ProviderLocator.java:315)
at javax.persistence.spi.PersistenceProviderResolverHolder$DefaultPersistenceProviderResolver.getPersistenceProviders(PersistenceProviderResolverHolder.java:108)
... 101 more
I have imported a pom dependeny in my project, the new pom dependeny inturn has some cassandra related dependeny shown below :
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-core</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-mapping</artifactId>
<version>3.0.0</version>
</dependency>
The cassandra project works good in stand alone. Can someone help me with this
Your project is complaining ClassNotFoundException:me.prettyprint.hom.CassandraPersistenceProvider which belongs to Cassandra hector client.
I am guessing your project was using hector core which is no longer active hector client github page. You have to migrate all dependencies to datastax's cassandra drivers and remove all hector-client related dependencies. check it here