Closed aniplayIt closed 4 months ago
Open api generator is known to be broken: https://github.com/jhipster/generator-jhipster/pull/22658
Every redis test is passing:
May be related to windows?
Just tested on Mac with both redis and redis cluster but got the exact same exception
JHipster has completed the sample check
.yo-rc.json
: valid
Entities JDL: blank
Application: successfully generated
Frontend check: success
Backend check: failure
E2E check: failure
This check uses jhipster info
output from the issue description to generate the sample.
Bug report that does not contain this information will be marked as invalid.
I was able to reproduce this error using Maven + Redis + MySQL + Elasticsearch on a M1 MacBook Pro.
As I was able to replicate the issue. I was able to pass the test by doing the following modification in the DomainUserDetailsService class.
New Code: ` public UserDetails loadUserByUsername(final String login) { log.debug("Authenticating {}", login);
if (new EmailValidator().isValid(login, null)) {
Optional<User> userByEmailFromDatabase = userRepository.findOneByEmailIgnoreCase(login);
User user = userByEmailFromDatabase.orElseThrow(() -> new UsernameNotFoundException("User with email " + login + " was not found in the database"));
return createSpringSecurityUser(login, user);
}
String lowercaseLogin = login.toLowerCase(Locale.ENGLISH);
Optional<User> userByLoginFromDatabase = userRepository.findOneByLogin(lowercaseLogin);
User user = userByLoginFromDatabase.orElseThrow(() -> new UsernameNotFoundException("User " + lowercaseLogin + " was not found in the database"));
return createSpringSecurityUser(lowercaseLogin, user);
}`
Any new about this issue? I tried to use the code posted by @mluckenbill , but I'm receiving the same issue. jhipsterInfo.txt
Error log: logRedisError.txt
Can you help me?
Facing the same issue with 8.1.0.
I faced the same issue:
javax.cache.CacheException: com.esotericsoftware.kryo.KryoException: org.hibernate.LazyInitializationException: failed to lazily initialize a collection: could not initialize proxy - no Session
jHipster Version: 8.1.0 Generated by Jhipster web: Monolith, JWT, Postgres DB (Prod&Dev), Redis, Hibernate 2nd Cache, Angular and Gradle Node: v20.11.1 NPM: 10.2.4 OS: Windows 11
redisson-3.19.0 Breaking change - default codec changed to Kryo5Codec
java - Tomcat with RedissonSessionManager cannot deserialize SecurityContextImpl - Stack Overflow
Config config = new Config();
// config.setCodec(new org.redisson.codec.MarshallingCodec());
config.setCodec(new org.redisson.codec.SerializationCodec());
if (jHipsterProperties.getCache().getRedis().isCluster()) {
@solnone can you provide a PR?
Codec Update: SerializationCodec for Redis Fix https://github.com/jhipster/generator-jhipster/pull/25988
@solnone micronaut needs the same fix: https://github.com/jhipster/generator-jhipster-micronaut/blob/8884f9341521ccb69631913f04c2b05f7616ee9f/generators/micronaut-cache/templates/src/main/java/_package_/config/CacheConfiguration.java.ejs#L70
Do you want to provide a PR?
Overview of the issue
As fresh created project:
The app can't start:
Adding
validateSpec = false skipValidateSpec = true
in swagger.gradle let the app start but it's not a valid fix.The ApiUtil from OpenApi generated files requires the
import javax.servlet.http.HttpServletResponse;
. Adding the dependencyjavax.servlet:javax.servlet-api
fixes the issue but it's not a valid fix.After running Redis container with redis.yml or redis-cluster.yml the app can't connect to the redis instance. Running the command
redis-cli --cluster fix localhost:6379
inside the redis container fixed the issue. Don't know if it's the proper way to use this.After running the app I cannot execute more than one api call. Let's say I authenticate myself receiving the bearer token correctly, if I ask then for my account data (passing the token) I get the following error:
com.esotericsoftware.kryo.KryoException: org.hibernate.LazyInitializationException: failed to lazily initialize a collection: could not initialize proxy - no Session Serialization trace: authorities (it.app.my_service.domain.User) at com.esotericsoftware.kryo.serializers.ReflectField.read(ReflectField.java:146) at com.esotericsoftware.kryo.serializers.FieldSerializer.read(FieldSerializer.java:129) at com.esotericsoftware.kryo.Kryo.readClassAndObject(Kryo.java:880) at org.redisson.codec.Kryo5Codec$4.decode(Kryo5Codec.java:144) at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:393) at org.redisson.client.handler.CommandDecoder.decodeCommand(CommandDecoder.java:205) at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:144) at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:120) at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529) at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366) at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412) at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440) at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420) at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:788) at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:724) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:650) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:562) at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) at java.base/java.lang.Thread.run(Thread.java:833) Caused by: org.hibernate.LazyInitializationException: failed to lazily initialize a collection: could not initialize proxy - no Session at org.hibernate.collection.spi.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:635) at org.hibernate.collection.spi.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:218) at org.hibernate.collection.spi.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:615) at org.hibernate.collection.spi.PersistentSet.add(PersistentSet.java:184) at com.esotericsoftware.kryo.serializers.CollectionSerializer.read(CollectionSerializer.java:241) at com.esotericsoftware.kryo.serializers.CollectionSerializer.read(CollectionSerializer.java:44) at com.esotericsoftware.kryo.Kryo.readObject(Kryo.java:799) at com.esotericsoftware.kryo.serializers.ReflectField.read(ReflectField.java:124) ... 26 common frames omitted
? What is the base name of your application? prova2 ? Which type of application would you like to create? Monolithic application (recommended for simple projects) ? Would you like to enable internationalization support? Yes ? Please choose the native language of the application English ? Please choose additional languages to install Italian ? Do you want to make it reactive with Spring WebFlux? No ? What is your default Java package name? com.mycompany.myapp ? Which type of authentication would you like to use? JWT authentication (stateless, with a token) ? Which type of database would you like to use? SQL (H2, PostgreSQL, MySQL, MariaDB, Oracle, MSSQL) ? Which production database would you like to use? PostgreSQL ? Which development database would you like to use? PostgreSQL ? Which cache do you want to use? (Spring cache abstraction) Redis (distributed cache) ? Do you want to use Hibernate 2nd level cache? Yes ? Would you like to use Maven or Gradle for building the backend? Gradle ? Which other technologies would you like to use? Elasticsearch as search engine, WebSockets using Spring Websocket, API first development using OpenAPI-generator ? Which Framework would you like to use for the client? No client ? Besides JUnit and Jest, which testing frameworks would you like to use? Cucumber
-- generator-jhipster@8.0.0-beta.2
JHipster configuration, a
.yo-rc.json
file generated in the root folder.yo-rc.json file
Environment and Tools
java version "17.0.7" 2023-04-18 LTS Java(TM) SE Runtime Environment (build 17.0.7+8-LTS-224) Java HotSpot(TM) 64-Bit Server VM (build 17.0.7+8-LTS-224, mixed mode, sharing)
git version 2.39.1.windows.1
node: v18.16.1 npm: 9.7.2
Docker version 24.0.2, build cb74dfc
JDL for the Entity configuration(s)
entityName.json
files generated in the.jhipster
directoryJDL entity definitions
✔ applying multi-step templates info Multiple customCommitTask tasks found (...#jhipster:info, jhipster:bootstrap). Using the first.
Congratulations, JHipster execution is complete!