Timeout Error PubSubHealthIndicator on springboot app - java

I'm working in a project which will use PUB/SUB. When I trying to start my springboot App, I received a TimeoutException as shown below.
Caused by: org.springframework.beans.factory.BeanInitializationException: Validation of health indicator failed; nested exception is java.util.concurrent.TimeoutException
at com.google.cloud.spring.autoconfigure.pubsub.health.PubSubHealthIndicator.validationFailed(PubSubHealthIndicator.java:169)
at com.google.cloud.spring.autoconfigure.pubsub.health.PubSubHealthIndicator.doHealthCheck(PubSubHealthIndicator.java:139)
at com.google.cloud.spring.autoconfigure.pubsub.health.PubSubHealthIndicator.validateHealthCheck(PubSubHealthIndicator.java:106)
at com.google.cloud.spring.autoconfigure.pubsub.health.PubSubHealthIndicatorAutoConfiguration.createIndicator(PubSubHealthIndicatorAutoConfiguration.java:79)
at com.google.cloud.spring.autoconfigure.pubsub.health.PubSubHealthIndicatorAutoConfiguration.createIndicator(PubSubHealthIndicatorAutoConfiguration.java:49)
at org.springframework.boot.actuate.autoconfigure.health.AbstractCompositeHealthContributorConfiguration.createContributor(AbstractCompositeHealthContributorConfiguration.java:54)
at com.google.cloud.spring.autoconfigure.pubsub.health.PubSubHealthIndicatorAutoConfiguration.pubSubHealthContributor(PubSubHealthIndicatorAutoConfiguration.java:69)
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.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 20 common frames omitted
Caused by: java.util.concurrent.TimeoutException: null
at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:204)
at org.springframework.util.concurrent.SettableListenableFuture.get(SettableListenableFuture.java:134)
at com.google.cloud.spring.autoconfigure.pubsub.health.PubSubHealthIndicator.pullMessage(PubSubHealthIndicator.java:148)
at com.google.cloud.spring.autoconfigure.pubsub.health.PubSubHealthIndicator.doHealthCheck(PubSubHealthIndicator.java:122)
... 30 common frames omitted
I'm using Google SDK to set my credentials and project. As well as my application.yml:
gcp:
project-id: ${PROJECT_ID}
pubsub:
topics:
quotesOutputChannel: projects/${PROJECT_ID}/topics/my-topic
subscriptions:
quotesInputChannel: projects/${PROJECT_ID}/subscriptions/my-sub
It happens when I start springboot app.
How can I solve this? I've tried to set pub sub health false on my application.yml and it didn't work as well.

Related

createEJBContainer throws java.lang.IllegalStateException

on a Linux machine the container runs inside an exception which I don't understand.
With ejbContainer = EJBContainer.createEJBContainer(); the embaddable container will be started.
In the log file I see an exception:
Caused by: org.apache.webbeans.exception.WebBeansException: java.lang.IllegalStateException: Could not find beans for Type=class org.apache.deltaspike.core.impl.scope.window.WindowBeanHolder and qualifiers:[]
at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:377)
at org.apache.webbeans.event.NotificationManager.invokeObserverMethod(NotificationManager.java:1146)
at org.apache.webbeans.event.NotificationManager.doFireSync(NotificationManager.java:1009)
... 84 common frames omitted
Caused by: java.lang.IllegalStateException: Could not find beans for Type=class org.apache.deltaspike.core.impl.scope.window.WindowBeanHolder and qualifiers:[]
at org.apache.deltaspike.core.api.provider.BeanProvider.getContextualReference(BeanProvider.java:154)
at org.apache.deltaspike.core.impl.scope.DeltaSpikeContextExtension.initializeDeltaSpikeContexts(DeltaSpikeContextExtension.java:86)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.apache.webbeans.event.ObserverMethodImpl.invoke(ObserverMethodImpl.java:410)
at org.apache.webbeans.event.ContainerEventObserverMethodImpl.invoke(ContainerEventObserverMethodImpl.java:86)
at org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:371)
... 86 common frames omitted
ERROR javax.enterprise.inject.spi.DeploymentException: couldn't start owb context
Honestly I have no idea what's going on.
Before I found this line:
System.setProperty("openejb.deployments.classpath.include",
".*deltaspike-cdictrl-owb-.*.jar|.*deltaspike-servlet-module-impl-.*.jar|.*deltaspike-servlet-module-api-.*.jar|.*deltaspike-core-api-.*.jar|.*deltaspike-core-impl-.*.jar");
Does anybody have an idea how I can fix this issue?
Thanks,
Markus
One of my colleagues was able to find out the reason.
The regex expression seems to be different between Tomee 7.1.4 and Tomee 8.0.13.
This regex find the libs and solves the probelem.
System.setProperty("openejb.deployments.classpath.include",".*deltaspike.*");

