Getting IllegalStateException after upgrading jhipster 3.7 - java

I'm working on project which is recently upgraded to 3.7.1, after upgrade whenever I'm using more than 1 request ( in my case it's 3 requests ) at same time I'm getting this error.
IllegalStateException: UT000021: Session already invalidated"
the exception in log is this:
gateway-app_1 | at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
gateway-app_1 | at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
gateway-app_1 | at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
gateway-app_1 | at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
gateway-app_1 | at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
gateway-app_1 | at io.undertow.servlet.handlers.SessionRestoringHandler.handleRequest(SessionRestoringHandler.java:119)
gateway-app_1 | at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:285)
gateway-app_1 | at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:264)
gateway-app_1 | at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81)
gateway-app_1 | at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:175)
gateway-app_1 | at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)
gateway-app_1 | at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:802)
gateway-app_1 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
gateway-app_1 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
gateway-app_1 | at java.lang.Thread.run(Thread.java:745)
gateway-app_1 | Caused by: java.lang.IllegalStateException: UT000021: Session already invalidated
gateway-app_1 | at io.undertow.server.session.InMemorySessionManager$SessionImpl.invalidate(InMemorySessionManager.java:521)
gateway-app_1 | at io.undertow.server.session.InMemorySessionManager$SessionImpl.invalidate(InMemorySessionManager.java:507)
gateway-app_1 | at io.undertow.servlet.spec.HttpSessionImpl.invalidate(HttpSessionImpl.java:198)
gateway-app_1 | at com.hazelcast.web.WebFilter$RequestWrapper.readSessionFromLocal(WebFilter.java:507)
gateway-app_1 | at com.hazelcast.web.WebFilter$RequestWrapper.getSession(WebFilter.java:471)
gateway-app_1 | at com.hazelcast.web.WebFilter$RequestWrapper.getSession(WebFilter.java:410)
gateway-app_1 | at org.springframework.web.servlet.support.SessionFlashMapManager.retrieveFlashMaps(SessionFlashMapManager.java:45)
gateway-app_1 | at org.springframework.web.servlet.support.AbstractFlashMapManager.retrieveAndUpdate(AbstractFlashMapManager.java:93)
gateway-app_1 | at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:889)
gateway-app_1 | at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
gateway-app_1 | ... 96 common frames omitted
Is there any solution?
UPDATE 01:
this is my gateway .yo-rc.json
{
"generator-jhipster": {
"jhipsterVersion": "3.7.1",
"baseName": "gateway",
"packageName": "com.my.package.gateway",
"packageFolder": "com/my/package/gateway",
"serverPort": "8080",
"authenticationType": "jwt",
"hibernateCache": "no",
"clusteredHttpSession": "hazelcast",
"websocket": false,
"databaseType": "mongodb",
"devDatabaseType": "mongodb",
"prodDatabaseType": "mongodb",
"searchEngine": false,
"buildTool": "gradle",
"jwtSecretKey": "fdsfsdfsfsfs",
"useSass": true,
"applicationType": "gateway",
"testFrameworks": [
"gatling",
"cucumber",
"protractor"
],
"jhiPrefix": "jhi",
"enableTranslation": true,
"nativeLanguage": "en",
"languages": [
"en"
]
}
}

Related

Reactive Spring Security: AuthenticationCredentialsNotFoundException after successful authentication

