Unable to start Netty in spring boot 2.5.13 - java

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

Related

NoClassDefFoundError jakarta/servlet/http/HttpSessionContext after upgrade to spring boot 3

In my gradle base project I'm trying upgrade spring dependency from 2.7.6 to 3.0.1,
However I face issue NoClassDefFoundError: jakarta/servlet/http/HttpSessionContext
Caused by: java.lang.NoClassDefFoundError: jakarta/servlet/http/HttpSessionContext
at org.eclipse.jetty.servlet.ServletContextHandler.newSessionHandler(ServletContextHandler.java:339)
at org.eclipse.jetty.servlet.ServletContextHandler.getSessionHandler(ServletContextHandler.java:432)
at org.eclipse.jetty.servlet.ServletContextHandler.relinkHandlers(ServletContextHandler.java:257)
at org.eclipse.jetty.servlet.ServletContextHandler.<init>(ServletContextHandler.java:180)
at org.eclipse.jetty.webapp.WebAppContext.<init>(WebAppContext.java:301)
at org.eclipse.jetty.webapp.WebAppContext.<init>(WebAppContext.java:228)
at org.springframework.boot.web.embedded.jetty.JettyEmbeddedWebAppContext.<init>(JettyEmbeddedWebAppContext.java:28)
at org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory.getWebServer(JettyServletWebServerFactory.java:158)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:183)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:161)
... 9 common frames omitted
Caused by: java.lang.ClassNotFoundException: jakarta.servlet.http.HttpSessionContext
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
... 19 common frames omitted
As I understand spring boot 3.0 use Servlet Api 6.0 which is not supported by Jetty and it requires downgrade Servlet API to 5.0.0
(https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-3.0-Migration-Guide#jetty)
To solve this issue, you need to add to your gradle.build script
ext['jakarta-servlet.version'] = '5.0.0'

Timeout Error PubSubHealthIndicator on springboot app

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.

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.*");

Neo4j not starts

I'm trying to run Neo4j database with java but it gives me the following error :
java.lang.RuntimeException: Error starting org.neo4j.kernel.EmbeddedGraphDatabase, /home/matteo/neo4j-community-2.2.2/data/graph.db
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:334)
at org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:59)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newDatabase(GraphDatabaseFactory.java:108)
at org.neo4j.graphdb.factory.GraphDatabaseFactory$1.newDatabase(GraphDatabaseFactory.java:95)
at org.neo4j.graphdb.factory.GraphDatabaseBuilder.newGraphDatabase(GraphDatabaseBuilder.java:176)
at org.neo4j.graphdb.factory.GraphDatabaseFactory.newEmbeddedDatabase(GraphDatabaseFactory.java:67)
at Getter.main(Getter.java:46)
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.kernel.extension.KernelExtensions#2e9a2123' failed to initialize. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:489)
at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:72)
at org.neo4j.kernel.lifecycle.LifeSupport.start(LifeSupport.java:106)
at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:330)
... 6 more
Caused by: org.neo4j.kernel.lifecycle.LifecycleException: Component 'org.neo4j.index.lucene.LuceneKernelExtension#1c3c1d18' failed to initialize. Please see attached cause exception.
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:489)
at org.neo4j.kernel.lifecycle.LifeSupport.init(LifeSupport.java:72)
at org.neo4j.kernel.extension.KernelExtensions.init(KernelExtensions.java:74)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:483)
... 9 more
Caused by: java.lang.NoSuchFieldError: LUCENE_36
at org.neo4j.index.impl.lucene.LuceneDataSource.<clinit>(LuceneDataSource.java:88)
at org.neo4j.index.lucene.LuceneKernelExtension.init(LuceneKernelExtension.java:52)
at org.neo4j.kernel.lifecycle.LifeSupport$LifecycleInstance.init(LifeSupport.java:483)
... 12 more
Where is the problem??
Thank you very much!
Matteo
Since you're running embedded Neo4j this looks like you're missing lucene-core-3.6.2.jar on your classpath.
Best practice is to use a build system supporting transitive dependencies like gradle or maven. For those the most easy this is have a dependency on neo4j-community artifact, e.g. http://mvnrepository.com/artifact/org.neo4j/neo4j/2.2.5. This will pull in all other required jars.

memcached error after switching from Java 1.6 to Java 1.7

MemcacheD was working fine until we recently switched over to Java 7 from Java 6. Now we keep getting exceptions such as the following:
java.lang.RuntimeException: Exception waiting for value
at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1025)
at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1042)
...
...
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: Cancelled
at net.spy.memcached.internal.OperationFuture.get(OperationFuture.java:169)
at net.spy.memcached.internal.GetFuture.get(GetFuture.java:62)
at net.spy.memcached.MemcachedClient.get(MemcachedClient.java:1021)
and this
java.lang.RuntimeException: Failed waiting for store
at net.spy.memcached.MemcachedClient.mutateWithDefault(MemcachedClient.java:1696)
at net.spy.memcached.MemcachedClient.incr(MemcachedClient.java:1806)
...
...
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: Cancelled
at net.spy.memcached.internal.OperationFuture.get(OperationFuture.java:169)
at net.spy.memcached.MemcachedClient.mutateWithDefault(MemcachedClient.java:1687)
... 75 more
thank you are helping!

Categories