IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Spring Java Discussion :

Problème CGLIB Spring 2.5 + Struts 2


Sujet :

Spring Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2006
    Messages
    154
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2006
    Messages : 154
    Par défaut Problème CGLIB Spring 2.5 + Struts 2
    Bonjour,

    Je rencontre un problème dans une appli web utilisant Spring 2.5 + struts 2 avec maven.
    J'ai besoin de définir la portée de mes beans en session mais le problème c'est que ça me génère une erreur dès le lancement du serveur jetty.

    Voici le message d'erreur:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
     
    2012-02-16 10:06:29,423 ERROR [ContextLoader.java:227] : Context initialization failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'creationDMPAction' defined in file [C:\Users\demo\workspace\DMP_Struts\HelloDMP\HelloDMP-web\target\classes\applicationContext.xml]: Cannot resolve reference to bean 'xmlService' while setting bean property 'xmlService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xmlService' defined in file [C:\Users\demo\workspace\DMP_Struts\HelloDMP\HelloDMP-web\target\classes\applicationContext.xml]: Cannot resolve reference to bean 'patientDMP' while setting bean property 'patientDMP'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'patientDMP' defined in BeanDefinition defined in file [C:\Users\demo\workspace\DMP_Struts\HelloDMP\HelloDMP-web\target\classes\applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class com.enovation.dmp.beans.PatientDMP]: Common causes of this problem include using a final class or a non-visible class; nested exception is net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
        at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
        at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:549)
        at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
        at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1282)
        at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:518)
        at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:499)
        at org.mortbay.jetty.plugin.Jetty6PluginWebAppContext.doStart(Jetty6PluginWebAppContext.java:115)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        at org.mortbay.jetty.plugin.AbstractJettyRunMojo.restartWebApp(AbstractJettyRunMojo.java:458)
        at org.mortbay.jetty.plugin.AbstractJettyRunMojo$1.filesChanged(AbstractJettyRunMojo.java:419)
        at org.mortbay.util.Scanner.reportBulkChanges(Scanner.java:486)
        at org.mortbay.util.Scanner.reportDifferences(Scanner.java:352)
        at org.mortbay.util.Scanner.scan(Scanner.java:280)
        at org.mortbay.util.Scanner$1.run(Scanner.java:232)
        at java.util.TimerThread.mainLoop(Timer.java:555)
        at java.util.TimerThread.run(Timer.java:505)
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xmlService' defined in file [C:\Users\demo\workspace\DMP_Struts\HelloDMP\HelloDMP-web\target\classes\applicationContext.xml]: Cannot resolve reference to bean 'patientDMP' while setting bean property 'patientDMP'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'patientDMP' defined in BeanDefinition defined in file [C:\Users\demo\workspace\DMP_Struts\HelloDMP\HelloDMP-web\target\classes\applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class com.enovation.dmp.beans.PatientDMP]: Common causes of this problem include using a final class or a non-visible class; nested exception is net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1325)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
        ... 30 more
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'patientDMP' defined in BeanDefinition defined in file [C:\Users\demo\workspace\DMP_Struts\HelloDMP\HelloDMP-web\target\classes\applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class com.enovation.dmp.beans.PatientDMP]: Common causes of this problem include using a final class or a non-visible class; nested exception is net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
        at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
        ... 40 more
    Caused by: org.springframework.aop.framework.AopConfigException: Could not generate CGLIB subclass of class [class com.enovation.dmp.beans.PatientDMP]: Common causes of this problem include using a final class or a non-visible class; nested exception is net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
        at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:206)
        at org.springframework.aop.framework.ProxyFactory.getProxy(ProxyFactory.java:112)
        at org.springframework.aop.scope.ScopedProxyFactoryBean.setBeanFactory(ScopedProxyFactoryBean.java:109)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeAwareMethods(AbstractAutowireCapableBeanFactory.java:1439)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1408)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
        ... 46 more
    Caused by: net.sf.cglib.core.CodeGenerationException: java.lang.reflect.InvocationTargetException-->null
        at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:237)
        at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)
        at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:285)
        at org.springframework.aop.framework.Cglib2AopProxy.getProxy(Cglib2AopProxy.java:200)
        ... 51 more
    Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at net.sf.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:384)
        at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:219)
        ... 54 more
    Caused by: java.lang.SecurityException: class "com.enovation.dmp.beans.PatientDMP$$EnhancerByCGLIB$$477c3e23"'s signer information does not match signer information of other classes in the same package
        at java.lang.ClassLoader.checkCerts(ClassLoader.java:943)
        at java.lang.ClassLoader.preDefineClass(ClassLoader.java:657)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:785)
        ... 60 more
    Et le fichier application-context.xml:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
     
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        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" xmlns:context="http://www.springframework.org/schema/context"
        xmlns:oxm="http://www.springframework.org/schema/oxm"
        xsi:schemaLocation="
        http://www.springframework.org/schema/oxm 
        http://www.springframework.org/schema/oxm/spring-oxm-1.5.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-2.5.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
     
     
        <context:component-scan base-package="com.enovation.dmp.beans" />
     
        <!-- Actions -->
        <bean id="creationDMPAction" class="com.enovation.dmp.action.CreationDMPAction">
            <property name="xmlService" ref="xmlService" />
            <property name="patientDMP" ref="patientDMP" />
            <property name="creationDMPService" ref="creationDMPService" />
            <property name="representantDMP" ref="representantDMP" />
            <property name="autorisationDMP" ref="autorisationDMP" />
            <property name="accesPatientDMP" ref="accesPatientDMP" />
            <property name="reponseDMP" ref="reponseDMP" />
            <property name="dmpCreation" ref="dmpCreation" />
            <property name="userCarteCps" ref="userCarteCps" />
        </bean>
     
        <bean id="lectureVitaleAction" class="com.enovation.dmp.action.LectureVitaleAction">
            <property name="userCarteCps" ref="userCarteCps" />
            <property name="xmlService" ref="xmlService" />
            <property name="dmpCreation" ref="dmpCreation" />
        </bean>
     
        <bean id="identificationAction" class="com.enovation.dmp.action.IdentificationAction">
            <property name="userCarteCps" ref="userCarteCps" />
            <property name="accesPatientDMP" ref="accesPatientDMP" />
            <property name="ldapService" ref="ldapService" />
     
        </bean>
     
        <!-- Services -->
        <bean id="xmlMapper" class="com.enovation.dmp.xml.impl.MapperXmlImpl">
            <property name="jaxbMarshaller" ref="jaxbMarshaller" />
        </bean>
     
        <bean id="ldapService" class="com.enovation.dmp.service.impl.LdapServiceImpl">
            <property name="userCarteCps" ref="userCarteCps" />
        </bean>
     
        <bean id="jaxbMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
            <property name="classesToBeBound">
                <array>
                    <value>com.enovation.dmp.beans.vitale.DonneesVitales</value>
                    <value>com.enovation.dmp.beans.DmpCreation</value>
                    <value>generated.EnfDmpCreation</value>
                </array>
            </property>
        </bean>
     
        <bean id="xmlService" class="com.enovation.dmp.service.impl.XmlServiceImpl">
            <property name="xmlMapper" ref="xmlMapper" />
            <property name="patientDMP" ref="patientDMP" />
            <property name="coordonneesVitale" ref="coordonneesVitale" />
        </bean>
     
        <bean id="creationDMPService" class="com.enovation.dmp.service.impl.CreationDMPServiceImpl">
            <property name="xmlMapper" ref="xmlMapper" />
            <property name="dmpCreation" ref="dmpCreation" />
            <property name="wsCreationDMP" ref="wsCreationDMP" />
            <property name="reponseDMP" ref="reponseDMP" />
            <property name="accesPatientDMP" ref="accesPatientDMP" />
        </bean>
     
        <!-- BEANS -->
        <bean id="userCarteCps" class="com.enovation.dmp.beans.UserCarteCps"
     
            scope="session">
            <aop:scoped-proxy />
        </bean>
        <bean id="dmpCreation" class="com.enovation.dmp.beans.DmpCreation"
     
            scope="session">
            <aop:scoped-proxy />
            <property name="patient" ref="patientDMP" />
            <property name="representant" ref="representantDMP" />
            <property name="autorisations" ref="autorisationDMP" />
            <property name="vitale" ref="coordonneesVitale" />
            <property name="auteur" ref="userCarteCps" />
            <property name="accesPatient" ref="accesPatientDMP" />
            <property name="reponse" ref="reponseDMP" />
        </bean>
        <bean id="accesPatientDMP" class="com.enovation.dmp.beans.AccesPatientDMP"
     
            scope="session">
            <aop:scoped-proxy />
        </bean>
        <bean id="reponseDMP" class="com.enovation.dmp.beans.ReponseDMP"
     
            scope="session">
            <aop:scoped-proxy />
        </bean>
        <bean id="patientDMP" class="com.enovation.dmp.beans.PatientDMP"
     
            scope="session">
            <aop:scoped-proxy />
        </bean>
        <bean id="representantDMP" class="com.enovation.dmp.beans.RepresentantDMP"
     
            scope="session">
            <aop:scoped-proxy />
        </bean>
        <bean id="autorisationDMP" class="com.enovation.dmp.beans.AutorisationDMP"
     
            scope="session">
            <aop:scoped-proxy />
        </bean>
        <bean id="coordonneesVitale" class="com.enovation.dmp.beans.CoordonneesVitale"
     
            scope="session">
            <aop:scoped-proxy />
        </bean>
     
    </beans>

  2. #2
    Membre confirmé
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Juin 2006
    Messages
    154
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 41
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2006
    Messages : 154
    Par défaut
    J'ai corrigé le problème. En fait j'avais par erreur signé le jar qui contenait mes beans et c'était ça le problème.

    Par contre, j'ai un autre souci maintenant. J'ai une servlet qui s'occupe de la communication avec un applet. Dans cette servlet je récupère mon contexte spring et ensuite le bean userCarteCps comme ceci:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
                UserCarteCps userCarteCps = (UserCarteCps)context.getBean("userCarteCps");
    J'initialise ensuite ce bean puis je pars dans mon appli web (struts 2) et plus précisemment dans l'action identificationAction. Le problème c'est que je récupère un bean userCarteCps qui n'est pas le même que celui de la servlet car toutes mes données sont nulles... Le bean est injecté dans l'action identificationAction via le fichier de config.

    Quel est le problème? Ca vient de CGLIB mais je ne sais pas d'où...

Discussions similaires

  1. Réponses: 2
    Dernier message: 14/12/2007, 10h43
  2. Problème de choix avec checkBox STRUTS
    Par bobic dans le forum Struts 1
    Réponses: 1
    Dernier message: 14/08/2007, 16h27
  3. Réponses: 42
    Dernier message: 07/07/2007, 11h36
  4. Problème download fichier depuis action struts
    Par ddams dans le forum Struts 1
    Réponses: 2
    Dernier message: 08/11/2006, 20h35
  5. [Débat] Spring MVC versus Struts
    Par alheim dans le forum Frameworks Web
    Réponses: 6
    Dernier message: 19/12/2005, 10h13

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo