The following is the error message I get when I try to start my web application. This is a project where we are upgrading from JDK-8 to JDK-17. We have upgraded all Jakarta libraries and required junits have also been modified appropriately. Unsure where should we focus for this issue.
Caused by: java.lang.IllegalStateException: Cannot convert value of type 'org.springframework.jdbc.core.JdbcTemplate' to required type 'javax.sql.DataSource' for property 'dataSource': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:273)
at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:590)
... 47 common frames omitted
timestamp="2024-02-26T13:13:30.996Z" level="ERROR" applicationName="sample-web-app" loggerName="org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/web]" environment="localdev" message="Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener]" class="org.apache.juli.logging.DirectJDKLog" method="log" line="175"
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'A0020.relation.JdbcTemplate' defined in ServletContext resource [/WEB-INF/config/springioc/applicationContext.xml]: Failed to convert property value of type 'org.springframework.jdbc.core.JdbcTemplate' to required type 'javax.sql.DataSource' for property 'dataSource'; Cannot convert value of type 'org.springframework.jdbc.core.JdbcTemplate' to required type 'javax.sql.DataSource' for property 'dataSource': no matching editors or conversion strategy found
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:607)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:522)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:325)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:975)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:959)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:624)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:394)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:274)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:102)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4422)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:4860)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866)
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:845)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1332)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1322)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:145)
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:866)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:240)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:433)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:917)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
at org.apache.catalina.startup.Catalina.start(Catalina.java:795)
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.catalina.startup.Bootstrap.start(Bootstrap.java:347)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:478)
Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'org.springframework.jdbc.core.JdbcTemplate' to required type 'javax.sql.DataSource' for property 'dataSource'; Cannot convert value of type 'org.springframework.jdbc.core.JdbcTemplate' to required type 'javax.sql.DataSource' for property 'dataSource': no matching editors or conversion strategy found
at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:595)
at org.springframework.beans.AbstractNestablePropertyAccessor.convertForProperty(AbstractNestablePropertyAccessor.java:609)
at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:189)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1745)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1689)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1434)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:599)
... 41 common frames omitted
Caused by: java.lang.IllegalStateException: Cannot convert value of type 'org.springframework.jdbc.core.JdbcTemplate' to required type 'javax.sql.DataSource' for property 'dataSource': no matching editors or conversion strategy found
at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:273)
at org.springframework.beans.AbstractNestablePropertyAccessor.convertIfNecessary(AbstractNestablePropertyAccessor.java:590)
... 47 common frames omitted
timestamp="2024-02-26T13:13:31.518Z" level="INFO" applicationName="sample-web-app" loggerName="jakarta.enterprise.resource.webcontainer.jsf.config" environment="localdev" message="Initializing Mojarra 3.0.0 for context '/web'" class="com.sun.faces.config.ConfigureListener" method="contextInitialized" line="195"
timestamp="2024-02-26T13:13:35.996Z" level="INFO" applicationName="sample-web-app" loggerName="jakarta.enterprise.resource.webcontainer.jsf.application" environment="localdev" message="JSF1048: PostConstruct/PreDestroy annotations present. ManagedBeans methods marked with these annotations will have said annotations processed." class="com.sun.faces.spi.InjectionProviderFactory" method="createInstance" line="97"
timestamp="2024-02-26T13:13:47.703Z" level="INFO" applicationName="sample-web-app" loggerName="org.primefaces.webapp.PostConstructApplicationEventListener" environment="localdev" message="Running on PrimeFaces 13.0.0" class="org.primefaces.webapp.PostConstructApplicationEventListener" method="processEvent" line="50"
timestamp="2024-02-26T13:13:47.815Z" level="ERROR" applicationName="sample-web-app" loggerName="org.apache.catalina.core.StandardContext" environment="localdev" message="One or more listeners failed to start. Full details will be found in the appropriate container log file" class="org.apache.juli.logging.DirectJDKLog" method="log" line="173"
timestamp="2024-02-26T13:13:47.826Z" level="ERROR" applicationName="sample-web-app" loggerName="org.apache.catalina.core.StandardContext" environment="localdev" message="Context [/web] startup failed due to previous errors" class="org.apache.juli.logging.DirectJDKLog" method="log" line="173"
timestamp="2024-02-26T13:13:48.460Z" level="INFO" applicationName="sample-web-app" loggerName="org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/web]" environment="localdev" message="Closing Spring root WebApplicationContext" class="org.apache.juli.logging.DirectJDKLog" method="log" line="173"
timestamp="2024-02-26T13:13:48.537Z" level="WARN" applicationName="sample-web-app" loggerName="org.apache.catalina.loader.WebappClassLoaderBase" environment="localdev" message="The web application [web] appears to have started a thread named [logback-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
[email protected]/jdk.internal.misc.Unsafe.park(Native Method)
[email protected]/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:252)
[email protected]/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1672)
[email protected]/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1182)
[email protected]/java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:899)
[email protected]/java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1062)
[email protected]/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1122)
[email protected]/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[email protected]/java.lang.Thread.run(Thread.java:840)" class="org.apache.juli.logging.DirectJDKLog" method="log" line="173"
timestamp="2024-02-26T13:13:48.679Z" level="ERROR" applicationName="sample-web-app" loggerName="org.apache.catalina.startup.Catalina" environment="localdev" message="The required Server component failed to start so Tomcat is unable to start." class="org.apache.juli.logging.DirectJDKLog" method="log" line="175"
org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:419)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:186)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:917)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
at org.apache.catalina.startup.Catalina.start(Catalina.java:795)
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.catalina.startup.Bootstrap.start(Bootstrap.java:347)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:478)
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/lang/text/StrBuilder
at org.apache.commons.lang.StringUtils.replace(StringUtils.java:3815)
at org.apache.commons.lang.StringUtils.replace(StringUtils.java:3771)
at com.minnesotamutual.individual.common.logging.KeyValueFormattedEventBuilder.valueToStr(KeyValueFormattedEventBuilder.java:63)
at com.minnesotamutual.individual.common.logging.KeyValueFormattedEventBuilder.append(KeyValueFormattedEventBuilder.java:40)
at com.minnesotamutual.individual.common.logging.KeyValueAppLogLayout.doLayout(KeyValueAppLogLayout.java:69)
at com.minnesotamutual.individual.common.logging.KeyValueAppLogLayout.doLayout(KeyValueAppLogLayout.java:31)
at ch.qos.logback.core.encoder.LayoutWrappingEncoder.encode(LayoutWrappingEncoder.java:114)
at ch.qos.logback.core.OutputStreamAppender.writeOut(OutputStreamAppender.java:192)
at ch.qos.logback.core.OutputStreamAppender.subAppend(OutputStreamAppender.java:237)
at ch.qos.logback.core.OutputStreamAppender.append(OutputStreamAppender.java:102)
at ch.qos.logback.core.UnsynchronizedAppenderBase.doAppend(UnsynchronizedAppenderBase.java:85)
at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:51)
at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:272)
at ch.qos.logback.classic.Logger.callAppenders(Logger.java:259)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:426)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:386)
at ch.qos.logback.classic.Logger.log(Logger.java:780)
at org.slf4j.bridge.SLF4JBridgeHandler.callLocationAwareLogger(SLF4JBridgeHandler.java:232)
at org.slf4j.bridge.SLF4JBridgeHandler.publish(SLF4JBridgeHandler.java:313)
at java.logging/java.util.logging.Logger.log(Logger.java:980)
at java.logging/java.util.logging.Logger.doLog(Logger.java:1007)
at java.logging/java.util.logging.Logger.logp(Logger.java:1284)
at org.apache.juli.logging.DirectJDKLog.log(DirectJDKLog.java:175)
at org.apache.juli.logging.DirectJDKLog.error(DirectJDKLog.java:141)
at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:423)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:186)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:450)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
... 9 common frames omitted
Caused by: java.lang.ClassNotFoundException: Illegal access: this web application instance has been stopped already. Could not load [org.apache.commons.lang.text.StrBuilder]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
... 37 common frames omitted
Tried looking for support between JDBC and Datasource. Since we are using mssql-jdbc and spring-jdbc, tried checking if this conflict can create the issue. In some website, I found that JDBC driver issue was there when they moved from JDK11 to JDK17. But there was no clear answer for the issue specified in that page. Tried figuring out if it is due to any jar version mismatch, but that looks like a laborious task.