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'
Related
I have code (Spark job) that runs on EMR 6.7.0 - which runs fine. Locally the dependencies are a mess.
When trying to run locally, I'm getting:
java.lang.NoClassDefFoundError: org/apache/hadoop/hive/metastore/api/UnknownDBException
...
Caused by: java.lang.ClassNotFoundException: org.apache.hadoop.hive.metastore.api.UnknownDBException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
So I figured I need to add the dependency hive-metastore, but version 3.1.2 since this is the Hive version I see in the EMR 6.5.0 release notes.
Unfortunately I don't see this class in the hive-metastore 3.1.3 version.
Am I missing something? I'm sure there are problems with the local dependencies that contradict some other dependencies, but overall when adding the hive-metastore 3.1.3 jar - the required classes aren't there.
I'm switching my log4j config from PatternLayout to JasonLayout. After the change, I started having the following error:
ERROR Could not create plugin of type class org.apache.logging.log4j.core.layout.JsonLayout for element JsonLayout: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ser/FilterProvider java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ser/FilterProvider
at org.apache.logging.log4j.core.layout.JsonLayout.<init>(JsonLayout.java:159)
at org.apache.logging.log4j.core.layout.JsonLayout.<init>(JsonLayout.java:71)
at org.apache.logging.log4j.core.layout.JsonLayout$Builder.build(JsonLayout.java:103)
at org.apache.logging.log4j.core.layout.JsonLayout$Builder.build(JsonLayout.java:79)
at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:124)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:1138)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1063)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1055)
at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:1055)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:664)
at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:258)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:304)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:621)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:694)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:711)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:253)
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.logging.log4j.LogManager.getLogger(LogManager.java:599)
at de.ic_consult.planetarium.listener.ListenerEmbedded.<clinit>(ListenerEmbedded.java:49)
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ser.FilterProvider
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)
... 21 more
This class comes from jackson-databind, which in my case, is version 2.13.1, that comes as dependency from log4j 2.17.2.
I'm using gradle to manage the dependencies, and the log4j dependency comes from an internal framework, in which I saw that log4j is loaded as:
implementation('org.apache.logging.log4j:log4j-api')
runtimeOnly('org.apache.logging.log4j:log4j-core')
runtimeOnly('org.apache.logging.log4j:log4j-jcl')
Could it be that the fact that I'm loading log4j-core and logj4-jcl as runtimeOnly is causing this problem?
jackson-databind is an optional dependency of log4j-core. Basically it means that if you want to include it, you'll have to declare it explicitly as dependency on your project (cf. Maven optional dependencies).
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
I am trying to fetch some data from Google Analytics using Google Analytics reporting v4 API.
I am using maven so included all the 9 modules in maven dependency.
However while running the sample java code from https://developers.google.com/analytics/devguides/reporting/core/v4/quickstart/service-java
I am getting NoClassDefFoundError. On debugging further the actual line which was failing is
Utils.getDefaultJsonFactory();
Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/json/async/NonBlockingJsonParser
at com.google.api.client.json.jackson2.JacksonFactory.<init>(JacksonFactory.java:41)
at com.google.api.client.googleapis.util.Utils$JsonFactoryInstanceHolder.<clinit>(Utils.java:44)
at com.google.api.client.googleapis.util.Utils.getDefaultJsonFactory(Utils.java:36)
at com.google.api.client.googleapis.auth.oauth2.GoogleCredential.fromStream(GoogleCredential.java:232)
at com.dropbox.aem.common.services.GoogleAnalyticsReporting.initializeAnalyticsReporting(GoogleAnalyticsReporting.java:58)
at com.dropbox.aem.common.services.GoogleAnalyticsReporting.main(GoogleAnalyticsReporting.java:38)
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.core.json.async.NonBlockingJsonParser
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:355)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 6 more
You are missing Jackson core. From here
https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
Currently I am working on Grails application and update the Grail version that compatible with JDK8.
Configuration:
JDK 8u31
Grails 2.3.11
Maven 3.2.1
Liberty 17.0.0.2
My application is maven based. Everything is working fine on local, but when I deployed it in liberty server. I am getting below error.
Error Page Exception com.ibm.ws.webcontainer.webapp.WebAppErrorReport:
javax.servlet.ServletException: Filter [grailsWebRequest]: could not
be initialized at
com.ibm.ws.webcontainer.webapp.WebApp.sendError(WebApp.java:4326) at
com.ibm.ws.webcontainer.webapp.WebApp.handleException(WebApp.java:5058)
at
com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:5038)
at
com.ibm.ws.webcontainer31.osgi.webapp.WebApp31.handleRequest(WebApp31.java:528)
at
com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.handleRequest(DynamicVirtualHost.java:315)
at
com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1025)
at
com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:280)
at
com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:967)
at
com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.wrapHandlerAndExecute(HttpDispatcherLink.java:359)
at
com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:318)
at
com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:471)
at
com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:405)
at
com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:285)
at
com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:256)
at
com.ibm.ws.channel.ssl.internal.SSLConnectionLink.determineNextChannel(SSLConnectionLink.java:1043)
at
com.ibm.ws.channel.ssl.internal.SSLConnectionLink$MyReadCompletedCallback.complete(SSLConnectionLink.java:632)
at
com.ibm.ws.channel.ssl.internal.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1777)
at
com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:504)
at
com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:574)
at
com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:929)
at
com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:1018)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1153)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.lang.Thread.run(Thread.java:785)
Caused by: javax.servlet.ServletException: Filter [grailsWebRequest]: could not be initialized at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:163)
at
com.ibm.ws.webcontainer.filter.WebAppFilterManager._loadFilter(WebAppFilterManager.java:655)
at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:518)
at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:319)
at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:399)
at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:988)
at
com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1143)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:1381)
at
com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:186)
at com.ibm.ws.webcontainer.webapp.WebApp.sendError(WebApp.java:4281)
... 23 more
Caused by: java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered? at
org.springframework.web.context.support.WebApplicationContextUtils.getRequiredWebApplicationContext(WebApplicationContextUtils.java:84)
at
org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter.initialize(GrailsWebRequestFilter.java:108)
at
org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter.initFilterBean(GrailsWebRequestFilter.java:104)
at
org.springframework.web.filter.GenericFilterBean.init(GenericFilterBean.java:194)
at
com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.init(FilterInstanceWrapper.java:149)
... 32 more
Please anyone have suggestion?