Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Save Object by uuid #217

Open
mai1015 opened this issue Nov 14, 2021 · 1 comment
Open

Save Object by uuid #217

mai1015 opened this issue Nov 14, 2021 · 1 comment

Comments

@mai1015
Copy link

mai1015 commented Nov 14, 2021

When save an object with UUID will trigger an error that try to convert long to uuid.
I assume that it is trying to read the id from database response and causing this error since the database is using UUID.

public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
//    @Type(type = "uuid-char")
//    @GeneratedValue(generator = "UUID")
//    @GenericGenerator(name = "UUID", strategy = "org.hibernate.id.UUIDGenerator")
    private UUID id;

    @NotNull
    @Pattern(regexp = Constants.LOGIN_REGEX)
    @Size(min = 1, max = 50)
    private String login;

    @JsonIgnore
    @NotNull
    @Size(min = 60, max = 60)
    @Column("password_hash")
    private String password;
// other implmenetation
}
2021-11-15 01:03:29.430 ERROR 34176 --- [actor-tcp-nio-2] o.z.problem.spring.common.AdviceTraits   : Internal Server Error

org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.Long] to type [java.util.UUID]
	at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:322)
	Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
Assembly trace from producer [reactor.core.publisher.MonoMapFuseable] :
	reactor.core.publisher.Mono.map(Mono.java:3354)
	dev.miku.r2dbc.mysql.MySqlResult.map(MySqlResult.java:95)
