I'm trying to integrate HikariCP DB connection pool to new Grails 5.2.4 application (based on spring boot 2.7) without any success.
For grails 3 & 4 it works from the box: just add dependancy to build.gradle and double check dataSource.pooled property (have to be true)
implementation 'mysql:mysql-connector-java:8.0.22'
implementation 'com.zaxxer:HikariCP:5.0.1'
But with version 5 of grails happance nothing. I don't see any log messages, debugger not stopping on HikariDataSource constructor breackpoints.
Any ideas?
Related
I am trying to use Hibernate Core 6.x with Spring Boot / Spring Data JPA 2.7.x project, but it's not able to pick up Hibernate 6.x classes.
As you can see in the pom, in spring-boot-starter-data-jpa I have excluded hibernate-core 5.6.10-final and added 6.x as project dependency.
But I am seeing below error:
***************************
APPLICATION FAILED TO START
***************************
Description:
A component required a bean of type 'javax.persistence.EntityManagerFactory' that could not be found.
Action:
Consider defining a bean of type 'javax.persistence.EntityManagerFactory' in your configuration.
I don't think spring boot is autoconfiguring the new Hibernate 6.x version.
For 5.6.x, I could see below 11 implementations for EntityManager.
On moving to 6.x, I see only one implementation.
What's going on, I have no idea. Can some one pitch in and help resolve this issue.
Why I want 6.x -> See if RIGHT JOIN work in 6.x. Even other wise I see it's going to be a good task to figure out and make this combo work.
Hibernate 6 uses the JPA version (JPA 3) that uses the jakarta.persistence package names introduced in JakartaEE 9. Spring Boot 2.x still uses the javax.* package namespace of JakartaEE 8 and earlier (JPA 2.2 and earlier), and thus only supports Hibernate 5.x (for Spring Boot 2.7, Hibernate 5.6.x is the default).
Spring Boot 3 switched to the jakarta.* packages of JakartaEE 9+. So, you can upgrade to Spring Boot 3 to able to use Hibernate 6. If you cannot upgrade Spring Boot yet, you'll need to use Hibernate 5.6.
The Problem
We currently have a Spring MVC application (non-spring-boot) based on Spring 5 and Hibernate 5. We have to migrate the app to Hibernate 6.1.
During testing we are encountering exceptions once upgraded to Hibernate 6.1. The root cause exception
java.lang.NoClassDefFoundError:
Could not initialize class org.springframework.orm.hibernate5.LocalSessionFactoryBuilder
Is Spring 5 compatible with Hibernate 6.1? I checked the Spring.io website but could not find any compatibility information for spring-orm.
What I Expected
I expected the application to work with Hibernate 6.1 upgrade.
Environment
Spring MVC 5.3.21 (non-spring-boot)
Hibernate 6.1.0
Tomcat 9.0.64
Java 13
Ubuntu 20
Research Performed
I checked the spring.io website and reference manual. I could not find compatibility information for spring-orm and Hibernate 6.1
How to Reproduce
Deploy a Spring MVC web app (non-spring-boot) that uses Spring 5.3.21 and Hibernate 6.1
While upgrading JBoss server from 6 to 7.4, I got to know that Spring integration is no longer supported in JBoss EAP 7. But in my project we have used Apache CXF dependency injection to provide WS endpoints. But as spring integration is no longer supported, I need to replace Spring custom configurations with the new JBossWS descriptor configuration but I got no references anywhere.
This approach is specified in below URL at point no: 5.1.2
APPLICATION MIGRATION CHANGES
Can somebody help me with this migration?
I tried by removing servlet dependency from web.xml and it was working but then I WS endpoints stopped working as I removed the dependency injection. PFA for reference
I have a project with Vaadin 14 + Spring Boot 2.4.5 which runs on the embedded Jetty / jetty-maven-plugin 9.4
In my current Setup, sessions get persisted. I did not configure this (knowingly) and I don't want it.
I found how to enable session persistence:
https://docs.huihoo.com/jetty/the-definitive-reference/using-persistent-sessions.html#enabling-persistence-for-jetty-maven-plugin
The default value should be no persistence but I find no hint how to get back to this.
The embedded Jetty is managed by Spring Boot. You can set server.servlet.session.persistent=false in application.properties to disable session persistence.
when I use the spring session starter for spring boot 1.3.5 and set the version for spring session to 1.2 it comes to conflicts. Seems that it is not compatible and I have to wait for boot 1.4. OK...
To get it running I just added a dependency to spring session 1.2, without the starter and added a class which extends AbstractHttpSessionApplicationInitializer.
This works when I run it in an external tomcat but not when I run it in the embedded tomcat of boot 1.3.5.
Can I use SS 1.20 in SB 1.3.5?
Thank you
One step forward
Authentication auth = SecurityContextHolder.getContext().getAuthentication();
if(auth == null || !(auth.getPrincipal() instanceof UserDetailsImpl))
return null;
...
Here is always null returned although auth.getPrincipal() is an instance of UserDetailsImpl.
Seems to be a classloader issue.
But why does it work in an external tomcat? Any other classloading strategies here?
In short: yes, you can use Spring Session 1.2.x with Spring Boot 1.3.x without any problems.
Spring Session project contains many samples to help users get started with Spring Session (documentation on these samples is available here). Among these samples is also one that resembles your use case - Boot JDBC sample.
As shown in the samples and the docs you should use #EnableJdbcHttpSession annotation to bootstrap Spring Session JDBC support. If your app by any chance also uses Redis, you should exclude the SessionAutoConfiguration provided by Spring Boot 1.3 since your combination of dependencies will trigger the auto-configuration of Redis-backed Spring Session, which is something you don't want if you'd like to use JDBC-backed session store.