cannot start cas-overlay-template on windows - missing \etc\cas\thekeystore

I am trying to run https://github.com/apereo/cas-overlay-template on Windows 11 and JDK 11 (Eclipse Adoptium 11.0.16.1), using the 6.5 branch. I have ran the "createKeystore" and "copyCasConfiguration" gradle tasks using gradlew.bat, and it created the files below:
c:/etc/cas/cas.crt
c:/etc/cas/thekeystore
c:/etc/cas/config/cas.properties
c:/etc/cas/config/log4j2.xml
when I tried to run "gradlew.bat run", it hit the following error:
2022-08-22 20:26:06,670 WARN [org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext] - <Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: FaException 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: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.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.WarLauncher.main(WarLauncher.java:59)
Caused by: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181)
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54)
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356)
at java.base/java.lang.Iterable.forEach(Iterable.java:75)
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155)
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:732)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:414)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:302)
at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:164)
at org.apereo.cas.web.CasWebApplication.main(CasWebApplication.java:62)
... 8 more
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:229)
at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:43)
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178)
... 21 more
Caused by: java.lang.IllegalArgumentException: standardService.connector.startFailed
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:238)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:282)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:213)
... 23 more
Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1077)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:234)
... 25 more
Caused by: java.lang.IllegalArgumentException: \etc\cas\thekeystore (The system cannot find the path specified)
at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:107)
at org.apache.tomcat.util.net.AbstractJsseEndpoint.initialiseSsl(AbstractJsseEndpoint.java:71)
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:235)
at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1227)
at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1313)
at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:614)
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1074)
... 27 more
Caused by: java.io.FileNotFoundException: \etc\cas\thekeystore (The system cannot find the path specified)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
at java.base/java.io.FileInputStream.<init>(FileInputStream.java:112)
at java.base/sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:86)
at java.base/sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:184)
at org.apache.catalina.startup.CatalinaBaseConfigurationSource.getResource(CatalinaBaseConfigurationSource.java:118)
at org.apache.tomcat.util.net.SSLUtilBase.getStore(SSLUtilBase.java:199)
at org.apache.tomcat.util.net.SSLHostConfigCertificate.getCertificateKeystore(SSLHostConfigCertificate.java:207)
at org.apache.tomcat.util.net.SSLUtilBase.getKeyManagers(SSLUtilBase.java:283)
at org.apache.tomcat.util.net.SSLUtilBase.createSSLContext(SSLUtilBase.java:247)
at org.apache.tomcat.util.net.AbstractJsseEndpoint.createSSLContext(AbstractJsseEndpoint.java:105)
... 33 more
I believe this is due to Gradle thinking its running inside a Unix environment instead of a Windows one. Any changes I make to the c:/etc/cas/config/cas.properties file is ignored, which makes me believe that its looking elsewhere for the cas folder (not c:/etc/cas). Anyone got any ideas?
You can change the keystore location in spring config. You can pass the property either in cas.properties or with command line flags or ENV. Two examples:
Example: absolute windwos path
server.ssl.key-store=D:/dev/cas/etc/theKeystore.jks
Example: relative path
server.ssl.key-store=file:etc/cas/thekeystore
By the way, you can also change the location of the cas.properties file with the cas.standalone.configurationDirectory parameter. This is how I usually work in a local environment on Windows:
java -jar build/libs/cas.war --cas.standalone.configurationDirectory=etc/cas/config --debug
Anyone got any ideas?
Please read:
https://apereo.github.io/cas/6.5.x/installation/Troubleshooting-Guide.html#review-logs
CAS server logs are the best resource for determining the root cause of the problem, provided you have configured the appropriate log levels. Specifically you want to make sure DEBUG levels are turned on the org.apereo package in the log configuration
You could consider moving the configuration inside the CAS build itself in an application.yml file, instead of keeping it outside.
https://apereo.github.io/cas/6.5.x/configuration/Configuration-Server-Management-Standalone.html
Try switching from tomcat to jetty as an embedded servlet server. It seems to have better windows support, and properly looks for c:\etc\cas\thekeystore.
To do that just replace -tomcat with -jetty as appServer in the gradle.properties file.
There might be a way to teach tomcat to look at the right place, but I didn't found it. The server.ssl.key-store setting didn't had any effect.

