Bonjour tout le monde;
Je suis entrain de réaliser une application web avec les frameworks spring,hibernate,jsf.
j'ai essayé de créer une simple page d'affichage des données d'une table de la base de données mais il m'affiche cette 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
 
Avertissement: /login.xhtml @40,114 value="#{collaborateurBean.matricule}": Target Unreachable, identifier 'collaborateurBean' resolved to null
javax.el.PropertyNotFoundException: /login.xhtml @40,114 value="#{collaborateurBean.matricule}": Target Unreachable, identifier 'collaborateurBean' resolved to null
	at com.sun.faces.facelets.el.TagValueExpression.getType(TagValueExpression.java:93)
	at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:95)
	at javax.faces.component.UIInput.getConvertedValue(UIInput.java:1008)
	at javax.faces.component.UIInput.validate(UIInput.java:934)
	at javax.faces.component.UIInput.executeValidate(UIInput.java:1189)
	at javax.faces.component.UIInput.processValidators(UIInput.java:691)
	at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1080)
	at javax.faces.component.UIForm.processValidators(UIForm.java:243)
	at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1080)
	at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1080)
	at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:1179)
	at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:76)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:310)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
	at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
	at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
	at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
	at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
	at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)
Voilà le contenu des différents fichiers:

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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
 
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
  <display-name>Evaluation des collaborateurs</display-name>
    <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
  <listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
  </listener>
 
  <context-param>
    <param-name>javax.faces.CONFIG_FILES</param-name>
    <param-value>/WEB-INF/faces-config.xml</param-value>
  </context-param>
  <context-param>
    <param-name>javax.faces.PROJECT_STAGE</param-name>
    <param-value>Production</param-value>
  </context-param>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.jsf</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
  </servlet-mapping>
  <servlet>
    <servlet-name>PdfServlet</servlet-name>
    <servlet-class>net.sf.jasperreports.j2ee.servlets.PdfServlet</servlet-class>
  </servlet>
  <!-- SPRING SECURITY -->
  <servlet>
		<servlet-name>mvc-dispatcher</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
  	<servlet-mapping>
		<servlet-name>mvc-dispatcher</servlet-name>
		<url-pattern>/WEB-INF</url-pattern>
	</servlet-mapping>
  	<filter>  
        <filter-name>springSecurityFilterChain</filter-name>  
        <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>  
    </filter>  
    <filter-mapping>  
        <filter-name>springSecurityFilterChain</filter-name>  
        <url-pattern>/*</url-pattern>  
    </filter-mapping> 
    
     <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:application-contexte.xml
    </param-value>
    </context-param>
</web-app>
application-contexte.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
 
<?xml version="1.0" encoding="UTF-8"?>
<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:context="http://www.springframework.org/schema/context"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
 
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
  <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />
  <property name="url" value="jdbc:oracle:thin:@localhost:1521:XE" />
  <property name="username" value="ighachane" />
  <property name="password" value="ighachane" />
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
	<property name="dataSource" ref="dataSource" />
  	<property name="annotatedClasses">
   		<list>
   			<value>com.oc.classes.AssiduiteEtAbsences</value>
      		<value>com.oc.classes.Collaborateur</value>
      		<value>com.oc.classes.Concerne2 </value>
      		<value>com.oc.classes.Concerne4</value>
      		<value>com.oc.classes.Concerne5</value>
      		<value>com.oc.classes.Concerne6</value>
      		<value>com.oc.classes.Concerne7</value>
      		<value>com.oc.classes.Concerne8</value>
      		<value>com.oc.classes.Departement</value>
      		<value>com.oc.classes.Division</value>
      		<value>com.oc.classes.Fiche</value>
      		<value>com.oc.classes.Formation</value>
      		<value>com.oc.classes.Management</value>
      		<value>com.oc.classes.ObjectifN1</value>
      		<value>com.oc.classes.ObjectifsPreetablies</value>
      		<value>com.oc.classes.Satisfaction</value>
      		<value>com.oc.classes.SatisfactionActionsexceptionn</value>
      		<value>com.oc.classes.SatisfactionAtteintedesobject</value>
      		<value>com.oc.classes.SatisfactionAutonomie</value>
      		<value>com.oc.classes.SatisfactionCapacitedanalysee</value>
      		<value>com.oc.classes.SatisfactionConnaissancesetco</value>
      		<value>com.oc.classes.SatisfactionDisponibiliteetim</value>
      		<value>com.oc.classes.SatisfactionInnovation</value>
      		<value>com.oc.classes.SatisfactionProjet</value>
      		<value>com.oc.classes.SatisfactionQualite</value>
      		<value>com.oc.classes.SatisfactionRespectdelareglem</value>
      		<value>com.oc.classes.Service</value>
      		<value>com.oc.classes.TenueDePoste</value>
 
    	</list>
  	</property>
  	<property name="hibernateProperties">
    	<props>
      		<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
    	</props>
  	</property>
</bean>
 
<bean id="transactionManager"
    class="org.springframework.orm.hibernate3.HibernateTransactionManager" >
  <property name="sessionFactory" ref="sessionFactory" />
</bean>
 
<tx:annotation-driven transaction-manager="transactionManager" />
<context:annotation-config/>
<context:component-scan base-package="com.oc.springSec"></context:component-scan>
<bean
		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="prefix">
			<value>/WebContent/</value>
		</property>
		<property name="suffix">
			<value>.jsf</value>
		</property>
	</bean>
<bean id="messageSource"
		class="org.springframework.context.support.ResourceBundleMessageSource">
		<property name="basenames">
			<list>
				<value>mymessages</value>
			</list>
		</property>
</bean>
 
</beans>
faces-config.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
 
<?xml version="1.0" encoding="UTF-8"?>
 
<faces-config
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
    version="2.0">
 
    <application>
		<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
	</application>
 
 
 
</faces-config>
hibernate.cfg.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
 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
		"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
		"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory>
        <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
        <property name="hibernate.connection.password">ighachane</property>
        <property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:XE</property>
        <property name="hibernate.connection.username">IGHACHANE</property>
        <property name="hibernate.default_schema">IGHACHANE</property>
        <property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
    </session-factory>
</hibernate-configuration>
CollaborateurBean.java
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
 
/**
 * 
 */
package com.oc.web;
 
import java.io.Serializable;
import java.util.List;
 
import javax.annotation.ManagedBean;
import javax.annotation.PostConstruct;
import javax.faces.bean.SessionScoped;
 
import org.primefaces.component.datatable.DataTable;
import org.primefaces.model.chart.CartesianChartModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
 
import com.oc.classes.Collaborateur;
import com.oc.services.CollaborateurService;
 
/**
 * @author ighachane
 *
 */
@SuppressWarnings("serial")
@Component("collaborateurBean")
@Scope("session")
public class CollaborateurBean implements Serializable {
 
	private String matricule;
	private String motDePasse;
 
	@Autowired
	private transient CollaborateurService collaborateurService;
	private transient DataTable collaborateurTable;
	private List<Collaborateur> collaborateurList;
 
 
	@PostConstruct
	public void init(){
 
		System.out.println("entrer dans init");
		collaborateurList=collaborateurService.findAll();
		System.out.println("le nombre de collaborateur="+collaborateurList.size());
	}
 
 
	public String getMatricule() {
		return matricule;
	}
 
 
	public void setMatricule(String matricule) {
		this.matricule = matricule;
	}
 
 
	public String getMotDePasse() {
		return motDePasse;
	}
 
 
	public void setMotDePasse(String motDePasse) {
		this.motDePasse = motDePasse;
	}
 
 
	public CollaborateurService getCollaborateurService() {
		return collaborateurService;
	}
 
 
	public void setCollaborateurService(CollaborateurService collaborateurService) {
		this.collaborateurService = collaborateurService;
	}
 
 
	public DataTable getCollaborateurTable() {
		return collaborateurTable;
	}
 
 
	public void setCollaborateurTable(DataTable collaborateurTable) {
		this.collaborateurTable = collaborateurTable;
	}
 
 
	public List<Collaborateur> getCollaborateurList() {
		return collaborateurList;
	}
 
 
	public void setCollaborateurList(List<Collaborateur> collaborateurList) {
		this.collaborateurList = collaborateurList;
	}
 
 
	public String login(){
		Collaborateur ad=new Collaborateur(matricule,motDePasse);
		Boolean exist=collaborateurList.contains(ad);
		System.out.println(matricule);
		System.out.println(motDePasse);
		System.out.println(exist);
		if(exist){
 
					return "success";
					}
		else return "failure";
	}
}
CollaborateurServiceImpl
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
 
/**
 * 
 */
package com.oc.web;
 
import java.io.Serializable;
import java.util.List;
 
import javax.annotation.ManagedBean;
import javax.annotation.PostConstruct;
import javax.faces.bean.SessionScoped;
 
import org.primefaces.component.datatable.DataTable;
import org.primefaces.model.chart.CartesianChartModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
 
import com.oc.classes.Collaborateur;
import com.oc.services.CollaborateurService;
 
/**
 * @author ighachane
 *
 */
@SuppressWarnings("serial")
@Component("collaborateurBean")
@Scope("session")
public class CollaborateurBean implements Serializable {
 
	private String matricule;
	private String motDePasse;
 
	@Autowired
	private transient CollaborateurService collaborateurService;
	private transient DataTable collaborateurTable;
	private List<Collaborateur> collaborateurList;
 
 
	@PostConstruct
	public void init(){
 
		System.out.println("entrer dans init");
		collaborateurList=collaborateurService.findAll();
		System.out.println("le nombre de collaborateur="+collaborateurList.size());
	}
 
 
	public String getMatricule() {
		return matricule;
	}
 
 
	public void setMatricule(String matricule) {
		this.matricule = matricule;
	}
 
 
	public String getMotDePasse() {
		return motDePasse;
	}
 
 
	public void setMotDePasse(String motDePasse) {
		this.motDePasse = motDePasse;
	}
 
 
	public CollaborateurService getCollaborateurService() {
		return collaborateurService;
	}
 
 
	public void setCollaborateurService(CollaborateurService collaborateurService) {
		this.collaborateurService = collaborateurService;
	}
 
 
	public DataTable getCollaborateurTable() {
		return collaborateurTable;
	}
 
 
	public void setCollaborateurTable(DataTable collaborateurTable) {
		this.collaborateurTable = collaborateurTable;
	}
 
 
	public List<Collaborateur> getCollaborateurList() {
		return collaborateurList;
	}
 
 
	public void setCollaborateurList(List<Collaborateur> collaborateurList) {
		this.collaborateurList = collaborateurList;
	}
 
 
	public String login(){
		Collaborateur ad=new Collaborateur(matricule,motDePasse);
		Boolean exist=collaborateurList.contains(ad);
		System.out.println(matricule);
		System.out.println(motDePasse);
		System.out.println(exist);
		if(exist){
 
					return "success";
					}
		else return "failure";
	}
}
Merci pour votre temps