Error has been observed at the following site(s):
	|_           Mono.map ⇢ at dev.miku.r2dbc.mysql.MySqlResult.map(MySqlResult.java:95)
	|_       Flux.flatMap ⇢ at org.springframework.r2dbc.core.DefaultFetchSpec.lambda$all$2(DefaultFetchSpec.java:89)
	|_     Flux.usingWhen ⇢ at org.springframework.r2dbc.core.DefaultDatabaseClient.inConnectionMany(DefaultDatabaseClient.java:134)
	|_    Flux.onErrorMap ⇢ at org.springframework.r2dbc.core.DefaultDatabaseClient.inConnectionMany(DefaultDatabaseClient.java:146)
	|_          Flux.last ⇢ at org.springframework.data.r2dbc.core.R2dbcEntityTemplate.doInsert(R2dbcEntityTemplate.java:612)
	|_       Mono.flatMap ⇢ at org.springframework.data.r2dbc.core.R2dbcEntityTemplate.doInsert(R2dbcEntityTemplate.java:613)
	|_       Mono.flatMap ⇢ at org.springframework.data.r2dbc.core.R2dbcEntityTemplate.lambda$doInsert$9(R2dbcEntityTemplate.java:553)
	|_       Mono.flatMap ⇢ at org.springframework.data.r2dbc.core.R2dbcEntityTemplate.doInsert(R2dbcEntityTemplate.java:544)
	|_     Mono.usingWhen ⇢ at org.springframework.data.repository.core.support.RepositoryMethodInvoker$ReactiveInvocationListenerDecorator.decorate(RepositoryMethodInvoker.java:226)
	|_           Mono.map ⇢ at com.dataraction.service.UserService.lambda$saveUser$30(UserService.java:322)
	|_       Mono.flatMap ⇢ at com.dataraction.service.UserService.lambda$saveUser$30(UserService.java:326)
	|_       Mono.flatMap ⇢ at com.dataraction.service.UserService.saveUser(UserService.java:313)
	|_       Mono.flatMap ⇢ at com.dataraction.service.UserService.lambda$registerUser$12(UserService.java:175)
	|_       Mono.flatMap ⇢ at com.dataraction.service.UserService.lambda$registerUser$12(UserService.java:176)
	|_      Mono.doOnNext ⇢ at com.dataraction.service.UserService.lambda$registerUser$12(UserService.java:177)
	|_       Mono.flatMap ⇢ at com.dataraction.service.UserService.registerUser(UserService.java:168)
	|_      Mono.doOnNext ⇢ at com.dataraction.service.UserService.registerUser(UserService.java:179)
	|_     Mono.usingWhen ⇢ at org.springframework.transaction.interceptor.TransactionAspectSupport$ReactiveTransactionSupport.lambda$null$3(TransactionAspectSupport.java:914)
	|_          Mono.then ⇢ at org.springframework.transaction.interceptor.TransactionAspectSupport$ReactiveTransactionSupport.lambda$null$2(TransactionAspectSupport.java:928)
	|_ Mono.onErrorResume ⇢ at org.springframework.transaction.interceptor.TransactionAspectSupport$ReactiveTransactionSupport.lambda$null$3(TransactionAspectSupport.java:927)
	|_       Mono.flatMap ⇢ at org.springframework.transaction.interceptor.TransactionAspectSupport$ReactiveTransactionSupport.lambda$invokeWithinTransaction$4(TransactionAspectSupport.java:911)
	|_       Mono.flatMap ⇢ at org.springframework.transaction.interceptor.TransactionAspectSupport$ReactiveTransactionSupport.invokeWithinTransaction(TransactionAspectSupport.java:910)
	|_  Mono.contextWrite ⇢ at org.springframework.transaction.interceptor.TransactionAspectSupport$ReactiveTransactionSupport.invokeWithinTransaction(TransactionAspectSupport.java:934)
	|_  Mono.contextWrite ⇢ at org.springframework.transaction.interceptor.TransactionAspectSupport$ReactiveTransactionSupport.invokeWithinTransaction(TransactionAspectSupport.java:935)
	|_   Mono.doOnSuccess ⇢ at com.dataraction.web.rest.user.AccountResource.registerAccount(AccountResource.java:129)
	|_          Mono.then ⇢ at com.dataraction.web.rest.user.AccountResource.registerAccount(AccountResource.java:129)
	|_       Mono.flatMap ⇢ at org.springframework.web.reactive.result.method.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:137)
	|_         Mono.defer ⇢ at org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter.handle(RequestMappingHandlerAdapter.java:199)
	|_          Mono.then ⇢ at org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter.handle(RequestMappingHandlerAdapter.java:199)
	|_      Mono.doOnNext ⇢ at org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter.handle(RequestMappingHandlerAdapter.java:200)
	|_      Mono.doOnNext ⇢ at org.springframework.web.reactive.result.method.annotation.RequestMappingHandlerAdapter.handle(RequestMappingHandlerAdapter.java:201)
