title: Unable to deploy the project in Apache tomcat with apache cxf
body: <p>I have created a soap web service using spring 4.2.4, apache cxf 3.1.4 and maven 3.0. When I try to deploy the application, I am getting an error like below:</p>
  
  <pre><code>WARNING: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pdpservice': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.springframework.aop.support.AopUtils.isCglibProxyClass(Ljava/lang/Class;)Z
  Dec 21, 2015 3:12:34 PM org.springframework.web.context.ContextLoader initWebApplicationContext
  SEVERE: Context initialization failed
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pdpservice': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.springframework.aop.support.AopUtils.isCglibProxyClass(Ljava/lang/Class;)Z
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
      at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:446)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:328)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5077)
      at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5591)
      at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
      at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
      at java.util.concurrent.FutureTask.run(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)
  Caused by: java.lang.NoSuchMethodError: org.springframework.aop.support.AopUtils.isCglibProxyClass(Ljava/lang/Class;)Z
      at org.apache.cxf.common.util.SpringAopClassHelper.getRealClassInternal(SpringAopClassHelper.java:85)
      at org.apache.cxf.common.util.ClassHelper.getRealClass(ClassHelper.java:65)
      at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:150)
      at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)
      at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:456)
      at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:334)
      at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:251)
      at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:539)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1706)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1645)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574)
      ... 21 more
  </code></pre>
  
  <p>when i try to debug this i come to know, my code referring the below class org.springframework.aop.support.AopUtils.isCglibProxyClass
  Instead of org.springframework.util.ClassUtils.isCglibProxyClass. </p>
  
  <p>Reference:
  <a href="https://stackoverflow.com/questions/22373751/bean-creation-throws-exception-at-the-build-time">Bean creation throws exception at the build time</a></p>
  
  <p>I dont know what i did wrong. Below given the POM.xml</p>
  
  <pre><code>&lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      ...
      &lt;properties&gt;
          &lt;spring.version&gt;4.2.4.RELEASE&lt;/spring.version&gt;
          &lt;cxf.version&gt;3.1.4&lt;/cxf.version&gt;
      &lt;/properties&gt;
      &lt;dependencies&gt;
      &lt;!-- Spring framework --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
          &lt;version&gt;${spring.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-beans&lt;/artifactId&gt;
          &lt;version&gt;${spring.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
          &lt;version&gt;${spring.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-aop&lt;/artifactId&gt;
          &lt;version&gt;${spring.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- Web Service runtime --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
          &lt;artifactId&gt;cxf-core&lt;/artifactId&gt;
          &lt;version&gt;${cxf.version}&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
          &lt;artifactId&gt;cxf-rt-bindings-soap&lt;/artifactId&gt;
          &lt;version&gt;${cxf.version}&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
          &lt;artifactId&gt;cxf-rt-frontend-jaxws&lt;/artifactId&gt;
          &lt;version&gt;${cxf.version}&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
          &lt;artifactId&gt;cxf-rt-transports-http&lt;/artifactId&gt;
          &lt;version&gt;${cxf.version}&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
          &lt;artifactId&gt;cxf-rt-rs-extension-providers&lt;/artifactId&gt;
          &lt;version&gt;${cxf.version}&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
          &lt;artifactId&gt;cxf-bundle&lt;/artifactId&gt;
          &lt;version&gt;2.7.18&lt;/version&gt;
          &lt;scope&gt;compile&lt;/scope&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.springframework&lt;/groupId&gt;
                  &lt;artifactId&gt;*&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.eclipse.jetty&lt;/groupId&gt;
                  &lt;artifactId&gt;*&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.apache.geronimo.specs&lt;/groupId&gt;
                  &lt;artifactId&gt;*&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.cxf&lt;/groupId&gt;
          &lt;artifactId&gt;cxf-tools-java2ws&lt;/artifactId&gt;
          &lt;version&gt;${cxf.version}&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;/dependencies&gt;
      &lt;build&gt;
      ....
      &lt;/build&gt;
  &lt;/Project&gt;
  </code></pre>
  
  <p>My Service class:</p>
  
  <pre><code>package com.pd.service;
  
  import java.util.List;
  
  import javax.jws.WebMethod;
  import javax.jws.WebParam;
  import javax.jws.WebService;
  
  import com.pd.service.bean.Product;
  
  @WebService(targetNamespace="http://service.pd.com/")
  public interface PDService {
  
      @WebMethod
       public Product getProduct(@WebParam(name = "arg0") int id);
      @WebMethod
       public List&lt;Product&gt; getAllProducts();
  
  }
  </code></pre>
  
  <p>My service class Implementation:</p>
  
  <pre><code>package com.pd.service.impl;
  
  import java.util.List;
  
  import javax.jws.WebService;
  
  import org.springframework.beans.factory.annotation.Autowired;
  
  import com.pd.service.PDService;
  import com.pd.service.bean.Product;
  import com.pd.service.dao.PDServiceDAO;
  
  @WebService(targetNamespace="http://impl.service.pd.com/", endpointInterface="com.pd.service.PDService")
  public class PDServiceImpl implements PDService {
  
      @Autowired
      PDServiceDAO pdServiceDAO;
  
      @Override
      public Product getProduct(int id) {
          return pdServiceDAO.getProduct(id);
      }
  
      @Override
      public List&lt;Product&gt; getAllProducts() {
          return pdServiceDAO.getAllProducts();
      }
  }
  </code></pre>
  
  <p>Could you please help me with this. Thanks in advance.</p>