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 :

Configuration ACEGI Jboss [Security]


Sujet :

Spring Java

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Janvier 2007
    Messages
    46
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Janvier 2007
    Messages : 46
    Points : 40
    Points
    40
    Par défaut Configuration ACEGI Jboss
    Bonjour à tous,

    j'ai un problème avec acegi. Je l'utilise avec struts et EJB3.

    Mon problème est que je n'arrive pas à deployer mon application sur Jboss.


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     
     
     
    10:10:15,794 ERROR [ContextLoader] Context initialization failed
    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityAspect' defined in ServletContext
    resource [/WEB-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyB
    atchUpdateException; nested PropertyAccessExceptions (1) are:
    PropertyAccessException 1: org.springframework.beans.TypeMismatchException: Failed to convert property value of type [org.acegisec
    urity.intercept.method.aspectj.AspectJSecurityInterceptor] to required type [org.acegisecurity.intercept.method.aspectj.AspectJSec
    urityInterceptor] for property 'securityInterceptor'; nested exception is java.lang.IllegalArgumentException: Cannot convert value
     of type [org.acegisecurity.intercept.method.aspectj.AspectJSecurityInterceptor] to required type [org.acegisecurity.intercept.met
    hod.aspectj.AspectJSecurityInterceptor] for property 'securityInterceptor': no matching editors or conversion strategy found
    Voici la déclaration du bean dans applicationContext.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
     
     
    	<bean id="securityAspect" class="util.SecurityAspect"
    		factory-method="aspectOf">
    		<property name="securityInterceptor" ref="securityInterceptor" />
    	</bean>
     
    	<bean id="securityInterceptor" class="org.acegisecurity.intercept.method.aspectj.AspectJSecurityInterceptor">
    		<property name="authenticationManager"
    			ref="authenticationManager" />
    		<property name="accessDecisionManager"
    			ref="accessDecisionManager" />
    		<property name="afterInvocationManager"
    			ref="afterInvocationManager" />
    		<property name="objectDefinitionSource">
    			<value>
    				services.cyberProcedureServices.CpaManifInterface.getManifPersonne=ROLE_USER,AFTER_ACL_COLLECTION_READ
    			</value>
    		</property>
    	</bean>
    et voici ma classe securityAspect.aj

    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
     
    package util;
     
    import org.acegisecurity.intercept.method.aspectj.AspectJSecurityInterceptor;
    import org.acegisecurity.intercept.method.aspectj.AspectJCallback;
    import org.springframework.beans.factory.InitializingBean;
     
    public aspect SecurityAspect implements InitializingBean {
     
      private AspectJSecurityInterceptor securityInterceptor;
     
      pointcut executions(): 
    	  (execution(* services.cyberProcedureServices.CpaManifInterface.* (..)))
    		  && !within(SecurityAspect);
     
    // Object around(): executions() {
    //	  if (this.securityInterceptor != null) {
    //		  AspectJCallback callback = new AspectJCallback() {
    //			  public Object proceedWithObject() {
    //				  return proceed();
    //			  }
    //		  };
    //		  return this.securityInterceptor.invoke(thisJoinPoint, callback);
    //	  } else {
    //		  return proceed();
    //	  }
    //  }
     
      public AspectJSecurityInterceptor getSecurityInterceptor() {
        return securityInterceptor;
      }
     
      public void setSecurityInterceptor(AspectJSecurityInterceptor securityInterceptor) {
        this.securityInterceptor = securityInterceptor;
      }
     
      public void afterPropertiesSet() throws Exception {
        if (this.securityInterceptor == null)
          throw new IllegalArgumentException("securityInterceptor required");
      }
    }
    et enfin, un bout du web.xml:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
       <context-param>
    	<param-name>contextConfigLocation</param-name>
    	<param-value>
    		/WEB-INF/applicationContext.xml
    	</param-value>
       </context-param>  
     
       <listener>
    	<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
        </listener>
    en gros, il n'arrive pas à voir que la classe AspectJSecurityInterceptor, déclarée dans SecurityAspect.aj, est la même que la classe de la propriété securityInterceptor dans l'applicationContext.xml

    On m'a déjà dit sur un autre forum que ça pourrait être un problème avec le classLoader, c'est à dire que j'ai deux classLoader différents, ce qui fait que ces classes sont déployées avec des noms différents, ce qui fait qu'il ne les reconnait pas une classe identique.

    Quelqun aurait une autre idée? ou une confirmation?

    tout aide, proposition ou suggestion est la bienvenue. A vrai dire je suis assez débutant avec le monde J2EE

  2. #2
    Membre du Club
    Profil pro
    Inscrit en
    Janvier 2007
    Messages
    46
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Janvier 2007
    Messages : 46
    Points : 40
    Points
    40
    Par défaut
    En fait, j'ai trouvé:

    il faut utiliser un classloader unique, et pour ça, il faut mettre l'attribut "UseJBossWebLoader" dans \server\default\deploy\jbossweb-tomcat55.sar\META-INF\jboss-service.xml

    à true. (Je crois que par défaut il est effectivement à true).

    De cette façon on utilise un classLoader unique pour le serveur.

    ... en tout cas, c'est comme ça que je l'ai compris.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Probleme de configuration de JBoss ?
    Par buzu42 dans le forum Wildfly/JBoss
    Réponses: 3
    Dernier message: 23/09/2008, 15h06
  2. Configuration Eclipse JBoss JPA/hibernate
    Par pruderic dans le forum JPA
    Réponses: 2
    Dernier message: 13/08/2008, 09h34
  3. [build.properties] configurer le jboss.dir
    Par Widiwi dans le forum Maven
    Réponses: 8
    Dernier message: 01/06/2007, 16h20
  4. Configuration de Jboss(Sur Windows)
    Par edogawa dans le forum Wildfly/JBoss
    Réponses: 1
    Dernier message: 17/08/2006, 08h23
  5. configuration datasource JBoss
    Par n00noors dans le forum Wildfly/JBoss
    Réponses: 1
    Dernier message: 27/02/2006, 15h49

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