user1570656
user1570656

Reputation: 23

Spring application failed to load in Java 1.7

We had recently migrated our web sphere from 8.5 to 8.5.5.14 and java from 1.6 to 1.7. My spring application works with java 1.6. When i tried to deploy in Java 1.7 it throws below exception on server startup. Not sure whats wrong with it. Can anyone please help. I am just posting the error details from the log...

>     [2/16/19 12:24:30:148 EST] 00000065 WASSessionCor I SessionContextRegistry getSessionContext SESN0176I: Will create a new
> session context for application key default_hostapps/TMS
>     [2/16/19 12:24:34:707 EST] 00000065 webapp        I com.ibm.ws.webcontainer.webapp.WebApp log SRVE0292I: Servlet Message -
> [TMSEAR#TMS.war]:.No Spring WebApplicationInitializer types detected
> on classpath
>     [2/16/19 12:24:34:908 EST] 00000065 webapp        I com.ibm.ws.webcontainer.webapp.WebApp log SRVE0292I: Servlet Message -
> [TMSEAR#TMS.war]:.Initializing Spring FrameworkServlet 'mydispatcher'
>     [2/16/19 12:24:34:909 EST] 00000065 DispatcherSer I org.springframework.web.servlet.FrameworkServlet initServletBean
> FrameworkServlet 'mydispatcher': initialization started
>     [2/16/19 12:24:34:930 EST] 00000065 XmlWebApplica I org.springframework.context.support.AbstractApplicationContext
> prepareRefresh Refreshing WebApplicationContext for namespace
> 'mydispatcher-servlet': startup date [Sat Feb 16 12:24:34 EST 2019];
> root of context hierarchy
>     [2/16/19 12:24:34:975 EST] 00000065 XmlBeanDefini I org.springframework.beans.factory.xml.XmlBeanDefinitionReader
> loadBeanDefinitions Loading XML bean definitions from ServletContext
> resource [/WEB-INF/config/dispatcher-servlet.xml]
>     [2/16/19 12:24:35:220 EST] 00000065 DefaultListab I org.springframework.beans.factory.support.DefaultListableBeanFactory
> registerBeanDefinition Overriding bean definition for bean
> 'timesheetSubmitRemainderTask': replacing [Generic bean: class
> [com.tms.scheduleTasks.TimesheetSubmitRemainderTask]; scope=singleton;
> abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0;
> autowireCandidate=true; primary=false; factoryBeanName=null;
> factoryMethodName=null; initMethodName=null; destroyMethodName=null;
> defined in file
> [C:\ICESAPPs\Projects\TMS\WebContent\WEB-INF\classes\com\tms\scheduleTasks\TimesheetSubmitRemainderTask.class]]
> with [Generic bean: class
> [com.tms.scheduleTasks.TimesheetSubmitRemainderTask]; scope=;
> abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0;
> autowireCandidate=true; primary=false; factoryBeanName=null;
> factoryMethodName=null; initMethodName=null; destroyMethodName=null;
> defined in ServletContext resource
> [/WEB-INF/config/dispatcher-servlet.xml]]
>     [2/16/19 12:24:35:562 EST] 00000065 AutowiredAnno I org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor
> <init> JSR-330 'javax.inject.Inject' annotation found and supported
> for autowiring
>     [2/16/19 12:24:35:600 EST] 00000065 PostProcessor I org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker
> postProcessAfterInitialization Bean
> 'org.springframework.scheduling.annotation.SchedulingConfiguration' of
> type [class
> org.springframework.scheduling.annotation.SchedulingConfiguration$$EnhancerBySpringCGLIB$$1143cbab]
> is not eligible for getting processed by all BeanPostProcessors (for
> example: not eligible for auto-proxying)
>     [2/16/19 12:24:36:347 EST] 00000065 XmlWebApplica W org.springframework.context.support.AbstractApplicationContext refresh
> Exception encountered during context initialization - cancelling
> refresh attempt
>                                      org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'adminController': Injection of autowired
> dependencies failed; nested exception is
> org.springframework.beans.factory.BeanCreationException: Could not
> autowire field: private com.tms.dao.MenuAccessDAO
> com.tms.controller.ServiceController.menuAccessDAO; nested exception
> is org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'menuAccessDAO': Injection of autowired
> dependencies failed; nested exception is
> org.springframework.beans.factory.BeanCreationException: Could not
> autowire field: private org.hibernate.SessionFactory
> com.tms.dao.MenuAccessDAOImpl.sessionFactory; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'sessionFactory' defined in ServletContext
> resource [/WEB-INF/config/dispatcher-servlet.xml]: Invocation of init
> method failed; nested exception is java.lang.NoClassDefFoundError:
> ch.qos.logback.core.joran.spi.JoranException
>       at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
>       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1210)
>       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
>       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
>       at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)
>       at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
>       at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)
>       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
>       at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)
>       at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)
>       at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
>       at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:664)
>       at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:630)
>       at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:678)
>       at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:549)
>       at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:490)
>       at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
>       at javax.servlet.GenericServlet.init(GenericServlet.java:161)

Upvotes: 0

Views: 591

Answers (1)

Atul Dwivedi
Atul Dwivedi

Reputation: 1462

You need to make sure at least one of below dependencies is present in your class path:

<dependency>
     <groupId>ch.qos.logback</groupId>
     <artifactId>logback-core</artifactId>
     <version>1.2.3</version> 
 </dependency>


<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-core</artifactId>
    <version>1.2.3</version>
</dependency>

Version you can choose which is compatible with other dependencies.

Upvotes: 1

Related Questions