Pourquoi/Comment j'obtiens l'erreur: NoClassDefFoundError: org/springframework/aop/cadre/ProxyFactory

Objectif: Démarrer un serveur qui prend en charge un accès à distance à des appels de méthode.

L'application n'est pas en panne jusqu'à ce que tous les services sont créés.

Le pot est dans la cible répertoire/lib de l'.

Pom Parent a la dépendance:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-aop</artifactId>
    <version>${version.spring}</version>
</dependency>

Remarque: je suis en mesure de créer un printemps bean de type: org.springframework.aop.cadre.ProxyFactory

Trace De La Pile:

36438 [principal] ERREUR org.springframework.web.contexte.ContextLoader - Contexte échec de l'initialisation de 
org.springframework.les haricots.usine.BeanCreationException: Erreur lors de la création de haricots avec le nom " org.springframework.l'accès distant.rmi.RmiServiceExporter#0 " défini dans le chemin de classe de ressource [application-context-service-web-server.xml]: Invocation de la méthode d'initialisation a échoué; nested exception java.lang.NoClassDefFoundError: org/springframework/aop/cadre/ProxyFactory 
au org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338) 
au org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) 
au org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) 
à java.de sécurité.AccessController.doPrivileged(Native method) 
au org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) 
au org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) 
au org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) 
au org.springframework.les haricots.usine.de soutien.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) 
au org.springframework.les haricots.usine.de soutien.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) 
au org.springframework.les haricots.usine.de soutien.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) 
au org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429) 
au org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) 
au org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380) 
au org.springframework.web.contexte.ContextLoader.createWebApplicationContext(ContextLoader.java:255) 
au org.springframework.web.contexte.ContextLoader.initWebApplicationContext(ContextLoader.java:199) 
au org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) 
au org.apache.catalina.de base.StandardContext.listenerStart(StandardContext.java:3795) 
au org.apache.catalina.de base.StandardContext.start(StandardContext.java:4252) 
au org.apache.catalina.de base.ContainerBase.addChildInternal(ContainerBase.java:760) 
au org.apache.catalina.de base.ContainerBase.addChild(ContainerBase.java:740) 
au org.apache.catalina.de base.StandardHost.addChild(StandardHost.java:544) 
au org.apache.catalina.de démarrage.HostConfig.deployDescriptor(HostConfig.java:626) 
au org.apache.catalina.de démarrage.HostConfig.deployDescriptors(HostConfig.java:553) 
au org.apache.catalina.de démarrage.HostConfig.deployApps(HostConfig.java:488) 
au org.apache.catalina.de démarrage.HostConfig.start(HostConfig.java:1150) 
au org.apache.catalina.de démarrage.HostConfig.lifecycleEvent(HostConfig.java:311) 
au org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120) 
au org.apache.catalina.de base.ContainerBase.start(ContainerBase.java:1022) 
au org.apache.catalina.de base.StandardHost.start(StandardHost.java:736) 
au org.apache.catalina.de base.ContainerBase.start(ContainerBase.java:1014) 
au org.apache.catalina.de base.StandardEngine.start(StandardEngine.java:443) 
au org.apache.catalina.de base.StandardService.start(StandardService.java:448) 
au org.apache.catalina.de base.StandardServer.start(StandardServer.java:700) 
au org.apache.catalina.de démarrage.Catalina.start(Catalina.java:552) 
au coucher du soleil.de réfléchir.NativeMethodAccessorImpl.invoke0(Native method) 
au coucher du soleil.de réfléchir.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
au coucher du soleil.de réfléchir.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
à java.lang.de réfléchir.La méthode.invoke(la Méthode.java:585) 
au org.apache.catalina.de démarrage.Bootstrap.démarrer ("Bootstrap".java:295) 
au org.apache.catalina.de démarrage.Bootstrap.principal ("Bootstrap".java:433) 
Causés par: java.lang.NoClassDefFoundError: org/springframework/aop/cadre/ProxyFactory 
au org.springframework.l'accès distant.de soutien.RemoteExporter.getProxyForService(RemoteExporter.java:156) 
au org.springframework.l'accès distant.rmi.RmiBasedExporter.getObjectToExport(RmiBasedExporter.java:61) 
au org.springframework.l'accès distant.rmi.RmiServiceExporter.préparer(RmiServiceExporter.java:268) 
au org.springframework.l'accès distant.rmi.RmiServiceExporter.afterPropertiesSet(RmiServiceExporter.java:227) 
au org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369) 
au org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335) 
... 39 plus 

application-context-service-web-server.xml:

<bean class="org.springframework.remoting.rmi.RmiServiceExporter">
    <!-- does not necessarily have to be the same name as the bean to be exported -->
    <property name="serviceName" value="Manager1" />
    <property name="service" ref="manager1" />
    <property name="serviceInterface" value="com.service.Manager1" />
    <!-- defaults to 1099 -->
    <property name="registryPort" value="1199" />
</bean>

<bean class="org.springframework.remoting.rmi.RmiServiceExporter">
    <!-- does not necessarily have to be the same name as the bean to be exported -->
    <property name="serviceName" value="Manager2" />
    <property name="service" ref="manager2" />
    <property name="serviceInterface" value="com.service.Manager2" />
    <!-- defaults to 1099 -->
    <property name="registryPort" value="1199" />
</bean>

<bean id="manager1"
      class="com.service.impl.Manager1Impl">
    ...
</bean>

<bean id="manager2"
      class="com.service.impl.Manager2Impl">
    ...
</bean>

REMARQUE: Cela fonctionne, mais le ci-dessus ne parvient toujours pas

<bean id="proxied" class="org.springframework.aop.framework.ProxyFactory" />
Thread [main] (Suspendu (entrée en méthode dans ProxyFactory)) 
ProxyFactory.() en ligne: 40 
NativeConstructorAccessorImpl.newInstance0(Constructeur, Object []), en ligne: non disponible [méthode native] 
NativeConstructorAccessorImpl.newInstance(Object []), en ligne: 39 
DelegatingConstructorAccessorImpl.newInstance(Object []), en ligne: 27 
Constructeur.newInstance(Objet...): 494 
Je viens de mettre un point d'arrêt au constructeur pour ProxyFactory et mon haricot a été créé avec succès en tant qu'unité autonome de haricot qui est un proxy de l'usine.

OriginalL'auteur ScrappyDev | 2011-02-16