Я обновил свое приложение с Java7 до Java8, Spring 3.4 до Spring 5.1.4, Hibernate 4.2.11 до 5.2.11.
Я проверил jar и обновил spring jar (v5.1.4)и hibernate jar (5.2.11).
Разрешенный POM
<properties>
<spring.security.version>5.1.3.RELEASE</spring.security.version>
<slf4j.version>1.7.25</slf4j.version>
<dbcp.version>1.4</dbcp.version>
<java-version>1.8</java-version>
<jstl.version>1.2</jstl.version>
<displaytag.version>1.2</displaytag.version>
<hibernate.version>5.2.11.Final</hibernate.version>
<logback.version>1.1.2</logback.version>
<jspapi.version>2.1</jspapi.version>
<servletapi.version>2.5</servletapi.version>
<jackson.version>1.9.10</jackson.version>
<mysql.connector.version>8.0.13</mysql.connector.version>
<spring.version>5.1.4.RELEASE</spring.version>
</properties>
spring-database.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd">
<context:component-scan base-package="com.s382.kris.*" />
<tx:annotation-driven />
<!-- Root Context: defines shared resources visible to all other web components -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="com.mysql.cj.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/s382?zeroDateTimeBehavior=convertToNull" />
<property name="username" value="admin" />
<property name="password" value="admin" />
</bean>
<!-- Hibernate 5 XML SessionFactory Bean definition-->
<bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="mappingResources">
<list>
<value>orm/User.hbm.xml</value>
<value>orm/UserRole.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.format_sql">false</prop>
<prop key="hibernate.show_sql">false</prop>
</props>
</property>
</bean>
<!-- MUST have transaction manager, using aop and aspects -->
<bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="get*" read-only="true" />
<tx:method name="find*" read-only="true" />
<tx:method name="*" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="allServices" expression="execution(* com.s382.kris.service.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="allServices" />
</aop:config>
'' '
Stack Trace
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'companyController' defined in file [/home/barkha/Documents/workspace-sts-3.9.7.RELEASE/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/s382/WEB-INF/classes/com/s382/kris/controller/CompanyController.class]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.config.internalTransactionAdvisor': Cannot resolve reference to bean 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0' while setting bean property 'transactionAttributeSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0': BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.methodSecurityMetadataSourceAdvisor': Cannot resolve reference to bean 'org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource#0' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource#0': Cannot create inner bean '(inner bean)#348f470f' of type [org.springframework.security.access.prepost.PrePostAnnotationSecurityMetadataSource] while setting constructor argument with key [0]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#348f470f': Cannot create inner bean '(inner bean)#3de1ec44' of type [org.springframework.security.access.expression.method.ExpressionBasedAnnotationAttributeFactory] while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#3de1ec44': Cannot resolve reference to bean 'org.springframework.security.config.method.GlobalMethodSecurityBeanDefinitionParser$DefaultMethodSecurityExpressionHandlerBeanFactory#0$created#0' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.method.GlobalMethodSecurityBeanDefinitionParser$DefaultMethodSecurityExpressionHandlerBeanFactory#0': Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: ; nError creating bean with name 'sessionFactory': Lookup method resolution failedested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.orm.hibernate5.LocalSessionFactoryBean] from ClassLoader [ParallelWebappClassLoader
Приложение успешно собирается, но выдает ошибку при запуске на tomcat9