salut
j'essaye d'appliquer un exemple application web avec spring et hibernate
mais j'ai une erreur
voila la page que j'essaye d'y accéder:
Authentification.jsp
Code :
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
<%-- 
   Document   : Authentification
   Created on : 25 janv. 2010, 21:30:57
   Author     : user
--%>
<%@taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
<%@taglib uri="http://richfaces.org/rich" prefix="rich"%>
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<f:view>
   <h:form>
       <html>
           <head>
               <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
               <title>Authentification</title>
           </head>
           <body >
               <rich:spacer height="200px"></rich:spacer>
               <center >
                   <rich:panel id="logpan" style="background-image:url(#{facesContext.externalContext.requestContextPath}/images/ajax/userauth.png);
                               background-repeat:no-repeat;background-position:-35px -15px;
                               ;width:400px;" header="Authentification" styleClass="panel_3">
                       <h:panelGrid columns="3">
                           <h:outputText value="Login:" />
                           <h:inputText id="log"  value="#{LoginBean.login}" required="true"
                                        requiredMessage="champs obligatoire" />
                           <rich:message for="log" style="color: red"/>
                           <h:outputText value="Mot de passe :" />
                           <h:inputSecret  id="mdp" value="#{LoginBean.password}" required="true"
                                           requiredMessage="champs obligatoire" />
                           <rich:message for="mdp" style="color: red"/>
                       </h:panelGrid>
                       <rich:spacer height="30px"></rich:spacer>
                       <a4j:commandButton value ="Connexion" action="#{LoginBean.connecter}" reRender="logpan"/>
                   </rich:panel>
               </center>
           </body>
       </html>
   </h:form>
</f:view>
application-context.xml
Code :
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
<?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/spring-aop-2.5.xsd"
       xmlns:tx="http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"
       xmlns:p="http://www.springframework.org/schema/p"
 
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
          http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/aop/spring-aop-2.5.xsd/spring-spring-aop-2.5.xsd-3.1.1.RELEASE.xsd
          http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/tx/spring-tx-2.5.xsd/spring-spring-tx-2.5.xsd-3.1.1.RELEASE.xsd
">
 
 <!--Data Source Definition-->
   <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
       <property name="driverClassName">
           <value>com.mysql.jdbc.Driver</value>
       </property>
       <property name="url">
           <value>jdbc:mysql://localhost:3306/gestion_parc</value>
       </property>
       <property name="username">
           <value>root</value>
       </property>
       <property name="password">
           <value>0800752</value>
       </property>
   </bean>
     <!--Hibernate Session Factory Definition-->
   <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
       <property name="mappingResources">
           <list>
               <value>Mapping/Equipement.hbm.xml</value>
               <value>Mapping/Interventions.hbm.xml</value>
               <value>Mapping/Personnel.hbm.xml</value>
               <value>Mapping/Service.hbm.xml</value>
           </list>
       </property>
       <property name="hibernateProperties">
           <props>
               <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
               <prop key="hibernate.show_sql">true</prop>
               <prop key="hibernate.cglib.use_reflection_optimizer">true</prop>
               <prop key="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</prop>
           </props>
       </property>
       <property name="dataSource">
           <ref bean="dataSource"/>
       </property>
   </bean>
       <!--Spring Data Access Exception Translator Defintion-->
   <bean id="jdbcExceptionTranslator" class="org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator">
       <property name="dataSource">
           <ref bean="dataSource"/>
       </property>
   </bean>
   <!--Hibernate Template Defintion-->
   <bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
       <property name="sessionFactory">
           <ref bean="sessionFactory"/>
       </property>
       <property name="jdbcExceptionTranslator">
           <ref bean="jdbcExceptionTranslator"/>
       </property>
   </bean>
 
   <!--Hibernate Transaction Manager Definition-->
   <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
       <property name="sessionFactory">
           <ref local="sessionFactory"/>
       </property>
   </bean>
   <!--========================= Start of DAO BEANS DEFINITIONS =========================-->
   <bean id="serviceDao" class="Implementation.dao.ServiceDaoImpl">
       <property name="hibernateTemplate" ref="hibernateTemplate"/>
   </bean>
   <bean id="persDao" class="Implementation.dao.PersonnelDaoImpl">
       <property name="hibernateTemplate" ref="hibernateTemplate"/>
   </bean>
   <bean id="equipDao" class="Implementation.dao.EquipementDaoImpl">
       <property name="hibernateTemplate" ref="hibernateTemplate"/>
   </bean>
   <bean id="intervDao" class="Implementation.dao.InterventionsDaoImpl">
       <property name="hibernateTemplate" ref="hibernateTemplate"/>
   </bean>
   <!--========================= Start of SERVICE BEANS DEFINITIONS =========================-->
   <bean id="servService" class="Implementation.service.ServiceServiceImpl">
       <property name="serviceDao" ref="serviceDao"/>
   </bean>
   <bean id="persService" class="Implementation.service.PersonnelServiceImpl">
       <property name="personnelDao" ref="persDao"/>
   </bean>
   <bean id="equipService" class="Implementation.service.EquipementServiceImpl">
       <property name="equipDao" ref="equipDao"/>
   </bean>
   <bean id="intervService" class="Implementation.service.InterventionsServiceImpl">
       <property name="intervDao" ref="intervDao"/>
   </bean>
   <bean id="loginDao" class="Implementation.dao.AuthenticationDaoImpl">
       <property name="hibernateTemplate" ref="hibernateTemplate"/>
   </bean>
 
<bean id="loginService" class="Implementation.service.AuthenticationServiceImpl">
       <property name="loginDao" ref="loginDao"/>
   </bean>
</beans>
web.xml
Code :
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
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" 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-app_3_0.xsd">
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param>
    <filter>
        <display-name>RichFaces Filter</display-name>
        <filter-name>richfaces</filter-name>
        <filter-class>org.ajax4jsf.Filter</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>richfaces</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
    </filter-mapping>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <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>*.faces</url-pattern>
    </servlet-mapping>
 
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>Authentification.jsp</welcome-file>
    </welcome-file-list>
</web-app>
Erreur:
Code :
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
Grave: Servlet.service() for servlet [jsp] in context with path [/Essai] threw exception [java.lang.NullPointerException] with root cause
java.lang.NullPointerException
	at javax.faces.webapp.UIComponentClassicTagBase.setJspId(UIComponentClassicTagBase.java:1858)
	at org.apache.jsp.Authentification_jsp._jspx_meth_f_005fview_005f0(Authentification_jsp.java:125)
	at org.apache.jsp.Authentification_jsp._jspService(Authentification_jsp.java:101)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
	at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
	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:225)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1770)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:722)
Merci pour votre aide