Bonjour,


J'ai une page de Login qui fait appel à une action LoginAction. J'ai créé une classe Interceptor mais visiblement j'ai des erreurs dès que je démarre mon serveur JBOSS :

Voici mon code :

Struts.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
 
<package name="person" extends="struts-default" namespace="/login">    
 
		<result-types> 
			<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult"/> 
		</result-types>
 
		<global-results>
            <result name="login" type="tiles">login.page</result>
        </global-results>
 
		<interceptors>  
			<interceptor name="logins" class="com.acticall.report.application.action.interceptor.LoginInterceptor" />  
 
             <interceptor-stack name="loginstack">  
                 <interceptor-ref name="defaultStack" />  
                 <interceptor-ref name="logins" />  
             </interceptor-stack>  
 
         </interceptors>  
         <default-interceptor-ref name="loginstack" />         		 		 
 
		<action name="doLogin" class="actionLogin" method="execute">				
			<result name="input" type="tiles">login.page</result>
			<result name="error" type="tiles">login.page</result>					
			<result type="tiles">welcome.page</result>
        </action>      
    </package>
LoginInterceptor
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
 
package com.acticall.report.application.action.interceptor;
 
import java.util.Map;
 
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
 
public class LoginInterceptor implements Interceptor {
 
	private static final long serialVersionUID = 1L;
 
	public void destroy() {			
	}
 
	public void init() {		
	}
 
	@SuppressWarnings("unchecked")
	public String intercept(ActionInvocation invocation) throws Exception {
	    @SuppressWarnings("unused")
		final ActionContext context = invocation.getInvocationContext ();
	    Map session = context.getSession();
 
	    if(session != null){
	    	Boolean isAuthenticated = (Boolean) session.get("isAuthenticated");
	    	if(isAuthenticated != null && !isAuthenticated){
	    		return "login";
	    	}	    	
	    	return invocation.invoke ();
	    }        
	    return invocation.invoke ();
	}
}

Voici mon 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
 
09:42:30,135 INFO  [STDOUT] 23-06-2008 09:42:30:135 5281 DEBUG com.opensymphony.xwork2.config.providers.XmlConfigurationProvider  - Loading action configurations from: struts.xml
09:42:30,151 INFO  [STDOUT] 23-06-2008 09:42:30:151 5297 DEBUG com.opensymphony.xwork2.config.providers.XmlConfigurationProvider  - Loading action configurations from: struts/admin-config.xml
09:42:30,182 INFO  [STDOUT] 23-06-2008 09:42:30:167 5313 ERROR com.opensymphony.xwork2.util.DomHelper  - The content of element type "package" must match "(result-types?,interceptors?,default-interceptor-ref?,default-action-ref?,default-class-ref?,global-results?,global-exception-mappings?,action*)". at (null:32:15)
org.xml.sax.SAXParseException: The content of element type "package" must match "(result-types?,interceptors?,default-interceptor-ref?,default-action-ref?,default-class-ref?,global-results?,global-exception-mappings?,action*)".
	at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
	at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
	at org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(Unknown Source)
	at org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(Unknown Source)
	at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
	at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
	at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
	at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
	at javax.xml.parsers.SAXParser.parse(SAXParser.java:375)
	at com.opensymphony.xwork2.util.DomHelper.parse(DomHelper.java:121)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:830)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadConfigurationFiles(XmlConfigurationProvider.java:864)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.loadDocuments(XmlConfigurationProvider.java:131)
	at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.init(XmlConfigurationProvider.java:100)
	at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultConfiguration.java:130)
	at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:52)
	at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:395)
	at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:452)
	at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:201)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:275)
	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:397)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:108)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3722)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4367)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:790)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:770)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
	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)
Quelqu'un peut il me dire s'il s'agit d'un problème au niveau de mon fichier XML ? visiblement oui mais je ne sais pas ou ......