Probably the answer to my question is easy and I am missing something simple, but I have searched all around the internet and tried to debug this error for weeks, without any progress.
I have registered a filter in the reactive spring security config, this filter is executed at the authentication level, and its purpose is to validate a JWT token present in the authentication header. So it's the typical JWT authentication pattern.
The JWT validation, by itself, works properly. It is able to validate a JWT token, check if it is expired, wrong, valid, and so on. This is visible by printing the SecurityContext object:
SecurityContextImpl [Authentication=UsernamePasswordAuthenticationToken [Principal=UserDetailsDTO(id=2, username=peppe2, password=null, email=peppe2#yopmail.com, roles=[ADMIN], isEnabled=true, isLocked=false), Credentials=[PROTECTED], Authenticated=true, Details=null, Granted Authorities=[ADMIN]]]
And also the Authentication object:
UsernamePasswordAuthenticationToken [Principal=UserDetailsDTO(id=2, username=peppe2, password=null, email=peppe2#yopmail.com, roles=[ADMIN], isEnabled=true, isLocked=false), Credentials=[PROTECTED], Authenticated=true, Details=null, Granted Authorities=[ADMIN]]
But, no matter what I do after the authentication filter, I receive a AuthenticationCredentialsNotFoundException in the ServerHttpSecurity error callback. Here is the full stack trace:
catalog-svc | 2021-09-13 13:52:41.753 ERROR 1 --- [ parallel-3]
a.w.r.e.AbstractErrorWebExceptionHandler : [8415b576-2] 500 Server Error for HTTP PATCH "/users/1"
catalog-svc |
catalog-svc | org.springframework.security.authentication.AuthenticationCredentialsNotFoundException: Not Authenticated
catalog-svc | at org.springframework.security.web.server.authorization.ExceptionTranslationWebFilter.commenceAuthentication(ExceptionTranslationWebFilter.java:70) ~[spring-security-web-5.5.1.jar!/:5.5.1]
catalog-svc | Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
catalog-svc | Error has been observed at the following site(s):
catalog-svc | |_ checkpoint ⇢ org.springframework.security.web.server.authorization.ExceptionTranslationWebFilter [DefaultWebFilterChain]
catalog-svc | |_ checkpoint ⇢ org.springframework.security.web.server.authentication.logout.LogoutWebFilter [DefaultWebFilterChain]
catalog-svc | |_ checkpoint ⇢ org.springframework.security.web.server.savedrequest.ServerRequestCacheWebFilter [DefaultWebFilterChain]
catalog-svc | |_ checkpoint ⇢ org.springframework.security.web.server.context.SecurityContextServerWebExchangeWebFilter [DefaultWebFilterChain]
catalog-svc | |_ checkpoint ⇢ it.polito.ecommerce.catalogservice.security.JwtAuthenticationTokenFilter [DefaultWebFilterChain]
catalog-svc | |_ checkpoint ⇢ org.springframework.security.web.server.context.ReactorContextWebFilter [DefaultWebFilterChain]
catalog-svc | |_ checkpoint ⇢ org.springframework.security.web.server.header.HttpHeaderWriterWebFilter [DefaultWebFilterChain]
catalog-svc | |_ checkpoint ⇢ org.springframework.security.config.web.server.ServerHttpSecurity$ServerWebExchangeReactorContextWebFilter [DefaultWebFilterChain]
catalog-svc | |_ checkpoint ⇢ org.springframework.security.web.server.WebFilterChainProxy [DefaultWebFilterChain]
catalog-svc | |_ checkpoint ⇢ HTTP PATCH "/api/v1/users/1" [ExceptionHandlingWebHandler]
catalog-svc | Stack trace:
catalog-svc | at org.springframework.security.web.server.authorization.ExceptionTranslationWebFilter.commenceAuthentication(ExceptionTranslationWebFilter.java:70) ~[spring-security-web-5.5.1.jar!/:5.5.1]
catalog-svc | at org.springframework.security.web.server.authorization.ExceptionTranslationWebFilter.lambda$filter$1(ExceptionTranslationWebFilter.java:45) ~[spring-security-web-5.5.1.jar!/:5.5.1]
catalog-svc | at reactor.core.publisher.Mono.lambda$onErrorResume$32(Mono.java:3564) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onError(FluxOnErrorResume.java:94) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onError(Operators.java:2062) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onError(MonoPeekTerminal.java:258) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoPeekTerminal$MonoTerminalPeekSubscriber.onError(MonoPeekTerminal.java:258) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoFlatMap$FlatMapMain.onError(MonoFlatMap.java:172) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onError(Operators.java:2062) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.Operators.error(Operators.java:197) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoError.subscribe(MonoError.java:52) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.Mono.subscribe(Mono.java:4150) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onComplete(FluxSwitchIfEmpty.java:81) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxFilter$FilterSubscriber.onComplete(FluxFilter.java:166) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxDefaultIfEmpty$DefaultIfEmptySubscriber.onComplete(FluxDefaultIfEmpty.java:106) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoNext$NextSubscriber.onComplete(MonoNext.java:102) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:83) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.innerNext(FluxConcatMap.java:281) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxConcatMap$ConcatMapInner.onNext(FluxConcatMap.java:860) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1815) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:249) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1815) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxDefaultIfEmpty$DefaultIfEmptySubscriber.onComplete(FluxDefaultIfEmpty.java:108) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onComplete(FluxMapFuseable.java:150) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxFilterFuseable$FilterFuseableSubscriber.onComplete(FluxFilterFuseable.java:171) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxMapFuseable$MapFuseableConditionalSubscriber.onComplete(FluxMapFuseable.java:344) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.onComplete(FluxFilterFuseable.java:391) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:148) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxFilterFuseable$FilterFuseableSubscriber.onNext(FluxFilterFuseable.java:118) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2397) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxFilterFuseable$FilterFuseableSubscriber.request(FluxFilterFuseable.java:191) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoFlatMap$FlatMapMain.onSubscribe(MonoFlatMap.java:110) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxFilterFuseable$FilterFuseableSubscriber.onSubscribe(FluxFilterFuseable.java:87) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoCurrentContext.subscribe(MonoCurrentContext.java:36) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:157) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:127) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxFilterFuseable$FilterFuseableSubscriber.onNext(FluxFilterFuseable.java:118) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2397) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxFilterFuseable$FilterFuseableSubscriber.request(FluxFilterFuseable.java:191) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.java:169) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoFlatMap$FlatMapMain.onSubscribe(MonoFlatMap.java:110) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.java:96) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxFilterFuseable$FilterFuseableSubscriber.onSubscribe(FluxFilterFuseable.java:87) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoJust.subscribe(MonoJust.java:54) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.Mono.subscribe(Mono.java:4150) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.drain(FluxConcatMap.java:448) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.onSubscribe(FluxConcatMap.java:218) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:164) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:86) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.Mono.subscribe(Mono.java:4150) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoIgnoreThen$ThenIgnoreMain.subscribeNext(MonoIgnoreThen.java:255) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoIgnoreThen.subscribe(MonoIgnoreThen.java:51) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.Mono.subscribe(Mono.java:4150) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onComplete(FluxSwitchIfEmpty.java:81) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxFilter$FilterSubscriber.onComplete(FluxFilter.java:166) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxPeekFuseable$PeekConditionalSubscriber.onComplete(FluxPeekFuseable.java:940) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onComplete(FluxSwitchIfEmpty.java:84) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2399) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.set(Operators.java:2193) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.Operators$MultiSubscriptionSubscriber.onSubscribe(Operators.java:2067) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoJust.subscribe(MonoJust.java:54) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.Mono.subscribe(Mono.java:4150) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onComplete(FluxSwitchIfEmpty.java:81) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoNext$NextSubscriber.onComplete(MonoNext.java:102) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxFilter$FilterSubscriber.onComplete(FluxFilter.java:166) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxFlatMap$FlatMapMain.checkTerminated(FluxFlatMap.java:846) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxFlatMap$FlatMapMain.drainLoop(FluxFlatMap.java:608) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxFlatMap$FlatMapMain.drain(FluxFlatMap.java:588) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxFlatMap$FlatMapMain.onComplete(FluxFlatMap.java:465) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onComplete(FluxPeekFuseable.java:277) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxIterable$IterableSubscription.slowPath(FluxIterable.java:292) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxIterable$IterableSubscription.request(FluxIterable.java:228) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.request(FluxPeekFuseable.java:144) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxFlatMap$FlatMapMain.onSubscribe(FluxFlatMap.java:371) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onSubscribe(FluxPeekFuseable.java:178) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:164) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxIterable.subscribe(FluxIterable.java:86) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:157) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1815) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxDefaultIfEmpty$DefaultIfEmptySubscriber.onComplete(FluxDefaultIfEmpty.java:108) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:142) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:142) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxFilter$FilterSubscriber.onComplete(FluxFilter.java:166) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxMap$MapConditionalSubscriber.onComplete(FluxMap.java:269) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1816) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoCacheTime$CoordinatorSubscriber.signalCached(MonoCacheTime.java:337) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoCacheTime$CoordinatorSubscriber.onNext(MonoCacheTime.java:354) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxPeek$PeekSubscriber.onNext(FluxPeek.java:199) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.java:73) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoPublishOn$PublishOnSubscriber.run(MonoPublishOn.java:181) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at java.base/java.util.concurrent.FutureTask.run(Unknown Source) ~[na:na]
catalog-svc | at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) ~[na:na]
catalog-svc | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[na:na]
catalog-svc | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[na:na]
catalog-svc | at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]
catalog-svc | Caused by: org.springframework.security.access.AccessDeniedException: Access Denied
catalog-svc | at org.springframework.security.authorization.ReactiveAuthorizationManager.lambda$verify$0(ReactiveAuthorizationManager.java:53) ~[spring-security-core-5.5.1.jar!/:5.5.1]
catalog-svc | Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
catalog-svc | Error has been observed at the following site(s):
catalog-svc | |_ checkpoint ⇢ org.springframework.security.web.server.authorization.AuthorizationWebFilter [DefaultWebFilterChain]
catalog-svc | Stack trace:
catalog-svc | at org.springframework.security.authorization.ReactiveAuthorizationManager.lambda$verify$0(ReactiveAuthorizationManager.java:53) ~[spring-security-core-5.5.1.jar!/:5.5.1]
catalog-svc | at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:44) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.Mono.subscribe(Mono.java:4150) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onComplete(FluxSwitchIfEmpty.java:81) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxFilter$FilterSubscriber.onComplete(FluxFilter.java:166) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxDefaultIfEmpty$DefaultIfEmptySubscriber.onComplete(FluxDefaultIfEmpty.java:106) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoNext$NextSubscriber.onComplete(MonoNext.java:102) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:83) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxConcatMap$ConcatMapImmediate.innerNext(FluxConcatMap.java:281) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxConcatMap$ConcatMapInner.onNext(FluxConcatMap.java:860) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1815) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:249) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1815) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxDefaultIfEmpty$DefaultIfEmptySubscriber.onComplete(FluxDefaultIfEmpty.java:108) ~[reactor-core-3.4.7.jar!/:3.4.7]
catalog-svc | at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onComplete(FluxMapFuseable.java:150) ~[reactor-core-3.4.7.jar!/:3.4.7]
While here is the SecurityConfig:
#Bean
fun springSecurityFilterChain(
http: ServerHttpSecurity,
authManager: ReactiveAuthenticationManager?
): SecurityWebFilterChain {
return http
.exceptionHandling()
.authenticationEntryPoint { swe, e ->
// The error is caught here
Mono.fromRunnable {
swe.response.statusCode = HttpStatus.UNAUTHORIZED
throw e
}
}.accessDeniedHandler { swe, e ->
Mono.fromRunnable {
swe.response.statusCode = HttpStatus.FORBIDDEN
throw e
}
}.and()
.addFilterBefore(
jwtAuthenticationTokenFilter,
SecurityWebFiltersOrder.AUTHENTICATION)
.cors()
.and()
.csrf().disable()
.securityContextRepository(NoOpServerSecurityContextRepository.getInstance())
.authorizeExchange()
.pathMatchers("/auth/**").permitAll()
.anyExchange().authenticated()
.and().build()
}
and, in the end, the jwt filter:
#Component
class JwtAuthenticationTokenFilter(
private val jwtUtils: JwtUtils,
#Value("\${application.jwt.jwtHeader}") private val jwtHeader: String,
#Value("\${application.jwt.jwtHeaderStart}") private val jwtHeaderStart: String
) : WebFilter {
override fun filter(exchange: ServerWebExchange, chain: WebFilterChain): Mono<Void> {
val authorizationHeader= exchange.request.headers[jwtHeader]?.get(0)
if (authorizationHeader != null) {
val jwt = authorizationHeader.removePrefix("$jwtHeaderStart ")
if (jwtUtils.validateJwtToken(jwt)) {
val detailsFromJwtToken = jwtUtils.getDetailsFromJwtToken(jwt)
val authentication = UsernamePasswordAuthenticationToken(
detailsFromJwtToken,
null,
detailsFromJwtToken.authorities
)
ReactiveSecurityContextHolder.withAuthentication(authentication)
}
}
return chain.filter(exchange)
}
}
My questions are: how do I solve this problem? If you can't help me solving this, do you know any way to improve the stacktrace in Spring Reactive? Because I am not getting any hint for debugging.
Thank you

