title: Why/How am I getting the error: NoClassDefFoundError: org/springframework/aop/framework/ProxyFactory
body: <p><strong>Goal:</strong> Start up a server which supports remote access to method calls.</p>
  
  <p>The application doesn't fail till after all services are created.</p>
  
  <p>The jar is in the target/lib directory.</p>
  
  <p><strong>Parent pom has the dependency:</strong></p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.springframework&lt;/groupId&gt;
      &lt;artifactId&gt;spring-aop&lt;/artifactId&gt;
      &lt;version&gt;${version.spring}&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p><strong>Note:</strong> I am able to create a spring bean of type: org.springframework.aop.framework.ProxyFactory</p>
  
  <p><strong>Stack Trace:</strong></p>
  
  <pre>
  36438 [main] ERROR org.springframework.web.context.ContextLoader  - Context initialization failed
  org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.remoting.rmi.RmiServiceExporter#0' defined in class path resource [application-context-service-web-server.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/aop/framework/ProxyFactory
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
      at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
      at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
      at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3795)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4252)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
      at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
      at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
      at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1150)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
      at org.apache.catalina.core.StandardService.start(StandardService.java:448)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
  Caused by: java.lang.NoClassDefFoundError: org/springframework/aop/framework/ProxyFactory
      at org.springframework.remoting.support.RemoteExporter.getProxyForService(RemoteExporter.java:156)
      at org.springframework.remoting.rmi.RmiBasedExporter.getObjectToExport(RmiBasedExporter.java:61)
      at org.springframework.remoting.rmi.RmiServiceExporter.prepare(RmiServiceExporter.java:268)
      at org.springframework.remoting.rmi.RmiServiceExporter.afterPropertiesSet(RmiServiceExporter.java:227)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
      ... 39 more
  </pre>
  
  <p><strong>application-context-service-web-server.xml:</strong></p>
  
  <pre><code>&lt;bean class="org.springframework.remoting.rmi.RmiServiceExporter"&gt;
      &lt;!-- does not necessarily have to be the same name as the bean to be exported --&gt;
      &lt;property name="serviceName" value="Manager1" /&gt;
      &lt;property name="service" ref="manager1" /&gt;
      &lt;property name="serviceInterface" value="com.service.Manager1" /&gt;
      &lt;!-- defaults to 1099 --&gt;
      &lt;property name="registryPort" value="1199" /&gt;
  &lt;/bean&gt;
  
  &lt;bean class="org.springframework.remoting.rmi.RmiServiceExporter"&gt;
      &lt;!-- does not necessarily have to be the same name as the bean to be exported --&gt;
      &lt;property name="serviceName" value="Manager2" /&gt;
      &lt;property name="service" ref="manager2" /&gt;
      &lt;property name="serviceInterface" value="com.service.Manager2" /&gt;
      &lt;!-- defaults to 1099 --&gt;
      &lt;property name="registryPort" value="1199" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="manager1"
        class="com.service.impl.Manager1Impl"&gt;
      ...
  &lt;/bean&gt;
  
  &lt;bean id="manager2"
        class="com.service.impl.Manager2Impl"&gt;
      ...
  &lt;/bean&gt;
  </code></pre>
  
  <p><strong>NOTE:</strong> This works, but the above still fails</p>
  
  <pre><code>&lt;bean id="proxied" class="org.springframework.aop.framework.ProxyFactory" /&gt;
  </code></pre>
  
  <pre>Thread [main] (Suspended (entry into method  in ProxyFactory))   
      ProxyFactory.() line: 40  
      NativeConstructorAccessorImpl.newInstance0(Constructor, Object[]) line: not available [native method]   
      NativeConstructorAccessorImpl.newInstance(Object[]) line: 39    
      DelegatingConstructorAccessorImpl.newInstance(Object[]) line: 27    
      Constructor.newInstance(Object...) line: 494 
  </pre>