Reputation: 1
I am trying to deploy my Spring project in tomcat, but I am facing this problem:
> Información: Initializing Spring root WebApplicationContext 2014-07-09
> 18:51:24,838 [localhost-startStop-1] ERROR
> org.springframework.web.context.ContextLoader - Context
> initialization failed
> org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'loginController': Injection of autowired
> dependencies failed; nested exception is
> org.springframework.beans.factory.BeanCreationException: Could not
> autowire field: security.LoginService
> security.LoginController.service; nested exception is
> org.springframework.beans.factory.BeanCreationException: Error
> creating bean with name 'loginService' defined in ServletContext
> resource [/WEB-INF/config/security.xml]: Initialization of bean
> failed; nested exception is **java.lang.NoClassDefFoundError:
> org/springframework/cglib/core/SpringNamingPolicy** at
> org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1120)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)
> at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)
> at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
> at ....
Upvotes: 0
Views: 615
Reputation: 157
Note for future archaeologist: I've noticed similar issue while trying to add 'global-method-security' to web application using old Spring 3.2.6.
Root cause: missing class org.springframework.cglib.core.SpringNamingPolicy
Solution: update Spring to at least 3.2.8 (spring core to be precise)
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.2.8.RELEASE</version>
</dependency>
Upvotes: 1