Exception : org.hibernate.PersistentObjectException for saving entity

I'm facing the dreaded org.hibernate.PersistentObjectException (detached entity passed to persist: br.blablabla.Perfil) when trying to save an Usuario entity (user) to my DB. This is the entity:
#Entity
#Table(name = "dbo.USUARIO")
public class Usuario implements Serializable {
private static final long serialVersionUID = -5574681357689462091L;
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
#Column(name = "ID_USUARIO")
private Long id;
// ... lots of columns
#OneToMany(fetch = FetchType.LAZY, mappedBy = "usuario", cascade = CascadeType.ALL, orphanRemoval = true)
private List<PerfilUsuario> perfisUsuario;
// ... constructors, getters, setters
As you can see, each Usuariocan have a lot of PerfilUsuario(user profiles), and that's where I'm facing the error message. Here's my PerfilUsuario entity:
#Entity
#Table(name = "USUARIO_PERFIL")
public class PerfilUsuario implements Serializable {
private static final long serialVersionUID = 1L;
#EmbeddedId
private PerfilUsuarioId perfilUsuarioId;
#MapsId("ID_UNIDADE")
#ManyToOne
#JoinColumn(name = "ID_UNIDADE")
private Unidade unidade;
#MapsId("ID_PERFIL")
#ManyToOne
#JoinColumn(name = "ID_PERFIL")
private Perfil perfil;
#MapsId("ID_USUARIO")
#ManyToOne
#JoinColumn(name = "ID_USUARIO")
private Usuario usuario;
// ... getters, setters etc
... and here's part of my Perfil entity:
#Entity
#Table(name="perfil")
public class Perfil implements Serializable {
private static final long serialVersionUID = -3410941762407296839L;
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
#Column(name="ID")
private Long id;
// ... etc
It's a webapp and it's working fine when my Usuario is being edited (calling the entityManager.merge() method updates the Usuario and the PerfilUsuario's ). I'm able to remove all PerfilUsuario's of my Usuario, I can remove some and insert different ones, I can add PerfilUsuario's to Usuario's with none etc. But I get this error message if I try to insert the user (method entityManager.persist()). I would like to be able to persist everything without doing separate inserts, even more array operations etc.
Also it's the first time I use #EmbeddedId in an entity (I met this table with a composite key, can't change the table and I'm trying this solution).
I'm using java 8.x, hibernate 4.3.7 and a wildfly 9 server.
In the bean method where a PerfilUsuario is created and added to the new Usuario instance, I'm getting the correspondent Perfil entity from the DB:
newPerfilUsuario.setPerfil(perfilDAO.getById(idPerfil)); // this performs an entityManager.find(Perfil.class, id)
How can I fix this insert problem? I don't want to update or save a Perfil in this operation, only Usuario and PerfilUsuario.
Here's the stacktrace:
11:45:52,127 ERROR [org.jboss.as.ejb3.invocation] (default task-35) WFLYEJB0034: EJB Invocation failed on component UsuarioSeDAO for method public void br.blablablablabla.UsuarioDAO.adicionar(br.blablablablabla.Usuario): javax.ejb.EJBTransactionRolledbackException: org.hibernate.PersistentObjectException: detached entity passed to persist: br.blablablablabla.Perfil
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:159)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:256)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:329)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:66)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:634)
at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:195)
at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:185)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73)
at br.blablablablabla.UsuarioDAO$$$view892.adicionar(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.weld.util.reflection.Reflections.invokeAndUnwrap(Reflections.java:434)
at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:127)
at org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56)
at org.jboss.weld.bean.proxy.InjectionPointPropagatingEnterpriseTargetBeanInstance.invoke(InjectionPointPropagatingEnterpriseTargetBeanInstance.java:67)
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:100)
at br.blablablablabla.UsuarioDAO$Proxy$_$$_Weld$EnterpriseProxy$.adicionar(Unknown Source)
at br.blablablablabla.UsuarioFacade.adicionar(UsuarioFacade.java:123)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)
at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:82)
at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:93)
at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)
at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:64)
at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:83)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:52)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.NonPooledEJBComponentInstanceAssociatingInterceptor.processInvocation(NonPooledEJBComponentInstanceAssociatingInterceptor.java:59)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:275)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:327)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.invocationmetrics.WaitTimeInterceptor.processInvocation(WaitTimeInterceptor.java:43)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.security.SecurityContextInterceptor.processInvocation(SecurityContextInterceptor.java:100)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:66)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:54)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:64)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:634)
at org.jboss.invocation.AccessCheckingInterceptor.processInvocation(AccessCheckingInterceptor.java:61)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.InterceptorContext.run(InterceptorContext.java:356)
at org.jboss.invocation.PrivilegedWithCombinerInterceptor.processInvocation(PrivilegedWithCombinerInterceptor.java:80)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:195)
at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:185)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:73)
at br.blablablablabla.UsuarioFacade$$$view865.adicionar(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.weld.util.reflection.Reflections.invokeAndUnwrap(Reflections.java:434)
at org.jboss.weld.bean.proxy.EnterpriseBeanProxyMethodHandler.invoke(EnterpriseBeanProxyMethodHandler.java:127)
at org.jboss.weld.bean.proxy.EnterpriseTargetBeanInstance.invoke(EnterpriseTargetBeanInstance.java:56)
at org.jboss.weld.bean.proxy.InjectionPointPropagatingEnterpriseTargetBeanInstance.invoke(InjectionPointPropagatingEnterpriseTargetBeanInstance.java:67)
at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:100)
at br.blablablablabla.UsuarioFacade$Proxy$_$$_Weld$EnterpriseProxy$.adicionar(Unknown Source)
at br.blablablablabla.CadastroUsuarioBean.salvarUsuario(CadastroUsuarioBean.java:274)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.sun.el.parser.AstValue.invoke(AstValue.java:292)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:304)
at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:149)
at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:814)
at javax.faces.component.UICommand.broadcast(UICommand.java:300)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:790)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1282)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:81)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:198)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:658)
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:86)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130)
at br.ufpi.tce.sagresWeb.filter.PaginasFilter.doFilter(PaginasFilter.java:110)
at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85)
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:72)
at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:282)
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:261)
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:80)
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:172)
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199)
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:774)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.persistence.PersistenceException: org.hibernate.PersistentObjectException: detached entity passed to persist: br.blablablablabla.Perfil
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1763)
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1677)
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1683)
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1187)
at org.jboss.as.jpa.container.AbstractEntityManager.persist(AbstractEntityManager.java:580)
at br.blablablablabla.UsuarioDAO.adicionar(UsuarioDAO.java:425)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.as.ee.component.ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptor.java:52)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)
at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:82)
at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:93)
at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:63)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.invocationmetrics.ExecutionTimeInterceptor.processInvocation(ExecutionTimeInterceptor.java:43)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:437)
at org.jboss.weld.ejb.AbstractEJBRequestScopeActivationInterceptor.aroundInvoke(AbstractEJBRequestScopeActivationInterceptor.java:64)
at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:83)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ee.concurrent.ConcurrentContextInterceptor.processInvocation(ConcurrentContextInterceptor.java:45)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61)
at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:52)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.component.interceptors.NonPooledEJBComponentInstanceAssociatingInterceptor.processInvocation(NonPooledEJBComponentInstanceAssociatingInterceptor.java:59)
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:254)
... 169 more
Caused by: org.hibernate.PersistentObjectException: detached entity passed to persist: br.blablablablabla.Perfil
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:139)
at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:801)
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:794)
at org.hibernate.jpa.event.internal.core.JpaPersistEventListener$1.cascade(JpaPersistEventListener.java:97)
at org.hibernate.engine.internal.Cascade.cascadeToOne(Cascade.java:350)
at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:293)
at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:161)
at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:118)
at org.hibernate.event.internal.AbstractSaveEventListener.cascadeBeforeSave(AbstractSaveEventListener.java:442)
at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:266)
at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:195)
at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:138)
at org.hibernate.jpa.event.internal.core.JpaPersistEventListener.saveWithGeneratedId(JpaPersistEventListener.java:84)
at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:206)
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:149)
at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:801)
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:794)
at org.hibernate.jpa.event.internal.core.JpaPersistEventListener$1.cascade(JpaPersistEventListener.java:97)
at org.hibernate.engine.internal.Cascade.cascadeToOne(Cascade.java:350)
at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:293)
at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:161)
at org.hibernate.engine.internal.Cascade.cascadeCollectionElements(Cascade.java:379)
at org.hibernate.engine.internal.Cascade.cascadeCollection(Cascade.java:319)
at org.hibernate.engine.internal.Cascade.cascadeAssociation(Cascade.java:296)
at org.hibernate.engine.internal.Cascade.cascadeProperty(Cascade.java:161)
at org.hibernate.engine.internal.Cascade.cascade(Cascade.java:118)
at org.hibernate.event.internal.AbstractSaveEventListener.cascadeAfterSave(AbstractSaveEventListener.java:470)
at org.hibernate.event.internal.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:295)
at org.hibernate.event.internal.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:195)
at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:126)
at org.hibernate.jpa.event.internal.core.JpaPersistEventListener.saveWithGeneratedId(JpaPersistEventListener.java:84)
at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:206)
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:149)
at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:75)
at org.hibernate.internal.SessionImpl.firePersist(SessionImpl.java:811)
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:784)
at org.hibernate.internal.SessionImpl.persist(SessionImpl.java:789)
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:1181)
... 200 more
EDITED in 2020-01-23: I gave up trying and changed my database. Took some time but, with a regular-simple-default-long primary key, everything worked fine.

Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: order near line 1, column 17 for absolutely unclear reasons