Unable to start Netty in spring boot 2.5.13

I have a spring boot application based on reactor but it can't be launched on Window 10 although it works fine on Linux. It failed to start Netty. This application uses spring boot 2.5.13 now. This issue doesn't exist for the old spring boot 2.3.
The exception was thrown by reactor.core.publisher.BlockingSingleSubscriber.blockingGet.
Is there any config change that could fix this problem? So far, it looks to me like that this problem came from the reactor library and I can't fix by any config change.
Here is the exception stack.
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start Netty
at org.springframework.boot.web.embedded.netty.NettyWebServer.start(NettyWebServer.java:108)
at org.springframework.boot.web.reactive.context.WebServerManager.start(WebServerManager.java:55)
at org.springframework.boot.web.reactive.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:40)
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178)
... 14 common frames omitted
Caused by: reactor.core.Exceptions$ReactiveException: java.lang.InterruptedException
at reactor.core.Exceptions.propagate(Exceptions.java:392)
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:128)
at reactor.core.publisher.Mono.block(Mono.java:1731)
at reactor.netty.transport.ServerTransport.bindNow(ServerTransport.java:145)
at reactor.netty.transport.ServerTransport.bindNow(ServerTransport.java:130)
at org.springframework.boot.web.embedded.netty.NettyWebServer.startHttpServer(NettyWebServer.java:145)
at org.springframework.boot.web.embedded.netty.NettyWebServer.start(NettyWebServer.java:100)
... 17 common frames omitted
Suppressed: java.lang.Exception: #block has been interrupted
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:130)
... 22 common frames omitted
Caused by: java.lang.InterruptedException: null
at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.tryAcquireSharedNanos(AbstractQueuedSynchronizer.java:1367)
at java.base/java.util.concurrent.CountDownLatch.await(CountDownLatch.java:278)
at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:121)
... 22 common frames omitted

Spring boot Jobrunr no servers available error

Hi im trying to use jobrunr to enqueue a simple method and see that at dashboard but when i run my app it throws this exception
org.jobrunr.JobRunrException: JobRunr encountered a problematic exception. Please create a bug report (if possible, provide the code to reproduce this and the stacktrace)
at org.jobrunr.JobRunrException.shouldNotHappenException(JobRunrException.java:33)
at org.jobrunr.server.ServerZooKeeper.lambda$determineIfBackgroundJobServerIsMaster$0(ServerZooKeeper.java:99)
at java.base/java.util.Optional.orElseThrow(Optional.java:408)
at org.jobrunr.server.ServerZooKeeper.determineIfBackgroundJobServerIsMaster(ServerZooKeeper.java:99)
at org.jobrunr.server.ServerZooKeeper.announceBackgroundJobServer(ServerZooKeeper.java:66)
at org.jobrunr.server.ServerZooKeeper.run(ServerZooKeeper.java:41)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalStateException: No servers available?!
... 12 common frames omitted
i did my configs at application.dev but its still giving same error
org:
jobrunr:
background-job-server:
enabled: true
dashboard:
enabled: true
If your DataSource has autoCommit set to false, this issue has been fixed in https://github.com/jobrunr/jobrunr/pull/129 .
Please wait for next release (v2.0.2?), or set your dataSource.autoCommit to true as of now.

What elements am I missing to ensure mailR Integration with Java via data server runs smoothly?

java.lang.NoClassDefFoundError: javax/activation/DataHandler
at org.apache.commons.mail.Email.createMimeMessage(Email.java:1832)
at org.apache.commons.mail.Email.buildMimeMessage(Email.java:1268)
at org.apache.commons.mail.Email.send(Email.java:1436)
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 RJavaTools.invokeMethod(RJavaTools.java:386)
Caused by: java.lang.ClassNotFoundException
at RJavaClassLoader.findClass(RJavaClassLoader.java:383)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 8 more
NULL
Error: NoClassDefFoundError (Java): javax/activation/DataHandler
Is my current error message, I found this question asked prior here: https://github.com/rpremraj/mailR/issues/77
But do not understand how to implement the suggested fix from the comments.
Any help much appreciated

Categories