I am creating AuthzClient to manually validate token, but getting below TLS verification error, i added my CA certificate to the cacerts of my JDK (which is version 17) and still getting same error, tried to add truststore with AuthzClient Configuration but still didn't work, how to disable SSL verification in Springboot or properly configure it, without Rest Templates.
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.atcom.cc.aes.connector.controllers.TelephonyWebsocketHandler]: Factory method 'telephonyWebsocketHandler' threw exception; nested exception is java.lang.RuntimeException: Could not obtain configuration from server [https://atcom-cc/auth/realms/atcom/.well-known/uma2-configuration].
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.3.20.jar:5.3.20]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653) ~[spring-beans-5.3.20.jar:5.3.20]
... 19 common frames omitted
Caused by: java.lang.RuntimeException: Could not obtain configuration from server [https://atcom-cc/auth/realms/atcom/.well-known/uma2-configuration].
at org.keycloak.authorization.client.AuthzClient.<init>(AuthzClient.java:266) ~[keycloak-authz-client-18.0.0.jar:18.0.0]
at org.keycloak.authorization.client.AuthzClient.create(AuthzClient.java:94) ~[keycloak-authz-client-18.0.0.jar:18.0.0]
at com.atcom.cc.aes.connector.controllers.TelephonyWebsocketHandler.<init>(TelephonyWebsocketHandler.java:74) ~[main/:na]
at com.atcom.cc.aes.connector.config.WebsocketsConfiguration.telephonyWebsocketHandler(WebsocketsConfiguration.java:46) ~[main/:na]
at com.atcom.cc.aes.connector.config.WebsocketsConfiguration$$EnhancerBySpringCGLIB$$ee0ba706.CGLIB$telephonyWebsocketHandler$3(<generated>) ~[main/:na]
at com.atcom.cc.aes.connector.config.WebsocketsConfiguration$$EnhancerBySpringCGLIB$$ee0ba706$$FastClassBySpringCGLIB$$d4491dc8.invoke(<generated>) ~[main/:na]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.3.20.jar:5.3.20]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331) ~[spring-context-5.3.20.jar:5.3.20]
at com.atcom.cc.aes.connector.config.WebsocketsConfiguration$$EnhancerBySpringCGLIB$$ee0ba706.telephonyWebsocketHandler(<generated>) ~[main/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.3.20.jar:5.3.20]
... 20 common frames omitted
Caused by: java.lang.RuntimeException: Error executing http method [GET]. Response : null
at org.keycloak.authorization.client.util.HttpMethod.execute(HttpMethod.java:106) ~[keycloak-authz-client-18.0.0.jar:18.0.0]
at org.keycloak.authorization.client.util.HttpMethodResponse$2.execute(HttpMethodResponse.java:50) ~[keycloak-authz-client-18.0.0.jar:18.0.0]
at org.keycloak.authorization.client.AuthzClient.<init>(AuthzClient.java:264) ~[keycloak-authz-client-18.0.0.jar:18.0.0]
... 33 common frames omitted
Caused by: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:131) ~[na:na]
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:371) ~[na:na]
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:314) ~[na:na]
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:309) ~[na:na]
at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1357) ~[na:na]
at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.onConsumeCertificate(CertificateMessage.java:1232) ~[na:na]
at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.consume(CertificateMessage.java:1175) ~[na:na]
at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:396) ~[na:na]
at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:480) ~[na:na]
at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:458) ~[na:na]
at java.base/sun.security.ssl.TransportContext.dispatch(TransportContext.java:201) ~[na:na]
at java.base/sun.security.ssl.SSLTransport.decode(SSLTransport.java:172) ~[na:na]
at java.base/sun.security.ssl.SSLSocketImpl.decode(SSLSocketImpl.java:1505) ~[na:na]
at java.base/sun.security.ssl.SSLSocketImpl.readHandshakeRecord(SSLSocketImpl.java:1420) ~[na:na]
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:455) ~[na:na]
at java.base/sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:426) ~[na:na]
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:436) ~[httpclient-4.5.13.jar:4.5.13]
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:384) ~[httpclient-4.5.13.jar:4.5.13]
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142) ~[httpclient-4.5.13.jar:4.5.13]
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:376) ~[httpclient-4.5.13.jar:4.5.13]
at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:393) ~[httpclient-4.5.13.jar:4.5.13]
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236) ~[httpclient-4.5.13.jar:4.5.13]
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:186) ~[httpclient-4.5.13.jar:4.5.13]
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89) ~[httpclient-4.5.13.jar:4.5.13]
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110) ~[httpclient-4.5.13.jar:4.5.13]
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185) ~[httpclient-4.5.13.jar:4.5.13]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83) ~[httpclient-4.5.13.jar:4.5.13]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108) ~[httpclient-4.5.13.jar:4.5.13]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56) ~[httpclient-4.5.13.jar:4.5.13]
at org.keycloak.authorization.client.util.HttpMethod.execute(HttpMethod.java:84) ~[keycloak-authz-client-18.0.0.jar:18.0.0]
... 35 common frames omitted
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:439) ~[na:na]
at java.base/sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:306) ~[na:na]
at java.base/sun.security.validator.Validator.validate(Validator.java:264) ~[na:na]
at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:231) ~[na:na]
at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:132) ~[na:na]
at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1341) ~[na:na]
... 60 common frames omitted
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at java.base/sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:141) ~[na:na]
at java.base/sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:126) ~[na:na]
at java.base/java.security.cert.CertPathBuilder.build(CertPathBuilder.java:297) ~[na:na]
at java.base/sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:434) ~[na:na]
... 65 common frames omitted
Related
I am getting following exception on container startup and than it goes into crashbackloop.
Can anyone please help me identify what can be the cause or how i can identify the cause? It is a simple app and exception is occurring in main method.
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65)
Caused by: java.lang.InternalError: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.platform.Metrics.systemMetrics(Metrics.java:65)
at java.base/jdk.internal.platform.Container.metrics(Container.java:43)
at jdk.management/com.sun.management.internal.OperatingSystemImpl.(OperatingSystemImpl.java:48)
at jdk.management/com.sun.management.internal.PlatformMBeanProviderImpl.getOperatingSystemMXBean(PlatformMBeanProviderImpl.java:279)
at jdk.management/com.sun.management.internal.PlatformMBeanProviderImpl$3.nameToMBeanMap(PlatformMBeanProviderImpl.java:198)
at java.management/java.lang.management.ManagementFactory.lambda$getPlatformMBeanServer$0(ManagementFactory.java:487)
at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:273)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1766)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at java.management/java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:488)
at org.apache.logging.log4j.core.jmx.Server.reregisterMBeansAfterReconfigure(Server.java:140)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:637)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:699)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:716)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:270)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:155)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:47)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:196)
at org.apache.commons.logging.LogAdapter$Log4jLog.(LogAdapter.java:155)
at org.apache.commons.logging.LogAdapter$Log4jAdapter.createLog(LogAdapter.java:122)
at org.apache.commons.logging.LogAdapter.createLog(LogAdapter.java:89)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:67)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:59)
at org.springframework.boot.SpringApplication.(SpringApplication.java:178)
at com.i2c.web.services.ivrversions.IVRVersionApplication.main(IVRVersionApplication.java:15)
... 8 more
Caused by: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at java.base/jdk.internal.platform.Metrics.systemMetrics(Metrics.java:61)
... 38 more
Caused by: java.lang.NullPointerException
at java.base/java.util.Objects.requireNonNull(Objects.java:208)
at java.base/sun.nio.fs.UnixFileSystem.getPath(UnixFileSystem.java:260)
at java.base/java.nio.file.Path.of(Path.java:147)
at java.base/java.nio.file.Paths.get(Paths.java:69)
at java.base/jdk.internal.platform.CgroupUtil.lambda$readStringValue$1(CgroupUtil.java:66)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:554)
at java.base/jdk.internal.platform.CgroupUtil.readStringValue(CgroupUtil.java:68)
at java.base/jdk.internal.platform.CgroupSubsystemController.getStringValue(CgroupSubsystemController.java:65)
at java.base/jdk.internal.platform.CgroupSubsystemController.getLongValue(CgroupSubsystemController.java:124)
at java.base/jdk.internal.platform.cgroupv1.CgroupV1Subsystem.getLongValue(CgroupV1Subsystem.java:175)
at java.base/jdk.internal.platform.cgroupv1.CgroupV1Subsystem.getHierarchical(CgroupV1Subsystem.java:149)
at java.base/jdk.internal.platform.cgroupv1.CgroupV1Subsystem.initSubSystem(CgroupV1Subsystem.java:84)
at java.base/jdk.internal.platform.cgroupv1.CgroupV1Subsystem.getInstance(CgroupV1Subsystem.java:60)
at java.base/jdk.internal.platform.CgroupSubsystemFactory.create(CgroupSubsystemFactory.java:116)
at java.base/jdk.internal.platform.CgroupMetrics.getInstance(CgroupMetrics.java:167)
... 43 more
My project have 2 APIs and I want to separate test for each API.
So I am trying to use MockRestServiceServer to mock my API but MockRestServiceServer requires all of API that I have in my project have to mock even it does not need.
My spring boot version:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.6</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
There are my code: using 2 schedules to call 2 APIs
#Scheduled(fixedDelay = 3000)
public void schedule1() {
restTemplate.getForEntity(URI.create("http://localhost:9090/api1"), String.class);
}
#Scheduled(fixedDelay = 3000)
public void schedule2() {
restTemplate.getForEntity(URI.create("http://localhost:9090/api2"), String.class);
}
And my test
#Test
void testSchedule1() {
mockServer = MockRestServiceServer.bindTo(restTemplate).ignoreExpectOrder(true).build();
mockServer
.expect(ExpectedCount.manyTimes(),
MockRestRequestMatchers.requestTo(new StringStartsWith("http://localhost:9090/api1")))
.andExpect(MockRestRequestMatchers.method(HttpMethod.GET))
.andRespond(MockRestResponseCreators.withStatus(HttpStatus.OK).body(""));
mockServer.verify(Duration.ofSeconds(10));
}
#Test
void testSchedule2() {
mockServer = MockRestServiceServer.bindTo(restTemplate).ignoreExpectOrder(true).build();
mockServer
.expect(ExpectedCount.manyTimes(),
MockRestRequestMatchers.requestTo(new StringStartsWith("http://localhost:9090/api2")))
.andExpect(MockRestRequestMatchers.method(HttpMethod.GET))
.andRespond(MockRestResponseCreators.withStatus(HttpStatus.OK).body(""));
mockServer.verify(Duration.ofSeconds(10));
}
As default, 2 schedules will run in the same thread. So schedule1 executed first, then the testSchedule1 passed and testSchedule2 always failed.
2022-04-02 21:50:30.374 ERROR 2284 --- \[ scheduling-1\] o.s.s.s.TaskUtils$LoggingErrorHandler : Unexpected error occurred in scheduled task
org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:9090/api1": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:785) \~\[spring-web-5.3.18.jar:5.3.18\]
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:751) \~\[spring-web-5.3.18.jar:5.3.18\]
at org.springframework.web.client.RestTemplate.getForEntity(RestTemplate.java:377) \~\[spring-web-5.3.18.jar:5.3.18\]
at com.example.demo1.test.Test.schedule1(Test.java:18) \~\[classes/:na\]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) \~\[na:na\]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) \~\[na:na\]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) \~\[na:na\]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) \~\[na:na\]
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84) \~\[spring-context-5.3.18.jar:5.3.18\]
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) \~\[spring-context-5.3.18.jar:5.3.18\]
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) \~\[na:na\]
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) \~\[na:na\]
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) \~\[na:na\]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) \~\[na:na\]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) \~\[na:na\]
at java.base/java.lang.Thread.run(Thread.java:833) \~\[na:na\]
Caused by: java.net.ConnectException: Connection refused: connect
at java.base/sun.nio.ch.Net.connect0(Native Method) \~\[na:na\]
at java.base/sun.nio.ch.Net.connect(Net.java:579) \~\[na:na\]
at java.base/sun.nio.ch.Net.connect(Net.java:568) \~\[na:na\]
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:588) \~\[na:na\]
at java.base/java.net.Socket.connect(Socket.java:633) \~\[na:na\]
at java.base/java.net.Socket.connect(Socket.java:583) \~\[na:na\]
at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:183) \~\[na:na\]
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:498) \~\[na:na\]
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:603) \~\[na:na\]
at java.base/sun.net.www.http.HttpClient.\<init\>(HttpClient.java:246) \~\[na:na\]
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:351) \~\[na:na\]
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:373) \~\[na:na\]
at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1309) \~\[na:na\]
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1242) \~\[na:na\]
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1128) \~\[na:na\]
at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1057) \~\[na:na\]
at org.springframework.http.client.SimpleBufferingClientHttpRequest.executeInternal(SimpleBufferingClientHttpRequest.java:76) \~\[spring-web-5.3.18.jar:5.3.18\]
at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48) \~\[spring-web-5.3.18.jar:5.3.18\]
at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:66) \~\[spring-web-5.3.18.jar:5.3.18\]
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:776) \~\[spring-web-5.3.18.jar:5.3.18\]
... 15 common frames omitted
2022-04-02 21:50:30.376 ERROR 2284 --- \[ scheduling-1\] o.s.s.s.TaskUtils$LoggingErrorHandler : Unexpected error occurred in scheduled task
org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:9090/api2": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:785) \~\[spring-web-5.3.18.jar:5.3.18\]
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:751) \~\[spring-web-5.3.18.jar:5.3.18\]
at org.springframework.web.client.RestTemplate.getForEntity(RestTemplate.java:377) \~\[spring-web-5.3.18.jar:5.3.18\]
at com.example.demo1.test.Test.schedule2(Test.java:23) \~\[classes/:na\]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) \~\[na:na\]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) \~\[na:na\]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) \~\[na:na\]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) \~\[na:na\]
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84) \~\[spring-context-5.3.18.jar:5.3.18\]
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) \~\[spring-context-5.3.18.jar:5.3.18\]
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) \~\[na:na\]
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) \~\[na:na\]
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) \~\[na:na\]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) \~\[na:na\]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) \~\[na:na\]
at java.base/java.lang.Thread.run(Thread.java:833) \~\[na:na\]
Caused by: java.net.ConnectException: Connection refused: connect
at java.base/sun.nio.ch.Net.connect0(Native Method) \~\[na:na\]
at java.base/sun.nio.ch.Net.connect(Net.java:579) \~\[na:na\]
at java.base/sun.nio.ch.Net.connect(Net.java:568) \~\[na:na\]
at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:588) \~\[na:na\]
at java.base/java.net.Socket.connect(Socket.java:633) \~\[na:na\]
at java.base/java.net.Socket.connect(Socket.java:583) \~\[na:na\]
at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:183) \~\[na:na\]
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:498) \~\[na:na\]
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:603) \~\[na:na\]
at java.base/sun.net.www.http.HttpClient.\<init\>(HttpClient.java:246) \~\[na:na\]
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:351) \~\[na:na\]
at java.base/sun.net.www.http.HttpClient.New(HttpClient.java:373) \~\[na:na\]
at java.base/sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1309) \~\[na:na\]
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1242) \~\[na:na\]
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1128) \~\[na:na\]
at java.base/sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:1057) \~\[na:na\]
at org.springframework.http.client.SimpleBufferingClientHttpRequest.executeInternal(SimpleBufferingClientHttpRequest.java:76) \~\[spring-web-5.3.18.jar:5.3.18\]
at org.springframework.http.client.AbstractBufferingClientHttpRequest.executeInternal(AbstractBufferingClientHttpRequest.java:48) \~\[spring-web-5.3.18.jar:5.3.18\]
at org.springframework.http.client.AbstractClientHttpRequest.execute(AbstractClientHttpRequest.java:66) \~\[spring-web-5.3.18.jar:5.3.18\]
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:776) \~\[spring-web-5.3.18.jar:5.3.18\]
... 15 common frames omitted
2022-04-02 21:50:33.392 ERROR 2284 --- \[ scheduling-1\] o.s.s.s.TaskUtils$LoggingErrorHandler : Unexpected error occurred in scheduled task
java.lang.AssertionError: No further requests expected: HTTP GET http://localhost:9090/api1
0 request(s) executed.
at org.springframework.test.web.client.AbstractRequestExpectationManager.createUnexpectedRequestError(AbstractRequestExpectationManager.java:213) ~[spring-test-5.3.18.jar:5.3.18]
at org.springframework.test.web.client.UnorderedRequestExpectationManager.matchRequest(UnorderedRequestExpectationManager.java:44) ~[spring-test-5.3.18.jar:5.3.18]
at org.springframework.test.web.client.AbstractRequestExpectationManager.validateRequest(AbstractRequestExpectationManager.java:97) ~[spring-test-5.3.18.jar:5.3.18]
at org.springframework.test.web.client.MockRestServiceServer$MockClientHttpRequestFactory$1.executeInternal(MockRestServiceServer.java:338) ~[spring-test-5.3.18.jar:5.3.18]
at org.springframework.mock.http.client.MockClientHttpRequest.execute(MockClientHttpRequest.java:110) ~[spring-test-5.3.18.jar:5.3.18]
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:776) ~[spring-web-5.3.18.jar:5.3.18]
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:751) ~[spring-web-5.3.18.jar:5.3.18]
at org.springframework.web.client.RestTemplate.getForEntity(RestTemplate.java:377) ~[spring-web-5.3.18.jar:5.3.18]
at com.example.demo1.test.Test.schedule1(Test.java:18) ~[classes/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:568) ~[na:na]
at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:84) ~[spring-context-5.3.18.jar:5.3.18]
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54) ~[spring-context-5.3.18.jar:5.3.18]
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) ~[na:na]
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) ~[na:na]
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
After checked, I recognized If any schedule run first, the test case of that schedule will be passed.
I have checked the source code of MockRestServiceServer. It comes to AbstractRequestExpectationManager
in the verify method will call verifyInternal()
private int verifyInternal() {
if (this.expectations.isEmpty()) {
return 0;
}
if (!this.requestFailures.isEmpty()) {
throw new AssertionError("Some requests did not execute successfully.\n" +
this.requestFailures.entrySet().stream()
.map(entry -> "Failed request:\n" + entry.getKey() + "\n" + entry.getValue())
.collect(Collectors.joining("\n", "\n", "")));
}
int count = 0;
for (RequestExpectation expectation : this.expectations) {
if (!expectation.isSatisfied()) {
count++;
}
}
return count;
}
And the requestFailures is the map stores all failed requests (expected and unexpected)
#Override
public ClientHttpResponse validateRequest(ClientHttpRequest request) throws IOException {
RequestExpectation expectation;
synchronized (this.requests) {
if (this.requests.isEmpty()) {
afterExpectationsDeclared();
}
try {
// Try this first for backwards compatibility
ClientHttpResponse response = validateRequestInternal(request);
if (response != null) {
return response;
}
else {
expectation = matchRequest(request);
}
}
catch (Throwable ex) {
this.requestFailures.put(request, ex);
throw ex;
}
finally {
this.requests.add(request);
}
}
return expectation.createResponse(request);
}
If the schedule1 will be executed first, then it satisfied the condition: if (this.expectations.isEmpty()) first and the test case will be passed.
If the schedule1 executed after schedule1, the requestFailures will store the error of API 1, then it satisfied this condition: if (!this.requestFailures.isEmpty()) and the test case will be failed.
Is that MockRestServiceServer behavior? They want to mock all APIs?
If yes, please help me some alternative solution for my scenario.
Thanks
The stream:
stream create --name stocks --definition "http --port=9000 | gemfire-json-server --host=localhost --port=10334 --useLocator=true --regionName=Stocks --keyExpression=payload.getField('symbol')" --deploy
Then Post Data:
http post --target http://localhost:9000 --data {"symbol":"FAKE","price":73}
then it fail:
2016-12-14T09:51:20+0800 1.3.1.RELEASE ERROR pool-15-thread-4
http.NettyHttpInboundChannelAdapter - Error sending message
org.springframework.integration.transformer.MessageTransformationException:
Failed to transform Message; nested exception is
org.springframework.messaging.MessageHandlingException: nested
exception is com.gemstone.gemfire.pdx.JSONFormatterException: Could
not parse JSON document: [Source: {"symbol":"FAKE","price":73}; line:
1, column: 29] at
org.springframework.integration.transformer.MessageTransformingHandler.handleRequestMessage(MessageTransformingHandler.java:95)
~[spring-integration-core-4.2.5.RELEASE.jar:na] at
org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:99)
~[spring-integration-core-4.2.5.RELEASE.jar:na] at
org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
~[spring-integration-core-4.2.5.RELEASE.jar:na] ......
Caused by: org.springframework.messaging.MessageHandlingException:
nested exception is com.gemstone.gemfire.pdx.JSONFormatterException:
Could not parse JSON document: [Source: {"symbol":"FAKE","price":73};
line: 1, column: 29] at
org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:96)
~[spring-integration-core-4.2.5.RELEASE.jar:na] at
org.springframework.integration.transformer.AbstractMessageProcessingTransformer.transform(AbstractMessageProcessingTransformer.java:90)
~[spring-integration-core-4.2.5.RELEASE.jar:na] at
org.springframework.integration.transformer.MessageTransformingHandler.handleRequestMessage(MessageTransformingHandler.java:89)
~[spring-integration-core-4.2.5.RELEASE.jar:na] ... 51 common frames
omitted Caused by: com.gemstone.gemfire.pdx.JSONFormatterException:
Could not parse JSON document: [Source: {"symbol":"FAKE","price":73};
line: 1, column: 29] at
com.gemstone.gemfire.pdx.JSONFormatter.fromJSON(JSONFormatter.java:62)
~[na:na] at
org.springframework.integration.x.gemfire.JsonStringToObjectTransformer.toObject(JsonStringToObjectTransformer.java:37)
~[na:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method) ~[na:1.8.0_25] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
~[na:1.8.0_25] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:1.8.0_25] at java.lang.reflect.Method.invoke(Method.java:483)
~[na:1.8.0_25]
......
Caused by: com.gemstone.gemfire.cache.client.ServerOperationException:
java.lang.ClassNotFoundException:
org.apache.geode.pdx.PdxInitializationException at
com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.handleException(OpExecutorImpl.java:686)
~[na:na] at
com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.handleException(OpExecutorImpl.java:613)
~[na:na] at
com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:171)
~[na:na] at
com.gemstone.gemfire.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:115)
~[na:na] at
com.gemstone.gemfire.cache.client.internal.PoolImpl.execute(PoolImpl.java:696)
~[na:na] at
com.gemstone.gemfire.cache.client.internal.GetPDXIdForTypeOp.execute(GetPDXIdForTypeOp.java:34)
~[na:na] at
com.gemstone.gemfire.pdx.internal.ClientTypeRegistration.defineType(ClientTypeRegistration.java:56)
~[na:na] at
com.gemstone.gemfire.pdx.internal.TypeRegistry.defineType(TypeRegistry.java:179)
~[na:na] at
com.gemstone.gemfire.pdx.internal.TypeRegistry.defineLocalType(TypeRegistry.java:224)
~[na:na] at
com.gemstone.gemfire.pdx.internal.PdxWriterImpl.completeByteStreamGeneration(PdxWriterImpl.java:477)
~[na:na] at
com.gemstone.gemfire.pdx.internal.PdxInstanceFactoryImpl.create(PdxInstanceFactoryImpl.java:53)
~[na:na] at
com.gemstone.gemfire.pdx.internal.json.PdxInstanceHelper.endObjectField(PdxInstanceHelper.java:175)
~[na:na] at
com.gemstone.gemfire.pdx.JSONFormatter.getPdxInstance(JSONFormatter.java:152)
~[na:na] at
com.gemstone.gemfire.pdx.JSONFormatter.fromJSON(JSONFormatter.java:56)
~[na:na] ... 69 common frames omitted Caused by:
java.lang.ClassNotFoundException:
org.apache.geode.pdx.PdxInitializationException at
java.net.URLClassLoader$1.run(URLClassLoader.java:372) ~[na:1.8.0_25]
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
~[na:1.8.0_25] at java.security.AccessController.doPrivileged(Native
Method) ~[na:1.8.0_25] at
java.net.URLClassLoader.findClass(URLClassLoader.java:360)
~[na:1.8.0_25]
....
springxd Stream created successfully. I think whether i miss some libs? the reason it show the fail : Noclassfound. But i just download the package from the website and change nothing. so I don't know why. May someone can help me. Thanks.
Thanks Procrastinatus Maximus .
Hi everyone I find the problem was caused by the Geode version. The newest
package change the class path from "gemfire" to "geode".
so the problem comes.
what you should do is use the previous version:
I use the v1.0.0-incubating.M2.
Problem solved!
I am trying to load document in elastic search using PutElasticSearch , but getting below error when I see the bulletin board.
Cluster Name,ElasticSearch Hosts,Index and Type have been correctly configured.
2016-05-25 09:56:03,053 WARN [StandardProcessScheduler Thread-6] o.a.k.clients.producer.ProducerConfig The configuration partitioner.class = null was supplied but isn't a known config.
2016-05-25 09:56:03,053 INFO [StandardProcessScheduler Thread-7] o.a.n.c.s.TimerDrivenSchedulingAgent Scheduled PutKafka[id=78ae8c7e-7d95-45ad-a275-8004c451d622] to run with 1 threads
2016-05-25 09:56:03,418 INFO [Flow Service Tasks Thread-1] o.a.nifi.controller.StandardFlowService Saved flow controller org.apache.nifi.controller.FlowController#560b3337 // Another save pending = false
2016-05-25 09:56:05,276 INFO [pool-16-thread-1] o.a.n.c.r.WriteAheadFlowFileRepository Initiating checkpoint of FlowFile Repository
2016-05-25 09:56:05,418 INFO [pool-16-thread-1] org.wali.MinimalLockingWriteAheadLog org.wali.MinimalLockingWriteAheadLog#5f61338 checkpointed with 483 Records and 0 Swap Files in 141 milliseconds (Stop-the-world time = 28 milliseconds, Clear Edit Logs time = 32 millis), max Transaction ID 7360
2016-05-25 09:56:05,418 INFO [pool-16-thread-1] o.a.n.c.r.WriteAheadFlowFileRepository Successfully checkpointed FlowFile Repository with 483 records in 141 milliseconds
2016-05-25 09:56:07,406 DEBUG [StandardProcessScheduler Thread-5] o.a.n.p.elasticsearch.PutElasticsearch PutElasticsearch[id=0ba8a441-dcd9-4049-a11f-f04ee93b5d98] Creating ElasticSearch Client
2016-05-25 09:56:07,406 DEBUG [StandardProcessScheduler Thread-5] o.a.n.p.elasticsearch.PutElasticsearch PutElasticsearch[id=0ba8a441-dcd9-4049-a11f-f04ee93b5d98] No Shield plugin location specified, secure connections and/or authorization will not be available
2016-05-25 09:56:07,411 INFO [StandardProcessScheduler Thread-5] org.elasticsearch.plugins [General Orwell Taylor] loaded [], sites []
2016-05-25 09:56:07,412 ERROR [StandardProcessScheduler Thread-2] o.a.n.p.elasticsearch.PutElasticsearch PutElasticsearch[id=0ba8a441-dcd9-4049-a11f-f04ee93b5d98] PutElasticsearch[id=0ba8a441-dcd9-4049-a11f-f04ee93b5d98] failed to invoke #OnScheduled method due to java.lang.RuntimeException: Failed while executing one of processor's OnScheduled task.; processor will not be scheduled to run for 30000 milliseconds: java.lang.RuntimeException: Failed while executing one of processor's OnScheduled task.
2016-05-25 09:56:07,443 ERROR [StandardProcessScheduler Thread-5] org.apache.nifi.engine.FlowEngine A flow controller task execution stopped abnormally
java.util.concurrent.ExecutionException: java.lang.reflect.InvocationTargetException
at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:1.7.0_45]
at java.util.concurrent.FutureTask.get(FutureTask.java:188) ~[na:1.7.0_45]
at org.apache.nifi.engine.FlowEngine.afterExecute(FlowEngine.java:100) ~[na:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1153) [na:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_45]
at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_45]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_45]
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:137) ~[na:na]
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:125) ~[na:na]
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:70) ~[na:na]
at org.apache.nifi.controller.StandardProcessorNode$1$1.call(StandardProcessorNode.java:1247) ~[na:na]
at org.apache.nifi.controller.StandardProcessorNode$1$1.call(StandardProcessorNode.java:1243) ~[na:na]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) ~[na:1.7.0_45]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) ~[na:1.7.0_45]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) ~[na:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_45]
... 2 common frames omitted
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.threadpool.ThreadPool
at org.elasticsearch.client.transport.TransportClient$Builder.build(TransportClient.java:130) ~[na:na]
at org.apache.nifi.processors.elasticsearch.AbstractElasticsearchProcessor.getTransportClient(AbstractElasticsearchProcessor.java:292) ~[na:na]
at org.apache.nifi.processors.elasticsearch.AbstractElasticsearchProcessor.createElasticsearchClient(AbstractElasticsearchProcessor.java:226) ~[na:na]
at org.apache.nifi.processors.elasticsearch.AbstractElasticsearchProcessor.setup(AbstractElasticsearchProcessor.java:172) ~[na:na]
at org.apache.nifi.processors.elasticsearch.PutElasticsearch.setup(PutElasticsearch.java:143) ~[na:na]
... 15 common frames omitted
2016-05-25 09:56:07,446 INFO [Flow Service Tasks Thread-1] o.a.nifi.controller.StandardFlowService Saved flow controller org.apache.nifi.controller.FlowController#560b3337 // Another save pending = false
2016-05-25 09:56:07,449 ERROR [StandardProcessScheduler Thread-2] o.a.n.p.elasticsearch.PutElasticsearch
java.lang.RuntimeException: Failed while executing one of processor's OnScheduled task.
at org.apache.nifi.controller.StandardProcessorNode.invokeTaskAsCancelableFuture(StandardProcessorNode.java:1405) ~[na:na]
at org.apache.nifi.controller.StandardProcessorNode.access$100(StandardProcessorNode.java:89) ~[na:na]
at org.apache.nifi.controller.StandardProcessorNode$1.run(StandardProcessorNode.java:1243) ~[na:na]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_45]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_45]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_45]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) [na:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_45]
at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]
Caused by: java.util.concurrent.ExecutionException: java.lang.reflect.InvocationTargetException
at java.util.concurrent.FutureTask.report(FutureTask.java:122) [na:1.7.0_45]
at java.util.concurrent.FutureTask.get(FutureTask.java:202) [na:1.7.0_45]
at org.apache.nifi.controller.StandardProcessorNode.invokeTaskAsCancelableFuture(StandardProcessorNode.java:1388) ~[na:na]
... 9 common frames omitted
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_45]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_45]
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:137) ~[na:na]
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:125) ~[na:na]
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:70) ~[na:na]
at org.apache.nifi.controller.StandardProcessorNode$1$1.call(StandardProcessorNode.java:1247) ~[na:na]
at org.apache.nifi.controller.StandardProcessorNode$1$1.call(StandardProcessorNode.java:1243) ~[na:na]
... 6 common frames omitted
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.threadpool.ThreadPool
at org.elasticsearch.client.transport.TransportClient$Builder.build(TransportClient.java:130) ~[na:na]
at org.apache.nifi.processors.elasticsearch.AbstractElasticsearchProcessor.getTransportClient(AbstractElasticsearchProcessor.java:292) ~[na:na]
at org.apache.nifi.processors.elasticsearch.AbstractElasticsearchProcessor.createElasticsearchClient(AbstractElasticsearchProcessor.java:226) ~[na:na]
at org.apache.nifi.processors.elasticsearch.AbstractElasticsearchProcessor.setup(AbstractElasticsearchProcessor.java:172) ~[na:na]
at org.apache.nifi.processors.elasticsearch.PutElasticsearch.setup(PutElasticsearch.java:143) ~[na:na]
... 15 common frames omitted
2016-05-25 09:56:07,456 ERROR [StandardProcessScheduler Thread-2] o.a.n.controller.StandardProcessorNode Failed to invoke #OnScheduled method due to java.lang.RuntimeException: Failed while executing one of processor's OnScheduled task.
java.lang.RuntimeException: Failed while executing one of processor's OnScheduled task.
at org.apache.nifi.controller.StandardProcessorNode.invokeTaskAsCancelableFuture(StandardProcessorNode.java:1405) ~[na:na]
at org.apache.nifi.controller.StandardProcessorNode.access$100(StandardProcessorNode.java:89) ~[na:na]
at org.apache.nifi.controller.StandardProcessorNode$1.run(StandardProcessorNode.java:1243) ~[na:na]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_45]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_45]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_45]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) [na:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_45]
at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]
Caused by: java.util.concurrent.ExecutionException: java.lang.reflect.InvocationTargetException
at java.util.concurrent.FutureTask.report(FutureTask.java:122) [na:1.7.0_45]
at java.util.concurrent.FutureTask.get(FutureTask.java:202) [na:1.7.0_45]
at org.apache.nifi.controller.StandardProcessorNode.invokeTaskAsCancelableFuture(StandardProcessorNode.java:1388) ~[na:na]
... 9 common frames omitted
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_45]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_45]
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:137) ~[na:na]
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:125) ~[na:na]
at org.apache.nifi.util.ReflectionUtils.invokeMethodsWithAnnotations(ReflectionUtils.java:70) ~[na:na]
at org.apache.nifi.controller.StandardProcessorNode$1$1.call(StandardProcessorNode.java:1247) ~[na:na]
at org.apache.nifi.controller.StandardProcessorNode$1$1.call(StandardProcessorNode.java:1243) ~[na:na]
... 6 common frames omitted
Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.elasticsearch.threadpool.ThreadPool
at org.elasticsearch.client.transport.TransportClient$Builder.build(TransportClient.java:130) ~[na:na]
at org.apache.nifi.processors.elasticsearch.AbstractElasticsearchProcessor.getTransportClient(AbstractElasticsearchProcessor.java:292) ~[na:na]
at org.apache.nifi.processors.elasticsearch.AbstractElasticsearchProcessor.createElasticsearchClient(AbstractElasticsearchProcessor.java:226) ~[na:na]
at org.apache.nifi.processors.elasticsearch.AbstractElasticsearchProcessor.setup(AbstractElasticsearchProcessor.java:172) ~[na:na]
at org.apache.nifi.processors.elasticsearch.PutElasticsearch.setup(PutElasticsearch.java:143) ~[na:na]
... 15 common frames omitted
Dear friends I am able to configure Presto with Hive.
I can see results for "SHOW TABLES". I can see "books" table in results.
Also DESCRIBE books showing all column details.
I do have a "books" table - able to query through hive and see results.
Ex: hive>select * from books;
but when I try through presto. I am getting following error
please guide me
Error
presto:default> select * from books;
Query 20131121_025845_00004_qqe25, FAILED, 1 node
Splits: 1 total, 0 done (0.00%)
0:00 [0 rows, 0B] [0 rows/s, 0B/s]
Query 20131121_025845_00004_qqe25 failed: java.io.IOException: Failed on local exception: java.io.IOException: Broken pipe; Host Details : local host is: "ubuntu/192.168.56.101"; destination host is: "localhost":54310;
presto:default>
exception on server
45_00004_qqe25.1
java.lang.RuntimeException: java.io.IOException: Failed on local exception: java.io.IOException: Broken pipe; Host Details : local host is: "ubuntu/192.168.56.101"; destination host is: "localhost":54310;
at com.google.common.base.Throwables.propagate(Throwables.java:160) ~[guava-15.0.jar:na]
at com.facebook.presto.hive.HiveSplitIterable$HiveSplitQueue.computeNext(HiveSplitIterable.java:433) ~[na:na]
at com.facebook.presto.hive.HiveSplitIterable$HiveSplitQueue.computeNext(HiveSplitIterable.java:392) ~[na:na]
at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143) ~[guava-15.0.jar:na]
at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:138) ~[guava-15.0.jar:na]
at com.facebook.presto.execution.SqlStageExecution.startTasks(SqlStageExecution.java:463) [presto-main-0.52.jar:0.52]
at com.facebook.presto.execution.SqlStageExecution.access$300(SqlStageExecution.java:80) [presto-main-0.52.jar:0.52]
at com.facebook.presto.execution.SqlStageExecution$5.run(SqlStageExecution.java:435) [presto-main-0.52.jar:0.52]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_45]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_45]
at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]
Caused by: java.io.IOException: Failed on local exception: java.io.IOException: Broken pipe; Host Details : local host is: "ubuntu/192.168.56.101"; destination host is: "localhost":54310;
at org.apache.hadoop.net.NetUtils.wrapException(NetUtils.java:763) ~[na:na]
at org.apache.hadoop.ipc.Client.call(Client.java:1229) ~[na:na]
at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:202) ~[na:na]
at com.sun.proxy.$Proxy155.getListing(Unknown Source) ~[na:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_45]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_45]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_45]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_45]
at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:164) ~[na:na]
at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:83) ~[na:na]
at com.sun.proxy.$Proxy155.getListing(Unknown Source) ~[na:na]
at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.getListing(ClientNamenodeProtocolTranslatorPB.java:441) ~[na:na]
at org.apache.hadoop.hdfs.DFSClient.listPaths(DFSClient.java:1526) ~[na:na]
at org.apache.hadoop.hdfs.DFSClient.listPaths(DFSClient.java:1509) ~[na:na]
at org.apache.hadoop.hdfs.DistributedFileSystem.listStatus(DistributedFileSystem.java:406) ~[na:na]
at org.apache.hadoop.fs.FileSystem.listStatus(FileSystem.java:1462) ~[na:na]
at org.apache.hadoop.fs.FileSystem.listStatus(FileSystem.java:1502) ~[na:na]
at com.facebook.presto.hive.ForwardingFileSystem.listStatus(ForwardingFileSystem.java:298) ~[na:na]
at com.facebook.presto.hive.ForwardingFileSystem.listStatus(ForwardingFileSystem.java:298) ~[na:na]
at com.facebook.presto.hive.FileSystemWrapper$3.listStatus(FileSystemWrapper.java:146) ~[na:na]
at org.apache.hadoop.fs.FileSystem$4.<init>(FileSystem.java:1778) ~[na:na]
at org.apache.hadoop.fs.FileSystem.listLocatedStatus(FileSystem.java:1777) ~[na:na]
at org.apache.hadoop.fs.FileSystem.listLocatedStatus(FileSystem.java:1760) ~[na:na]
at com.facebook.presto.hive.util.AsyncRecursiveWalker$1.run(AsyncRecursiveWalker.java:58) ~[na:na]
at com.facebook.presto.hive.util.SuspendingExecutor$1.run(SuspendingExecutor.java:67) ~[na:na]
at com.facebook.presto.hive.util.BoundedExecutor.executeOrMerge(BoundedExecutor.java:82) ~[na:na]
at com.facebook.presto.hive.util.BoundedExecutor.access$000(BoundedExecutor.java:41) ~[na:na]
at com.facebook.presto.hive.util.BoundedExecutor$1.run(BoundedExecutor.java:53) ~[na:na]
... 3 common frames omitted
Caused by: java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcherImpl.write0(Native Method) ~[na:1.7.0_45]
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47) ~[na:1.7.0_45]
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) ~[na:1.7.0_45]
at sun.nio.ch.IOUtil.write(IOUtil.java:65) ~[na:1.7.0_45]
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:487) ~[na:1.7.0_45]
at org.apache.hadoop.net.SocketOutputStream$Writer.performIO(SocketOutputStream.java:62) ~[na:na]
at org.apache.hadoop.net.SocketIOWithTimeout.doIO(SocketIOWithTimeout.java:143) ~[na:na]
at org.apache.hadoop.net.SocketOutputStream.write(SocketOutputStream.java:153) ~[na:na]
at org.apache.hadoop.net.SocketOutputStream.write(SocketOutputStream.java:114) ~[na:na]
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82) ~[na:1.7.0_45]
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140) ~[na:1.7.0_45]
at java.io.DataOutputStream.flush(DataOutputStream.java:123) ~[na:1.7.0_45]
at org.apache.hadoop.ipc.Client$Connection$3.run(Client.java:897) ~[na:na]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_45]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_45]
... 3 common frames omitted
2013-11-20T21:58:45.915-0500 DEBUG task-notification-1 com.facebook.presto.execution.TaskStateMachine Task 20131121_025845_00004_qqe25.0.0 is CANCELED
I got some answers from google group
https://groups.google.com/forum/#!topic/presto-users/lVLvMGP1sKE
Dain Sundstrom
Nov 8
That is an error from within the HDFS client (org.apache.hadoop.ipc.Client:941 in my code) and after a quick review of that code, it looks like this mean the client could not parse the server response. My guess is the client we bundle with the presto-hive-cdh4 plugin is not compatible with your version of Hadoop. This code includes Cloudera Hadoop version 2.0.0-cdh4.3.0. What version are you using?