I have a syntax error message for my JQL query whne my repository beans are trying to be initialized:
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: order near line 1, column 17 [select distinct order from com.github.eljah.mental.domain.Order order left join fetch order.shipments left join fetch order.subscriptions]
caused by this part in Spring data repo:
#Query("select distinct order from Order order left join fetch order.shipments left join fetch order.subscriptions")
the full output is attached below.
Spring data repository class:
#Repository
public interface OrderRepository extends JpaRepository<Order, Long>, JpaSpecificationExecutor<Order> {
#Query("select order from Order order where order.user.login = ?#{principal.username}")
List<Order> findByUserIsCurrentUser();
#Query(value = "select distinct order from Order order left join fetch order.shipments left join fetch order.subscriptions",
countQuery = "select count(distinct order) from Order order")
Page<Order> findAllWithEagerRelationships(Pageable pageable);
#Query("select distinct order from Order order left join fetch order.shipments left join fetch order.subscriptions")
List<Order> findAllWithEagerRelationships();
#Query("select order from Order order left join fetch order.shipments left join fetch order.subscriptions where order.id =:id")
Optional<Order> findOneWithEagerRelationships(#Param("id") Long id);
}
and the entity itself is:
#Entity
#Table(name = "jhi_order")
#org.springframework.data.elasticsearch.annotations.Document(indexName = "shipment", shards = 1, replicas = 0, refreshInterval = "-1")
public class Order implements Serializable {
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
#SequenceGenerator(name = "sequenceGenerator")
#org.springframework.data.elasticsearch.annotations.Field(type = FieldType.Keyword)
private Long id;
#Column(name = "created")
private ZonedDateTime created;
#Column(name = "paid")
private ZonedDateTime paid;
#Column(name = "processed")
private Boolean processed;
#Column(name = "md_order")
private String mdOrder;
#Column(name = "operation")
private String operation;
#ManyToOne(optional = false)
#NotNull
#JsonIgnoreProperties("orders")
private User user;
#ManyToMany
#JoinTable(name = "jhi_order_shipments",
joinColumns = #JoinColumn(name = "order_id", referencedColumnName = "id"),
inverseJoinColumns = #JoinColumn(name = "shipments_id", referencedColumnName = "id"))
private Set<Shipment> shipments = new HashSet<>();
#ManyToMany
#JoinTable(name = "jhi_order_subscriptions",
joinColumns = #JoinColumn(name = "order_id", referencedColumnName = "id"),
inverseJoinColumns = #JoinColumn(name = "subscriptions_id", referencedColumnName = "id"))
private Set<AccessSubscription> subscriptions = new HashSet<>();
setters/getters are ommited. So, what is wrong there? I have similar SpringData repositories for the similar entities with the similar JQL queries and everything is ok. Or may be "order" is a kind of keywork in JQL?
| 2019-09-25 18:00:01.145 ERROR 8 --- [ main] o.h.hql.internal.ast.ErrorTracker : line 1:119: unexpected token: order
mental-app_1 |
mental-app_1 | antlr.NoViableAltException: unexpected token: order
mental-app_1 | at org.hibernate.hql.internal.antlr.HqlBaseParser.joinPath(HqlBaseParser.java:1760)
mental-app_1 | at org.hibernate.hql.internal.antlr.HqlBaseParser.fromJoin(HqlBaseParser.java:1640)
mental-app_1 | at org.hibernate.hql.internal.antlr.HqlBaseParser.fromClause(HqlBaseParser.java:1355)
mental-app_1 | at org.hibernate.hql.internal.antlr.HqlBaseParser.selectFrom(HqlBaseParser.java:1063)
mental-app_1 | at org.hibernate.hql.internal.antlr.HqlBaseParser.queryRule(HqlBaseParser.java:748)
mental-app_1 | at org.hibernate.hql.internal.antlr.HqlBaseParser.selectStatement(HqlBaseParser.java:319)
mental-app_1 | at org.hibernate.hql.internal.antlr.HqlBaseParser.statement(HqlBaseParser.java:198)
mental-app_1 | at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:289)
mental-app_1 | at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:188)
mental-app_1 | at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:143)
mental-app_1 | at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:119)
mental-app_1 | at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
mental-app_1 | at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:153)
mental-app_1 | at org.hibernate.internal.AbstractSharedSessionContract.getQueryPlan(AbstractSharedSessionContract.java:611)
mental-app_1 | at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:720)
mental-app_1 | at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:104)
mental-app_1 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
mental-app_1 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
mental-app_1 | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
mental-app_1 | at java.base/java.lang.reflect.Method.invoke(Unknown Source)
mental-app_1 | at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:350)
mental-app_1 | at com.sun.proxy.$Proxy173.createQuery(Unknown Source)
mental-app_1 | at org.springframework.data.jpa.repository.query.SimpleJpaQuery.validateQuery(SimpleJpaQuery.java:87)
mental-app_1 | at org.springframework.data.jpa.repository.query.SimpleJpaQuery.<init>(SimpleJpaQuery.java:63)
mental-app_1 | at org.springframework.data.jpa.repository.query.JpaQueryFactory.fromMethodWithQueryString(JpaQueryFactory.java:76)
mental-app_1 | at org.springframework.data.jpa.repository.query.JpaQueryFactory.fromQueryAnnotation(JpaQueryFactory.java:56)
mental-app_1 | at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$DeclaredQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:142)
mental-app_1 | at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:209)
mental-app_1 | at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:79)
mental-app_1 | at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lookupQuery(RepositoryFactorySupport.java:566)
mental-app_1 | at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$mapMethodsToQuery$1(RepositoryFactorySupport.java:559)
mental-app_1 | at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
mental-app_1 | at java.base/java.util.Iterator.forEachRemaining(Unknown Source)
mental-app_1 | at java.base/java.util.Collections$UnmodifiableCollection$1.forEachRemaining(Unknown Source)
mental-app_1 | at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
mental-app_1 | at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
mental-app_1 | at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
mental-app_1 | at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
mental-app_1 | at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
mental-app_1 | at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
mental-app_1 | at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.mapMethodsToQuery(RepositoryFactorySupport.java:561)
mental-app_1 | at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$new$0(RepositoryFactorySupport.java:551)
mental-app_1 | at java.base/java.util.Optional.map(Unknown Source)
mental-app_1 | at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:551)
mental-app_1 | at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:324)
mental-app_1 | at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:297)
mental-app_1 | at org.springframework.data.util.Lazy.getNullable(Lazy.java:211)
mental-app_1 | at org.springframework.data.util.Lazy.get(Lazy.java:94)
mental-app_1 | at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:300)
mental-app_1 | at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:121)
mental-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1837)
mental-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1774)
mental-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
mental-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
mental-app_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
mental-app_1 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
mental-app_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
mental-app_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
mental-app_1 | at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277)
mental-app_1 | at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1251)
mental-app_1 | at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1171)
mental-app_1 | at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:857)
mental-app_1 | at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:760)
mental-app_1 | at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:218)
mental-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1341)
mental-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1187)
mental-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
mental-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
mental-app_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
mental-app_1 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
mental-app_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
mental-app_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
mental-app_1 | at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:845)
mental-app_1 | at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)
mental-app_1 | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
mental-app_1 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
mental-app_1 | at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:742)
mental-app_1 | at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:389)
mental-app_1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:311)
mental-app_1 | at com.github.eljah.mental.MentalApp.main(MentalApp.java:63)
mental-app_1 |
mental-app_1 | 2019-09-25 18:00:01.153 WARN 8 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'orderQueryService' defined in file [/app/classes/com/github/eljah/mental/service/OrderQueryService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'orderRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.github.eljah.mental.repository.OrderRepository.findAllWithEagerRelationships()!
mental-app_1 | 2019-09-25 18:00:01.361 ERROR 8 --- [ main] o.s.boot.SpringApplication : Application run failed
mental-app_1 |
mental-app_1 | org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'orderQueryService' defined in file [/app/classes/com/github/eljah/mental/service/OrderQueryService.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'orderRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.github.eljah.mental.repository.OrderRepository.findAllWithEagerRelationships()!
mental-app_1 | at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:769)
mental-app_1 | at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:218)
mental-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1341)
mental-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1187)
mental-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
mental-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
mental-app_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
mental-app_1 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
mental-app_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
mental-app_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
mental-app_1 | at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:845)
mental-app_1 | at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)
mental-app_1 | at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
mental-app_1 | at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
mental-app_1 | at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:742)
mental-app_1 | at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:389)
mental-app_1 | at org.springframework.boot.SpringApplication.run(SpringApplication.java:311)
mental-app_1 | at com.github.eljah.mental.MentalApp.main(MentalApp.java:63)
mental-app_1 | Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'orderRepository': Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.github.eljah.mental.repository.OrderRepository.findAllWithEagerRelationships()!
mental-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1778)
mental-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
mental-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)
mental-app_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)
mental-app_1 | at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
mental-app_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)
mental-app_1 | at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
mental-app_1 | at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:277)
mental-app_1 | at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1251)
mental-app_1 | at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1171)
mental-app_1 | at org.springframework.beans.factory.support.ConstructorResolver.resolveAutowiredArgument(ConstructorResolver.java:857)
mental-app_1 | at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:760)
mental-app_1 | ... 17 common frames omitted
mental-app_1 | Caused by: java.lang.IllegalArgumentException: Validation failed for query for method public abstract java.util.List com.github.eljah.mental.repository.OrderRepository.findAllWithEagerRelationships()!
mental-app_1 | at org.springframework.data.jpa.repository.query.SimpleJpaQuery.validateQuery(SimpleJpaQuery.java:93)
mental-app_1 | at org.springframework.data.jpa.repository.query.SimpleJpaQuery.<init>(SimpleJpaQuery.java:63)
mental-app_1 | at org.springframework.data.jpa.repository.query.JpaQueryFactory.fromMethodWithQueryString(JpaQueryFactory.java:76)
mental-app_1 | at org.springframework.data.jpa.repository.query.JpaQueryFactory.fromQueryAnnotation(JpaQueryFactory.java:56)
mental-app_1 | at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$DeclaredQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:142)
mental-app_1 | at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$CreateIfNotFoundQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:209)
mental-app_1 | at org.springframework.data.jpa.repository.query.JpaQueryLookupStrategy$AbstractQueryLookupStrategy.resolveQuery(JpaQueryLookupStrategy.java:79)
mental-app_1 | at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lookupQuery(RepositoryFactorySupport.java:566)
mental-app_1 | at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$mapMethodsToQuery$1(RepositoryFactorySupport.java:559)
mental-app_1 | at java.base/java.util.stream.ReferencePipeline$3$1.accept(Unknown Source)
mental-app_1 | at java.base/java.util.Iterator.forEachRemaining(Unknown Source)
mental-app_1 | at java.base/java.util.Collections$UnmodifiableCollection$1.forEachRemaining(Unknown Source)
mental-app_1 | at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Unknown Source)
mental-app_1 | at java.base/java.util.stream.AbstractPipeline.copyInto(Unknown Source)
mental-app_1 | at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source)
mental-app_1 | at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source)
mental-app_1 | at java.base/java.util.stream.AbstractPipeline.evaluate(Unknown Source)
mental-app_1 | at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source)
mental-app_1 | at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.mapMethodsToQuery(RepositoryFactorySupport.java:561)
mental-app_1 | at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.lambda$new$0(RepositoryFactorySupport.java:551)
mental-app_1 | at java.base/java.util.Optional.map(Unknown Source)
mental-app_1 | at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.<init>(RepositoryFactorySupport.java:551)
mental-app_1 | at org.springframework.data.repository.core.support.RepositoryFactorySupport.getRepository(RepositoryFactorySupport.java:324)
mental-app_1 | at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.lambda$afterPropertiesSet$5(RepositoryFactoryBeanSupport.java:297)
mental-app_1 | at org.springframework.data.util.Lazy.getNullable(Lazy.java:211)
mental-app_1 | at org.springframework.data.util.Lazy.get(Lazy.java:94)
mental-app_1 | at org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport.afterPropertiesSet(RepositoryFactoryBeanSupport.java:300)
mental-app_1 | at org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean.afterPropertiesSet(JpaRepositoryFactoryBean.java:121)
mental-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1837)
mental-app_1 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1774)
mental-app_1 | ... 28 common frames omitted
mental-app_1 | Caused by: java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: order near line 1, column 17 [select distinct order from com.github.eljah.mental.domain.Order order left join fetch order.shipments left join fetch order.subscriptions]
mental-app_1 | at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:138)
mental-app_1 | at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:181)
mental-app_1 | at org.hibernate.internal.ExceptionConverterImpl.convert(ExceptionConverterImpl.java:188)
mental-app_1 | at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:729)
mental-app_1 | at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:104)
mental-app_1 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
mental-app_1 | at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
mental-app_1 | at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
mental-app_1 | at java.base/java.lang.reflect.Method.invoke(Unknown Source)
mental-app_1 | at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:350)
mental-app_1 | at com.sun.proxy.$Proxy173.createQuery(Unknown Source)
mental-app_1 | at org.springframework.data.jpa.repository.query.SimpleJpaQuery.validateQuery(SimpleJpaQuery.java:87)
mental-app_1 | ... 57 common frames omitted
mental-app_1 | Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: order near line 1, column 17 [select distinct order from com.github.eljah.mental.domain.Order order left join fetch order.shipments left join fetch order.subscriptions]
mental-app_1 | at org.hibernate.hql.internal.ast.QuerySyntaxException.convert(QuerySyntaxException.java:74)
mental-app_1 | at org.hibernate.hql.internal.ast.ErrorTracker.throwQueryException(ErrorTracker.java:93)
mental-app_1 | at org.hibernate.hql.internal.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:296)
mental-app_1 | at org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:188)
mental-app_1 | at org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:143)
mental-app_1 | at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:119)
mental-app_1 | at org.hibernate.engine.query.spi.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
mental-app_1 | at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:153)
mental-app_1 | at org.hibernate.internal.AbstractSharedSessionContract.getQueryPlan(AbstractSharedSessionContract.java:611)
mental-app_1 | at org.hibernate.internal.AbstractSharedSessionContract.createQuery(AbstractSharedSessionContract.java:720)
mental-app_1 | ... 65 common frames omitted
The word order (which you seem to be trying to use as a variable name in your query) is a JPQL reserved word. Use o instead, and I strongly recommend that you consider externalizing the "current user" so that you pass in a user or user ID as a parameter and resolve it elsewhere; doing that inside the #Query introduces a hard coupling that's also difficult to test.

Error message was not delivered - failed message is null?

I have a spring integration flow with a poller cron whose goal is to initialize directories and mongodb collections. If the initializer flow throws a RuntimeException, the framework sends a message to the errorChannel. The error flow take in charge the message but something wrong:
2017-04-07 06:25:00.484 | | | | [taskScheduler-8] | DEBUG | com.objectway.bacco.integration.flow.InitializerIntegrationFlowConfiguration | cleanTmp | INITIALIZATION - Directory bacco created
2017-04-07 06:25:04.857 | | | | [taskScheduler-9] | ERROR | org.springframework.integration.handler.LoggingHandler | handleMessageInternal | org.springframework.messaging.MessagingException: The path [/tmp/bacco/bank_ftp/00082] does not denote a properly accessible directory.
at org.springframework.integration.file.DefaultDirectoryScanner.listFiles(DefaultDirectoryScanner.java:83)
at org.springframework.integration.file.FileReadingMessageSource.scanInputDirectory(FileReadingMessageSource.java:293)
at org.springframework.integration.file.FileReadingMessageSource.receive(FileReadingMessageSource.java:272)
at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource.doReceive(AbstractInboundFileSynchronizingMessageSource.java:191)
at org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource.doReceive(AbstractInboundFileSynchronizingMessageSource.java:59)
at org.springframework.integration.endpoint.AbstractMessageSource.receive(AbstractMessageSource.java:134)
at org.springframework.integration.endpoint.SourcePollingChannelAdapter.receiveMessage(SourcePollingChannelAdapter.java:175)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:224)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.access$000(AbstractPollingEndpoint.java:57)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:176)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$1.call(AbstractPollingEndpoint.java:173)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1.run(AbstractPollingEndpoint.java:330)
at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:55)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:51)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:324)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
2017-04-07 06:25:04.882 | | | | [taskScheduler-9] | INFO | com.objectway.bacco.service.logging.logback.LogServiceLogback | info | null | null | null | ERROR - Processing error
2017-04-07 06:25:04.930 | | | | [taskScheduler-9] | WARN | org.springframework.integration.channel.MessagePublishingErrorHandler | handleError | Error message was not delivered.
org.springframework.integration.transformer.MessageTransformationException: Failed to transform Message; nested exception is org.springframework.messaging.MessageHandlingException: nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 0): Property or field 'headers' cannot be found on null
at org.springframework.integration.transformer.MessageTransformingHandler.handleRequestMessage(MessageTransformingHandler.java:95)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:99)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:116)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:147)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:120)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:442)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:392)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:105)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:231)
at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:154)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:102)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:105)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
at org.springframework.integration.dispatcher.BroadcastingDispatcher.invokeHandler(BroadcastingDispatcher.java:227)
at org.springframework.integration.dispatcher.BroadcastingDispatcher.dispatch(BroadcastingDispatcher.java:176)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:442)
at org.springframework.integration.channel.MessagePublishingErrorHandler.handleError(MessagePublishingErrorHandler.java:85)
at org.springframework.integration.util.ErrorHandlingTaskExecutor$1.run(ErrorHandlingTaskExecutor.java:58)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:51)
at org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller.run(AbstractPollingEndpoint.java:324)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:81)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.messaging.MessageHandlingException: nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 0): Property or field 'headers' cannot be found on null
at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:96)
at org.springframework.integration.transformer.AbstractMessageProcessingTransformer.transform(AbstractMessageProcessingTransformer.java:90)
at org.springframework.integration.transformer.MessageTransformingHandler.handleRequestMessage(MessageTransformingHandler.java:89)
... 34 common frames omitted
Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 0): Property or field 'headers' cannot be found on null
at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:220)
at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:94)
at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:81)
at org.springframework.expression.spel.ast.CompoundExpression.getValueRef(CompoundExpression.java:51)
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:87)
at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:120)
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:267)
at com.objectway.bacco.integration.component.analytics.ProcessTransformer.evaluateExpression(ProcessTransformer.java:118)
at com.objectway.bacco.integration.component.analytics.ProcessTransformer.retrieveValueByKey(ProcessTransformer.java:115)
at com.objectway.bacco.integration.component.analytics.ProcessTransformer.transform(ProcessTransformer.java:57)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.expression.spel.support.ReflectiveMethodExecutor.execute(ReflectiveMethodExecutor.java:113)
at org.springframework.expression.spel.ast.MethodReference.getValueInternal(MethodReference.java:129)
at org.springframework.expression.spel.ast.MethodReference.access$000(MethodReference.java:49)
at org.springframework.expression.spel.ast.MethodReference$MethodValueRef.getValue(MethodReference.java:347)
at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:88)
at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:131)
at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:330)
at org.springframework.integration.util.AbstractExpressionEvaluator.evaluateExpression(AbstractExpressionEvaluator.java:166)
at org.springframework.integration.util.MessagingMethodInvokerHelper.processInternal(MessagingMethodInvokerHelper.java:317)
at org.springframework.integration.util.MessagingMethodInvokerHelper.process(MessagingMethodInvokerHelper.java:155)
at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:93)
From the documentation F.4 When Exceptions occur in a scheduled poller task’s execution, those exceptions will be wrapped in ErrorMessages and sent to the errorChannel as well.
Is the ErrorMessages the problem? I found the ErrorMessage class but not the ErrorMessages.
Thank you
EDIT: the failedMessage is null. How is it possible?
#Bean
public MessageSource<?> dateMessageSource() {
MethodInvokingMessageSource source = new MethodInvokingMessageSource();
source.setObject( new SystemTime() );
source.setMethodName( "getTime" );
return source;
}
#Bean
public IntegrationFlow initIntegrationFlow( ProcessTransformer processTransformer,
MongoCleanerService mongoCleanerService,
ControlComponentService controlComponentService,
DirectoryService directoryService,
#Value( "${output.directory}" ) String outputDirectory,
#Qualifier( DAILY_POLLER ) PollerSpec pollerSpec ) {
return IntegrationFlows.from( dateMessageSource(), c -> c.poller( pollerSpec ) )
.enrichHeaders( headerEnricherSpec -> headerEnricherSpec.headerFunction( CORRELATION_ID, message -> "00000" )
.headerFunction( NETWORK, message -> "-ALL-" )
.headerFunction( GROUP, message -> "ALL" )
.headerFunction( DOMAIN, ( message ) -> ( INIT ) ) )
.transform( new FlowLogger()
.level( INFO )
.expression( "'INITIALIZATION - Start Initializer, drop collections and temporary files'" )
.logService( logService ) )
.transform( processTransformer )
.handle( ( payload, headers ) -> {
controlComponentService.manageComponent( "ftpExportFlow", "start" );
mongoCleanerService.clean();
directoryService.cleanTmp( outputDirectory );
return new InitializationMessage();
} )
.channel( INITIALIZED_CHANNEL )
.get();
}
#Bean
public IntegrationFlow endWithErrorFlowBean( ProcessRepository processRepository,
AnalyticsService analyticsService,
LogService logService ) {
return IntegrationFlows
.from( IntegrationContextUtils.ERROR_CHANNEL_BEAN_NAME )
.transform( new FlowLogger().level( INFO ).expression( "'ERROR - Processing error'" )
.logService( logService ) )
.transform( new ProcessTransformer()
.processRepository( processRepository )
.analyticsService( analyticsService )
.processStatusType( ProcessStatusType.PROCESS_WITH_ERROR ) )
.transform( source -> {
controlBus.sendCommand( "#ftpExportFlow.stop()" );
return processRepository.findByProcessStatusType( ProcessStatusType.PROCESS_WITH_ERROR );
} )
.filter( processes -> ( ( List<Process> ) processes ).size() == 1 )
.channel( REPORT_INPUT_CHANNEL )
.get();
}
The failure is before a message has been created - hence the null failedMessage.
2017-04-07 06:25:04.857 | | | | [taskScheduler-9] | ERROR | org.springframework.integration.handler.LoggingHandler | handleMessageInternal | org.springframework.messaging.MessagingException: The path [/tmp/bacco/bank_ftp/00082] does not denote a properly accessible directory.
You only get a failedMessage property after a message has been created - typically when an error occurs in the downstream flow.

JSON string cut off half way, java inputstream

I'm having an issue with a JSON string in getting back from a FileInputStream in Java. I'm using Android. The problem is the string is not read in it's entirety and is cut off about half way through. I thought this might be to do with the max buffer size i have assigned maxBufferSize = 84 * 1024 in my UploadImage class, however if i increase that too much i get exception errors thrown when i attempt to read the byte stream. Here is my UploadImage class:
public class UploadImage {
public String serverUrl = "#";
public String filepath;
// Context allows for the access to application specific resources
Context context;
// json returned
public static String json_returned = "";
public UploadImage(String path, Context c) {
filepath = path;context = c;
}
public int uploadFile() {
String file = filepath;
int serverResponse = 200;
HttpURLConnection con = null;
DataOutputStream dos = null;
int bytesRead, bytesAvailable, bufferSize;
byte[] buffer;
// TODO: This size may differ greatly on different devices. Plz Fix.
int maxBufferSize = 84 * 1024;
File sourceFile = new File(file);
Log.e("","SourceFile: "+sourceFile);
// check if the file exists
if(!sourceFile.isFile()) {
return 0;
} else {
try {
FileInputStream fileInput = new FileInputStream(sourceFile);
URL url = new URL(serverUrl);
// Open connection to send image
con = (HttpURLConnection)url.openConnection();
con.setDoInput(true); // Allow Inputs
con.setDoOutput(true); // Allow Outputs
con.setUseCaches(false);
con.setRequestMethod("POST");
con.setRequestProperty("Connection", "Keep-Alive");
con.setRequestProperty("ENCTYPE", "multipart/form-data");
con.setRequestProperty("Content-Type", "multipart/form-data;boundary=*****");
con.setRequestProperty("image_data", filepath);
// Now get our response/output stream from the server
dos = new DataOutputStream(con.getOutputStream());
dos.writeBytes("--*****\r\n");
dos.writeBytes("Content-Disposition: form-data; name='image_data';filename="+"'"
+ filepath + ".jpg'" + "\r\n");
dos.writeBytes("\r\n");
// Now read our file and then write to it
bytesAvailable = fileInput.available();
Log.e("", "BytesAvailable: "+bytesAvailable);
bufferSize = Math.min(bytesAvailable, maxBufferSize);
buffer = new byte[bufferSize];
bytesRead = fileInput.read(buffer, 0, maxBufferSize);
while(bytesRead > 0) {
dos.write(buffer,0,bufferSize);
bytesAvailable = fileInput.available();
bufferSize = Math.min(bytesAvailable, maxBufferSize);
bytesRead = fileInput.read(buffer,0,bufferSize);
}
dos.writeBytes("\r\n");
dos.writeBytes("--*****\r\n");
BufferedReader sr = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8"));
StringBuilder responseString = new StringBuilder();
String inputStr;
while((inputStr = sr.readLine()) != null) {
responseString.append(inputStr);
}
GetResponse(responseString.toString());
// get server response
serverResponse = con.getResponseCode();
String response = con.getResponseMessage();
Log.i("image_data", "HTTP Response is : "
+ response + ": " + serverResponse);
// close the stream
fileInput.close();
dos.flush();
dos.close();
Log.e("End of Connection, ", "File apparently Uploaded.");
} catch(MalformedURLException ex) {
Log.e("Upload file to server", "error: " + ex.getMessage(), ex);
} catch(Exception e) {
//Log.e("Other Exception: ", "ex: "+e);
e.printStackTrace();
}
}
return serverResponse;
}
public void GetResponse(String response) {
if(!response.isEmpty()) {
this.json_returned = response;
}
}
public String getString() {
return json_returned;
}
}
The JSON string i should be expecting is this:
{
"foods":{
"food":[
{
"food_description":"Per 101g - Calories: 197kcal | Fat: 7.79g | Carbs: 0.00g | Protein: 29.80g",
"food_id":"1641",
"food_name":"Chicken Breast",
"food_type":"Generic",
"food_url":"http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-breast-ns-as-to-skin-eaten"
},
{
"food_description":"Per 100g - Calories: 110kcal | Fat: 1.24g | Carbs: 0.00g | Protein: 23.09g",
"food_id":"4881229",
"food_name":"Skinless Chicken Breast",
"food_type":"Generic",
"food_url":"http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-breast-skinless"
},
{
"food_description":"Per 101g - Calories: 239kcal | Fat: 13.60g | Carbs: 0.00g | Protein: 27.30g",
"food_id":"448901",
"food_name":"Grilled Chicken",
"food_type":"Generic",
"food_url":"http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-grilled-ns-as-to-skin-eaten"
},
{
"food_description":"Per 101g - Calories: 247kcal | Fat: 15.49g | Carbs: 0.00g | Protein: 25.06g",
"food_id":"1695",
"food_name":"Chicken Thigh",
"food_type":"Generic",
"food_url":"http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-thigh-ns-as-to-skin-eaten"
},
{
"food_description":"Per 101g - Calories: 239kcal | Fat: 13.60g | Carbs: 0.00g | Protein: 27.30g",
"food_id":"419178",
"food_name":"Rotisserie Chicken",
"food_type":"Generic",
"food_url":"http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-rotisserie-ns-as-to-skin-eaten"
},
{
"brand_name":"Valbest",
"food_description":"Per 4 oz - Calories: 130kcal | Fat: 3.00g | Carbs: 0.00g | Protein: 26.00g",
"food_id":"3946778",
"food_name":"Chicken Breast",
"food_type":"Brand",
"food_url":"http:\/\/www.fatsecret.com\/calories-nutrition\/valbest\/chicken-breast"
},
{
"food_description":"Per 101g - Calories: 216kcal | Fat: 11.15g | Carbs: 0.00g | Protein: 27.03g",
"food_id":"1677",
"food_name":"Chicken Drumstick",
"food_type":"Generic",
"food_url":"http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-drumstick-ns-as-to-skin-eaten"
},
{
"food_description":"Per 101g - Calories: 190kcal | Fat: 7.41g | Carbs: 0.00g | Protein: 28.93g",
"food_id":"1628",
"food_name":"Roasted Broiled or Baked Chicken (Skin Not Eaten)",
"food_type":"Generic",
"food_url":"http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-roasted-broiled-or-baked-skin-not-eaten"
},
{
"food_description":"Per 101g - Calories: 239kcal | Fat: 13.60g | Carbs: 0.00g | Protein: 27.30g",
"food_id":"1623",
"food_name":"Chicken",
"food_type":"Generic",
"food_url":"http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-ns-as-to-skin-eaten"
},
{
"brand_name":"Cub Foods",
"food_description":"Per 1 small - Calories: 110kcal | Fat: 2.50g | Carbs: 0.00g | Protein: 21.00g",
"food_id":"26245",
"food_name":"Boneless Skinless Chicken Breast",
"food_type":"Brand",
"food_url":"http:\/\/www.fatsecret.com\/calories-nutrition\/cub-foods\/boneless-skinless-chicken-breast"
},
{
"food_description":"Per 96g - Calories: 279kcal | Fat: 16.60g | Carbs: 9.59g | Protein: 21.45g",
"food_id":"1636",
"food_name":"Baked or Fried Coated Chicken with Skin (Skin\/Coating Eaten)",
"food_type":"Generic",
"food_url":"http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-coated-baked-or-fried-prepared-with-skin-skin-coating-eaten"
},
{
"food_description":"Per 101g - Calories: 209kcal | Fat: 10.88g | Carbs: 0.00g | Protein: 25.94g",
"food_id":"1697",
"food_name":"Chicken Thigh (Skin Not Eaten)",
"food_type":"Generic",
"food_url":"http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-thigh-skin-not-eaten"
},
{
"food_description":"Per 101g - Calories: 290kcal | Fat: 19.46g | Carbs: 0.00g | Protein: 26.86g",
"food_id":"1713",
"food_name":"Chicken Wing",
"food_type":"Generic",
"food_url":"http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-wing-ns-as-to-skin-eaten"
},
{
"brand_name":"Pilgrim\u0027s Pride",
"food_description":"Per 1 serving - Calories: 90kcal | Fat: 0.00g | Carbs: 0.00g | Protein: 22.00g",
"food_id":"25945",
"food_name":"Chicken Breast Tenderloins",
"food_type":"Brand",
"food_url":"http:\/\/www.fatsecret.com\/calories-nutrition\/pilgrims-pride\/chicken-breast-tenderloins"
},
{
"food_description":"Per 103g - Calories: 241kcal | Fat: 10.17g | Carbs: 9.97g | Protein: 25.73g",
"food_id":"1657",
"food_name":"Baked or Fried Coated Chicken Breast Skinless (Coating Eaten)",
"food_type":"Generic",
"food_url":"http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-breast-coated-baked-or-fried-prepared-skinless-coating-eaten"
},
{
"food_description":"Per 101g - Calories: 247kcal | Fat: 15.49g | Carbs: 0.00g | Protein: 25.06g",
"food_id":"1696",
"food_name":"Chicken Thigh (Skin Eaten)",
"food_type":"Generic",
"food_url":"http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-thigh-skin-eaten"
},
{
"food_description":"Per 101g - Calories: 165kcal | Fat: 3.57g | Carbs: 0.00g | Protein: 31.02g",
"food_id":"1643",
"food_name":"Chicken Breast (Skin Not Eaten)",
"food_type":"Generic",
"food_url":"http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-breast-skin-not-eaten"
},
{
"food_description":"Per 101g - Calories: 190kcal | Fat: 7.41g | Carbs: 0.00g | Protein: 28.93g",
"food_id":"448917",
"food_name":"Grilled Chicken (Skin Not Eaten)",
"food_type":"Generic",
"food_url":"http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-grilled-skin-not-eaten"
},
{
"food_description":"Per 101g - Calories: 232kcal | Fat: 13.46g | Carbs: 0.00g | Protein: 25.96g",
"food_id":"1660",
"food_name":"Chicken Leg (Skin Eaten)",
"food_type":"Generic",
"food_url":"http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-leg-(drumstick-and-thigh)-skin-eaten"
},
{
"food_description":"Per 104g - Calories: 221kcal | Fat: 9.52g | Carbs: 0.00g | Protein: 31.92g",
"food_id":"1637",
"food_name":"Baked or Fried Coated Chicken with Skin (Skin\/Coating Not Eaten)",
"food_type":"Generic",
"food_url":"http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-coated-baked-or-fried-prepared-with-skin-skin-coating-not-eaten"
}
],
"max_results":"20",
"page_number":"0",
"total_results":"4726"
}
}
However i am only getting back this:
{ "foods": { "food": [ {"food_description": "Per 101g - Calories: 197kcal | Fat: 7.79g | Carbs: 0.00g | Protein: 29.80g", "food_id": "1641", "food_name": "Chicken Breast", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-breast-ns-as-to-skin-eaten" }, {"food_description": "Per 100g - Calories: 110kcal | Fat: 1.24g | Carbs: 0.00g | Protein: 23.09g", "food_id": "4881229", "food_name": "Skinless Chicken Breast", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-breast-skinless" }, {"food_description": "Per 101g - Calories: 239kcal | Fat: 13.60g | Carbs: 0.00g | Protein: 27.30g", "food_id": "448901", "food_name": "Grilled Chicken", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-grilled-ns-as-to-skin-eaten" }, {"food_description": "Per 101g - Calories: 247kcal | Fat: 15.49g | Carbs: 0.00g | Protein: 25.06g", "food_id": "1695", "food_name": "Chicken Thigh", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-thigh-ns-as-to-skin-eaten" }, {"food_description": "Per 101g - Calories: 239kcal | Fat: 13.60g | Carbs: 0.00g | Protein: 27.30g", "food_id": "419178", "food_name": "Rotisserie Chicken", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-rotisserie-ns-as-to-skin-eaten" }, {"brand_name": "Valbest", "food_description": "Per 4 oz - Calories: 130kcal | Fat: 3.00g | Carbs: 0.00g | Protein: 26.00g", "food_id": "3946778", "food_name": "Chicken Breast", "food_type": "Brand", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/valbest\/chicken-breast" }, {"food_description": "Per 101g - Calories: 216kcal | Fat: 11.15g | Carbs: 0.00g | Protein: 27.03g", "food_id": "1677", "food_name": "Chicken Drumstick", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-drumstick-ns-as-to-skin-eaten" }, {"food_description": "Per 101g - Calories: 190kcal | Fat: 7.41g | Carbs: 0.00g | Protein: 28.93g", "food_id": "1628", "food_name": "Roasted Broiled or Baked Chicken (Skin Not Eaten)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-roasted-broiled-or-baked-skin-not-eaten" }, {"food_description": "Per 101g - Calories: 239kcal | Fat: 13.60g | Carbs: 0.00g | Protein: 27.30g", "food_id": "1623", "food_name": "Chicken", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-ns-as-to-skin-eaten" }, {"brand_name": "Cub Foods", "food_description": "Per 1 small - Calories: 110kcal | Fat: 2.50g | Carbs: 0.00g | Protein: 21.00g", "food_id": "26245", "food_name": "Boneless Skinless Chicken Breast", "food_type": "Brand", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/cub-foods\/boneless-skinless-chicken-breast" }, {"food_description": "Per 96g - Calories: 279kcal | Fat: 16.60g | Carbs: 9.59g | Protein: 21.45g", "food_id": "1636", "food_name": "Baked or Fried Coated Chicken with Skin (Skin\/Coating Eaten)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-coated-baked-or-fried-prepared-with-skin-skin-coating-eaten" }, {"food_description": "Per 101g - Calories: 209kcal | Fat: 10.88g | Carbs: 0.00g | Protein: 25.94g", "food_id": "1697", "food_name": "Chicken Thigh (Skin Not Eaten)", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-thigh-skin-not-eaten" }, {"food_description": "Per 101g - Calories: 290kcal | Fat: 19.46g | Carbs: 0.00g | Protein: 26.86g", "food_id": "1713", "food_name": "Chicken Wing", "food_type": "Generic", "food_url": "http:\/\/www.fatsecret.com\/calories-nutrition\/generic\/chicken-wing-ns-as-to-skin-eaten" }, {"brand_name": "Pilgrim\u0027s Pride", "food_description": "Per 1 serving - Calories: 90kcal | Fat: 0.00g | Carbs: 0.00g | Protein: 22.00g", "foo
Found a good workaround in this post thanks to the comment above pointing out that Logcat has a maximum file size for single log entries. Instead of Log.d("tag", "msg"), use this function which will break it up into smaller strings for Logcat:
public static void largeLog(String tag, String content) {
if (content.length() > 4000) {
Log.d(tag, content.substring(0, 4000));
largeLog(tag, content.substring(4000));
} else {
Log.d(tag, content);
}
}

Categories

Resources