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.
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 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
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 <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 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
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"); } }
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
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>
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
Partager