Stack trace:
		at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:322)
		at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:195)
		at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:175)
		at org.springframework.data.r2dbc.convert.MappingR2dbcConverter.potentiallySetId(MappingR2dbcConverter.java:644)
		at org.springframework.data.r2dbc.convert.MappingR2dbcConverter.lambda$populateIdIfNecessary$1(MappingR2dbcConverter.java:615)
		at dev.miku.r2dbc.mysql.MySqlResult.lambda$map$2(MySqlResult.java:97)
		at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:113)
		at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:200)
		at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1816)
		at reactor.core.publisher.NextProcessor.tryEmitValue(NextProcessor.java:210)
		at reactor.core.publisher.InternalOneSink.emitValue(InternalOneSink.java:33)
		at reactor.core.publisher.NextProcessor.onNext(NextProcessor.java:183)
		at dev.miku.r2dbc.mysql.MySqlResult.lambda$null$3(MySqlResult.java:114)
		at reactor.core.publisher.LambdaSubscriber.onNext(LambdaSubscriber.java:160)
		at reactor.core.publisher.FluxWindowPredicate$WindowFlux.drainRegular(FluxWindowPredicate.java:668)
		at reactor.core.publisher.FluxWindowPredicate$WindowFlux.drain(FluxWindowPredicate.java:746)
		at reactor.core.publisher.FluxWindowPredicate$WindowFlux.onNext(FluxWindowPredicate.java:788)
		at reactor.core.publisher.FluxWindowPredicate$WindowPredicateMain.onNext(FluxWindowPredicate.java:239)
		at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onNext(FluxHandleFuseable.java:184)
		at reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.onNext(FluxContextWrite.java:107)
		at dev.miku.r2dbc.mysql.util.DiscardOnCancelSubscriber.onNext(DiscardOnCancelSubscriber.java:70)
		at reactor.core.publisher.FluxPeekFuseable$PeekFuseableConditionalSubscriber.onNext(FluxPeekFuseable.java:503)
		at reactor.core.publisher.MonoFlatMapMany$FlatMapManyInner.onNext(MonoFlatMapMany.java:250)
		at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onNext(FluxPeekFuseable.java:210)
		at reactor.core.publisher.FluxHandleFuseable$HandleFuseableSubscriber.onNext(FluxHandleFuseable.java:184)
		at reactor.core.publisher.FluxPeekFuseable$PeekConditionalSubscriber.onNext(FluxPeekFuseable.java:854)
		at reactor.core.publisher.EmitterProcessor.drain(EmitterProcessor.java:491)
		at reactor.core.publisher.EmitterProcessor.tryEmitNext(EmitterProcessor.java:299)
		at reactor.core.publisher.InternalManySink.emitNext(InternalManySink.java:27)
		at reactor.core.publisher.EmitterProcessor.onNext(EmitterProcessor.java:265)
		at dev.miku.r2dbc.mysql.client.ReactorNettyClient$ResponseSink.next(ReactorNettyClient.java:340)
		at dev.miku.r2dbc.mysql.client.ReactorNettyClient.lambda$new$0(ReactorNettyClient.java:103)
		at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:185)
		at reactor.netty.channel.FluxReceive.drainReceiver(FluxReceive.java:279)
		at reactor.netty.channel.FluxReceive.onInboundNext(FluxReceive.java:388)
		at reactor.netty.channel.ChannelOperations.onInboundNext(ChannelOperations.java:404)
		at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:93)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
		at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
		at dev.miku.r2dbc.mysql.client.MessageDuplexCodec.handleDecoded(MessageDuplexCodec.java:187)
		at dev.miku.r2dbc.mysql.client.MessageDuplexCodec.channelRead(MessageDuplexCodec.java:95)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
		at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
		at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
		at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
		at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
		at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
		at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
		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:719)
		at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655)
		at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581)
		at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
		at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
		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:829)

2021-11-15 01:03:29.432 DEBUG 34176 --- [actor-tcp-nio-2] .s.w.r.r.m.a.ResponseEntityResultHandler : [81c0d88f-3, L:/0:0:0:0:0:0:0:1:8080 - R:/0:0:0:0:0:0:0:1:50364] Found 'Content-Type:application/problem+json' in response
2021-11-15 01:03:29.432 DEBUG 34176 --- [actor-tcp-nio-2] .s.w.r.r.m.a.ResponseEntityResultHandler : [81c0d88f-3, L:/0:0:0:0:0:0:0:1:8080 - R:/0:0:0:0:0:0:0:1:50364] 0..1 [org.zalando.problem.Problem]
2021-11-15 01:03:29.433 DEBUG 34176 --- [actor-tcp-nio-2] o.s.http.codec.json.Jackson2JsonEncoder  : [81c0d88f-3, 
2021-11-15 01:03:29.437 DEBUG 34176 --- [ctor-http-nio-7] o.s.w.s.adapter.HttpWebHandlerAdapter    : [81c0d88f-3, L:/0:0:0:0:0:0:0:1:8080 - R:/0:0:0:0:0:0:0:1:50364] Completed 500 INTERNAL_SERVER_ERROR
@rvyshnivskyi
Copy link

Hi
Have you resolved this issue?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants