Using keycloak api for a public client - java
Working on a project where there is a frontend (React) and a backend (Java/Quarkus). Keycloak is used as the auth tool. It is configured with a realm that has a public client on it. This allows the user to login via the browser and then make api requests to the backend with a bearer token attached to the request.
Running into a problem where we want to add users to our application. This means we also need to add them to keycloak. Doing this programatically, this is in its own mini module and it uses the keycloak-admin-client library.
I initiate the instance with
instance = KeycloakBuilder.builder()
.serverUrl(props.getProperty(PropertyConstants.SERVER_URL))
.realm(props.getProperty(PropertyConstants.REALM))
.grantType(OAuth2Constants.PASSWORD)
.clientId(props.getProperty(PropertyConstants.CLIENT_ID))
.username(props.getProperty(PropertyConstants.USERNAME))
.password(props.getProperty(PropertyConstants.PASSWORD))
.build();
realmResource = instance.realm(props.getProperty(PropertyConstants.REALM));
usersResource = realmResource.users();
UserRepresentation user = createUserRep();
Response response = usersResource.create(user);
The stacktrace is;
org.jboss.resteasy.spi.UnhandledException: javax.ws.rs.ProcessingException: RESTEASY004655: Unable to invoke request: javax.ws.rs.ProcessingException: RESTEASY003215: could not find writer for content-type application/x-www-form-urlencoded type: javax.ws.rs.core.Form$1
at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:106)
at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:372)
at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:218)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:519)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:261)
at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:161)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:364)
at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:164)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:247)
at io.quarkus.resteasy.runtime.standalone.RequestDispatcher.service(RequestDispatcher.java:73)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:136)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.access$000(VertxRequestHandler.java:40)
at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler$1.run(VertxRequestHandler.java:97)
at io.quarkus.runtime.CleanableExecutor$CleaningRunnable.run(CleanableExecutor.java:231)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
at java.base/java.lang.Thread.run(Thread.java:829)
at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Caused by: javax.ws.rs.ProcessingException: RESTEASY004655: Unable to invoke request: javax.ws.rs.ProcessingException: RESTEASY003215: could not find writer for content-type application/x-www-form-urlencoded type: javax.ws.rs.core.Form$1
at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.invoke(ManualClosingApacheHttpClient43Engine.java:287)
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:488)
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invokeSync(ClientInvoker.java:149)
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:112)
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:76)
at com.sun.proxy.$Proxy89.grantToken(Unknown Source)
at org.keycloak.admin.client.token.TokenManager.grantToken(TokenManager.java:90)
at org.keycloak.admin.client.token.TokenManager.getAccessToken(TokenManager.java:70)
at org.keycloak.admin.client.token.TokenManager.getAccessTokenString(TokenManager.java:65)
at org.keycloak.admin.client.resource.BearerAuthFilter.filter(BearerAuthFilter.java:52)
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.filterRequest(ClientInvocation.java:683)
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:485)
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invokeSync(ClientInvoker.java:149)
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:112)
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:76)
at com.sun.proxy.$Proxy96.create(Unknown Source)
at com.demservices.KeycloakWrapper.addUser(KeycloakWrapper.java:56)
at com.demservices.services.UserService.addUser(UserService.java:27)
at com.demservices.services.UserService_Subclass.addUser$$superaccessor2(UserService_Subclass.zig:492)
at com.demservices.services.UserService_Subclass$$function$$2.apply(UserService_Subclass$$function$$2.zig:33)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:127)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.invokeInOurTx(TransactionalInterceptorBase.java:100)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.doIntercept(TransactionalInterceptorRequired.java:32)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorBase.intercept(TransactionalInterceptorBase.java:53)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired.intercept(TransactionalInterceptorRequired.java:26)
at io.quarkus.narayana.jta.runtime.interceptor.TransactionalInterceptorRequired_Bean.intercept(TransactionalInterceptorRequired_Bean.zig:340)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
at com.demservices.services.UserService_Subclass.addUser(UserService_Subclass.zig:440)
at com.demservices.services.UserService_ClientProxy.addUser(UserService_ClientProxy.zig:251)
at com.demservices.controllers.UserController.createNewUser(UserController.java:35)
at com.demservices.controllers.UserController_Subclass.createNewUser$$superaccessor1(UserController_Subclass.zig:234)
at com.demservices.controllers.UserController_Subclass$$function$$1.apply(UserController_Subclass$$function$$1.zig:33)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.proceed(AroundInvokeInvocationContext.java:54)
at io.quarkus.hibernate.validator.runtime.interceptor.AbstractMethodValidationInterceptor.validateMethodInvocation(AbstractMethodValidationInterceptor.java:69)
at io.quarkus.hibernate.validator.runtime.jaxrs.JaxrsEndPointValidationInterceptor.validateMethodInvocation(JaxrsEndPointValidationInterceptor.java:35)
at io.quarkus.hibernate.validator.runtime.jaxrs.JaxrsEndPointValidationInterceptor_Bean.intercept(JaxrsEndPointValidationInterceptor_Bean.zig:392)
at io.quarkus.arc.impl.InterceptorInvocation.invoke(InterceptorInvocation.java:41)
at io.quarkus.arc.impl.AroundInvokeInvocationContext.perform(AroundInvokeInvocationContext.java:41)
at io.quarkus.arc.impl.InvocationContexts.performAroundInvoke(InvocationContexts.java:32)
at com.demservices.controllers.UserController_Subclass.createNewUser(UserController_Subclass.zig:191)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:170)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:130)
at org.jboss.resteasy.core.ResourceMethodInvoker.internalInvokeOnTarget(ResourceMethodInvoker.java:643)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTargetAfterFilter(ResourceMethodInvoker.java:507)
at org.jboss.resteasy.core.ResourceMethodInvoker.lambda$invokeOnTarget$2(ResourceMethodInvoker.java:457)
at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:364)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:459)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:419)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:393)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:68)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:492)
... 20 more
Caused by: javax.ws.rs.ProcessingException: RESTEASY003215: could not find writer for content-type application/x-www-form-urlencoded type: javax.ws.rs.core.Form$1
at org.jboss.resteasy.core.interception.jaxrs.ClientWriterInterceptorContext.throwWriterNotFoundException(ClientWriterInterceptorContext.java:50)
at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.getWriter(AbstractWriterInterceptorContext.java:302)
at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.syncProceed(AbstractWriterInterceptorContext.java:240)
at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:224)
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.writeRequestBody(ClientInvocation.java:440)
at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.writeRequestBodyToOutputStream(ManualClosingApacheHttpClient43Engine.java:589)
at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.buildEntity(ManualClosingApacheHttpClient43Engine.java:548)
at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.loadHttpMethod(ManualClosingApacheHttpClient43Engine.java:455)
at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.invoke(ManualClosingApacheHttpClient43Engine.java:265)
... 77 more
I see in any example that a clientSecret is required but that is for confidential clients. I don't want this, I need the client to be public.
How can I have a public client while also being able to make API calls to it?
Related
Java Soap web service connection: could not send Message
When I Try to connect a soap webservice with java, I take an exeption about like this javax.xml.ws.WebServiceException: Could not send Message. at org.apache.cxf.jaxws.JaxWsClientProxy.mapException(JaxWsClientProxy.java:183) at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:145) at com.sun.proxy.$Proxy83.hastaHizmetVerileriGetir(Unknown Source) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.inte at org.junit.vintage.engine.VintageTestEngine$$Lambda$361/0000000000000000.accept(Unknown Source) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:497) at java.base/ja at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:763) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:463) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:209) Caused by: org.apache.cxf.transport.http.HTTPException: HTTP response '404: Not Found' when communicating with url.example.com at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.doProcessResponseCode(HTTPConduit.java:1619) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1626) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1571) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1371) at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:671) at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:63) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:441) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:356) at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:314) at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96) at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:140) ... 53 more private IESHIstanbul getPort(CortexEvdeSaglikClientContext context, String methodName) { JaxWsProxyFactoryBean serviceProxyFactoryBean = WsUtils.getServiceProxyFactoryBean(IESHIstanbul.class, context.getUrl()); SoapLogInfo soapLogInfo = new SoapLogInfo(); soapLogInfo.setUrl(context.getUrl()); soapLogInfo.setMethodName(methodName); soapHandlerService.getLoggingHandler(soapLogInfo); Object port = serviceProxyFactoryBean.create(); WsUtils.setServiceEndPoint(port, context.getUrl()); return (IESHIstanbul) port; } This about org.apache.cxf.transport.http.HTTPException: HTTP response '404: Not Found'. I have made some research about it but, I couldn't find any valuable solution.
GCP: "Invalid JWT Signature" when using Service Account JSON
I'm using Google's gRPC library to access data from my GCP domain. My code performs authentication using a service account JSON key. It worked fine for about a month, until recently I started receiving the following error on any action I try to perform: {"error":"invalid_grant","error_description":"Invalid JWT Signature."} I should note that the authentication process executes without errors, as does creation of the service object (see Java code example below). The error is thrown when I try to perform any data access action, e.g. the listSecrets method in the example below. Searching for this problem on the web, I have found mainly answers that point to a system time/timezone error; however, the date & time & timezone on my computer are completely accurate. Any suggestions? Example of my Java code: String projectId = "my-project"; GoogleCredentials credentials = GoogleCredentials.fromStream(new FileInputStream("C:\\Users\\elisha.l\\Downloads\\co-club-project-01-3588a3330456.json")); SecretManagerServiceClient client = SecretManagerServiceClient.create(); ProjectName parent = ProjectName.of(projectId); ListSecretsPagedResponse response = client.listSecrets(parent); Stacktrace of the error: Exception in thread "main" com.google.api.gax.rpc.UnavailableException: io.grpc.StatusRuntimeException: UNAVAILABLE: Credentials failed to obtain metadata at com.google.api.gax.rpc.ApiExceptionFactory.createException(ApiExceptionFactory.java:69) at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:72) at com.google.api.gax.grpc.GrpcApiExceptionFactory.create(GrpcApiExceptionFactory.java:60) at com.google.api.gax.grpc.GrpcExceptionCallable$ExceptionTransformingFuture.onFailure(GrpcExceptionCallable.java:97) at com.google.api.core.ApiFutures$1.onFailure(ApiFutures.java:68) at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1050) at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:30) at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:1176) at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:969) at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:760) at io.grpc.stub.ClientCalls$GrpcFuture.setException(ClientCalls.java:563) at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:533) at io.grpc.internal.ClientCallImpl.closeObserver(ClientCallImpl.java:434) at io.grpc.internal.ClientCallImpl.access$500(ClientCallImpl.java:66) at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInternal(ClientCallImpl.java:763) at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:742) at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37) at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123) at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Suppressed: com.google.api.gax.rpc.AsyncTaskException: Asynchronous task failed at com.google.api.gax.rpc.ApiExceptions.callAndTranslateApiException(ApiExceptions.java:57) at com.google.api.gax.rpc.UnaryCallable.call(UnaryCallable.java:112) at com.google.cloud.secretmanager.v1.SecretManagerServiceClient.listSecrets(SecretManagerServiceClient.java:245) at com.google.cloud.secretmanager.v1.SecretManagerServiceClient.listSecrets(SecretManagerServiceClient.java:196) at google.Secret.main(Secret.java:26) Caused by: io.grpc.StatusRuntimeException: UNAVAILABLE: Credentials failed to obtain metadata at io.grpc.Status.asRuntimeException(Status.java:533) ... 14 more Caused by: java.io.IOException: Error getting access token for service account: 400 Bad Request POST https://oauth2.googleapis.com/token {"error":"invalid_grant","error_description":"Invalid JWT Signature."} at com.google.auth.oauth2.ServiceAccountCredentials.refreshAccessToken(ServiceAccountCredentials.java:444) at com.google.auth.oauth2.OAuth2Credentials.refresh(OAuth2Credentials.java:157) at com.google.auth.oauth2.OAuth2Credentials.getRequestMetadata(OAuth2Credentials.java:145) at com.google.auth.oauth2.ServiceAccountCredentials.getRequestMetadata(ServiceAccountCredentials.java:603) at com.google.auth.Credentials.blockingGetToCallback(Credentials.java:112) at com.google.auth.Credentials$1.run(Credentials.java:98) ... 7 more Caused by: com.google.api.client.http.HttpResponseException: 400 Bad Request POST https://oauth2.googleapis.com/token {"error":"invalid_grant","error_description":"Invalid JWT Signature."} at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1113) at com.google.auth.oauth2.ServiceAccountCredentials.refreshAccessToken(ServiceAccountCredentials.java:441) ... 12 more
I should note that the authentication process executes without errors, as does creation of the service object (see Java code example below). The error is thrown when I try to perform any data access action, e.g. the listSecrets method in the example below. I think you are saying that the instantiation of the GoogleCredentials and SecretManagerServiceClient objects do not throw any exceptions. But these don't actually validate your credentials until you invoke a method on the client object, like listServices. (Please let me know if I misunderstood and some methods on the SecretManagerServiceClient actually validate properly and succeed). It seems like there is some issue with your service account JSON key, so I would start by determining if it works separately from the Java code. You can follow the instructions at https://cloud.google.com/service-usage/docs/getting-started#test to use oauth2l to get a bearer token from your service account, then invoke the secret manager API directly using this bearer token via curl, as shown in https://cloud.google.com/secret-manager/docs/creating-and-accessing-secrets. Something like: curl "https://secretmanager.googleapis.com/v1/projects/project-id/secrets?secretId=secret-id" \ --request "POST" \ --header "authorization: Bearer <bearer token from oauth2l>" \ --header "content-type: application/json" \ --header "x-goog-user-project: project-id" \ --data "{\"replication\": {\"automatic\": {}}}" If that works whereas the Java code does not, then you will probably want to proceed by filing an issue on the https://github.com/googleapis/java-secretmanager repository. Alternatively to all of the above: it may be quicker just to create a new service account and see if that works, versus debugging precisely what's going wrong with the current account.
HTTP request failing with EOFException
Using Jetty 9.4.10.v20180503, occasionally my HTTP client fails with the following error. java.io.EOFException: HttpConnectionOverHTTP#571103e6(l:/192.168.1.100:27497 <-> r:api.kucoin.com/13.113.121.24:443,closed=false)=>HttpChannelOverHTTP#a423e61(exchange=HttpExchange#e7dbbf1 req=TERMINATED/null#null res=PENDING/null#null)[send=HttpSenderOverHTTP#4b7f345a(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator#61d4e46c{s=START}],recv=HttpReceiverOverHTTP#7a7e7f01(rsp=IDLE,failure=null)[HttpParser{s=CLOSED,0 of -1}]]<-DecryptedEndPoint#193ff18c{api.kucoin.com/13.113.121.24:443<->/192.168.1.100:27497,OPEN,fill=-,flush=-,to=22604/0}->HttpConnectionOverHTTP#571103e6(l:/192.168.1.100:27497 <-> r:api.kucoin.com/13.113.121.24:443,closed=false)=>HttpChannelOverHTTP#a423e61(exchange=HttpExchange#e7dbbf1 req=TERMINATED/null#null res=PENDING/null#null)[send=HttpSenderOverHTTP#4b7f345a(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator#61d4e46c{s=START}],recv=HttpReceiverOverHTTP#7a7e7f01(rsp=IDLE,failure=null)[HttpParser{s=CLOSED,0 of -1}]]->SocketChannelEndPoint#2b50cb15{api.kucoin.com/13.113.121.24:443<->/192.168.1.100:27497,ISHUT,fill=-,flush=-,to=21603/0}{io=0/0,kio=0,kro=1}->SslConnection#6de1ad97{NEED_WRAP,eio=-1/-1,di=-1}=>HttpConnectionOverHTTP#571103e6(l:/192.168.1.100:27497 <-> r:api.kucoin.com/13.113.121.24:443,closed=false)=>HttpChannelOverHTTP#a423e61(exchange=HttpExchange#e7dbbf1 req=TERMINATED/null#null res=PENDING/null#null)[send=HttpSenderOverHTTP#4b7f345a(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator#61d4e46c{s=START}],recv=HttpReceiverOverHTTP#7a7e7f01(rsp=IDLE,failure=null)[HttpParser{s=CLOSED,0 of -1}]] at java.util.concurrent.CompletableFuture.encodeRelay(CompletableFuture.java:326) at java.util.concurrent.CompletableFuture.completeRelay(CompletableFuture.java:338) at java.util.concurrent.CompletableFuture.uniRelay(CompletableFuture.java:911) at java.util.concurrent.CompletableFuture$UniRelay.tryFire(CompletableFuture.java:899) at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474) at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977) at com.myapplication.ResponseListener.onComplete(ResponseListener.java:45) at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:193) at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:185) at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:464) at org.eclipse.jetty.client.HttpReceiver.abort(HttpReceiver.java:545) at org.eclipse.jetty.client.HttpReceiver.responseFailure(HttpReceiver.java:436) at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.failAndClose(HttpReceiverOverHTTP.java:369) at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.earlyEOF(HttpReceiverOverHTTP.java:338) at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:1476) at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.shutdown(HttpReceiverOverHTTP.java:209) at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:147) at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:73) at org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:133) at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:155) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102) at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:291) at org.eclipse.jetty.io.ssl.SslConnection$3.succeeded(SslConnection.java:151) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102) at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168) at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126) at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:760) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:678) ... 1 common frames omitted Caused by: java.io.EOFException: HttpConnectionOverHTTP#571103e6(l:/192.168.1.100:27497 <-> r:api.kucoin.com/13.113.121.24:443,closed=false)=>HttpChannelOverHTTP#a423e61(exchange=HttpExchange#e7dbbf1 req=TERMINATED/null#null res=PENDING/null#null)[send=HttpSenderOverHTTP#4b7f345a(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator#61d4e46c{s=START}],recv=HttpReceiverOverHTTP#7a7e7f01(rsp=IDLE,failure=null)[HttpParser{s=CLOSED,0 of -1}]]<-DecryptedEndPoint#193ff18c{api.kucoin.com/13.113.121.24:443<->/192.168.1.100:27497,OPEN,fill=-,flush=-,to=22604/0}->HttpConnectionOverHTTP#571103e6(l:/192.168.1.100:27497 <-> r:api.kucoin.com/13.113.121.24:443,closed=false)=>HttpChannelOverHTTP#a423e61(exchange=HttpExchange#e7dbbf1 req=TERMINATED/null#null res=PENDING/null#null)[send=HttpSenderOverHTTP#4b7f345a(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator#61d4e46c{s=START}],recv=HttpReceiverOverHTTP#7a7e7f01(rsp=IDLE,failure=null)[HttpParser{s=CLOSED,0 of -1}]]->SocketChannelEndPoint#2b50cb15{api.kucoin.com/13.113.121.24:443<->/192.168.1.100:27497,ISHUT,fill=-,flush=-,to=21603/0}{io=0/0,kio=0,kro=1}->SslConnection#6de1ad97{NEED_WRAP,eio=-1/-1,di=-1}=>HttpConnectionOverHTTP#571103e6(l:/192.168.1.100:27497 <-> r:api.kucoin.com/13.113.121.24:443,closed=false)=>HttpChannelOverHTTP#a423e61(exchange=HttpExchange#e7dbbf1 req=TERMINATED/null#null res=PENDING/null#null)[send=HttpSenderOverHTTP#4b7f345a(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator#61d4e46c{s=START}],recv=HttpReceiverOverHTTP#7a7e7f01(rsp=IDLE,failure=null)[HttpParser{s=CLOSED,0 of -1}]] I'm trying to understand how to interpret this error, specifically the EOFException which seems to list the steps of the transaction. What is happening at each step? At what step of the HTTP request does the error occur? Did the client trigger a disconnect or the server? Is it safe to automatically retry these kind of failures?
Spring Neo4j - Cannot access unmanaged extension
I've deployed a Neo4j unmanaged extension. The unmanaged extension can be called using REST Client and successfully returned the result. The problem is when I try to call / invoke the unmanaged extension from another java class, it keep on throwing the 401 Unauthorized. I used Spring RestTemplate to invoke the unmanaged extension. My codes : RestTemplate restTemplate = new RestTemplate(); PostPhotoRest postPhotoRest = restTemplate.getForObject("http://myneo4jusername:myneo4jpassword#localhost:7474/extension/servicetwo/postphoto/55b12d35-94fd-4297-bb18-e6040d7b7109", PostPhotoRest.class); Full Error : Caused by: org.springframework.web.client.HttpClientErrorException: 401 Unauthorized at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91) ~[spring-web-4.3.0.RC2.jar:4.3.0.RC2] at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:668) ~[spring-web-4.3.0.RC2.jar:4.3.0.RC2] at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:621) ~[spring-web-4.3.0.RC2.jar:4.3.0.RC2] at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:581) ~[spring-web-4.3.0.RC2.jar:4.3.0.RC2] at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:288) ~[spring-web-4.3.0.RC2.jar:4.3.0.RC2] at my.winapp.hashtagmanipulation.worker.RabbitMQWorker.processMessage(RabbitMQWorker.java:76) ~[classes/:na] at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source) ~[na:na] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_66] at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_66] at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:197) ~[spring-messaging-4.3.0.RC2.jar:4.3.0.RC2] at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:115) ~[spring-messaging-4.3.0.RC2.jar:4.3.0.RC2] at org.springframework.amqp.rabbit.listener.adapter.HandlerAdapter.invoke(HandlerAdapter.java:48) ~[spring-rabbit-1.5.5.RELEASE.jar:na] at org.springframework.amqp.rabbit.listener.adapter.MessagingMessageListenerAdapter.invokeHandler(MessagingMessageListenerAdapter.java:112) ~[spring-rabbit-1.5.5.RELEASE.jar:na] ... 12 common frames omitted
The driver configuration can supply the URI and credentials configured in ogm.properties. Components.driver().getConfiguration().getURI(); Components.driver().getConfiguration().getCredentials();
Jetty 9.3.3: ClosedChannelException when using HTTPS
I am using Jetty HTTP client to send request via HTTPS, I configured the HTTP client to use SSL as the following: httpClient = new HttpClient(new SslContextFactory()); httpClient.setFollowRedirects(false); httpClient.start(); Request request = httpClient.newRequest(url); request.method(HttpMethod.GET); response = request.send(); httpClient.stop(); But I got this exception: java.util.concurrent.ExecutionException: java.nio.channels.ClosedChannelException at org.eclipse.jetty.client.util.FutureResponseListener.getResult(FutureResponseListener.java:118) at org.eclipse.jetty.client.util.FutureResponseListener.get(FutureResponseListener.java:101) at org.eclipse.jetty.client.HttpRequest.send(HttpRequest.java:653) at egm.httpClient.jetty.TestBackend.POST(TestBackend.java:206) at egm.httpClient.jetty.TestStep.execute(TestStep.java:77) at egm.httpClient.jetty.TestSuite.execute(TestSuite.java:57) at egm.httpClient.jetty.TestLauncher.main(TestLauncher.java:139) Caused by: java.nio.channels.ClosedChannelException at org.eclipse.jetty.io.FillInterest.onClose(FillInterest.java:135) at org.eclipse.jetty.io.AbstractEndPoint.onClose(AbstractEndPoint.java:116) at org.eclipse.jetty.io.SelectorManager.endPointClosed(SelectorManager.java:295) at org.eclipse.jetty.io.ManagedSelector$2.run(ManagedSelector.java:432) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572) at java.lang.Thread.run(Unknown Source)