Erreur au commit sur une BDD ( IceFaces,Tomcat6, Spring, JPA/Hibernate )
Bonjour, j'obtiens l'erreur ci-dessous lorsque je souhaite faire un commit d'une modif sur une BdD gérée sous Spring avec JPA/Hibernate. La lecture se passe correctement l'application est Ok mais un commit me génère l'erreur. Débutant dans le système la lecture du log est assez complexe, je vois qu'il y a lyfeCycle .... y-a-t-il un rapport ? Ou peut être que ma persistence n'est pas bien configurée mais que ça passe qd même tant qu'on est en lecture ?!?! Est ce que vous avez une idée ? Est ce que des tests particuliers seraient bons à faire ici ? Est ce que cela vient d'une mauvaise mise en place de la gestion des transactions par Spring car je désire être en managé.
Merci
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
|
11 mai 2009 09:42:19 com.sun.faces.lifecycle.InvokeApplicationPhase execute
ATTENTION: java.lang.NullPointerException
javax.faces.el.EvaluationException: java.lang.NullPointerException
at com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
at javax.faces.component.UICommand.broadcast(UICommand.java:380)
at com.icesoft.faces.component.panelseries.UISeries$RowEvent.broadcast(UISeries.java:559)
at com.icesoft.faces.component.panelseries.UISeries.broadcast(UISeries.java:238)
at javax.faces.component.UIData.broadcast(UIData.java:938)
at com.icesoft.faces.component.panelseries.UISeries.broadcast(UISeries.java:233)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:475)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:756)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at com.icesoft.faces.webapp.http.core.JsfLifecycleExecutor.apply(JsfLifecycleExecutor.java:17)
at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.renderCycle(ReceiveSendUpdates.java:94)
at com.icesoft.faces.webapp.http.core.ReceiveSendUpdates.service(ReceiveSendUpdates.java:54)
at com.icesoft.faces.webapp.http.core.RequestVerifier.service(RequestVerifier.java:26)
at com.icesoft.faces.webapp.http.common.standard.PathDispatcherServer.service(PathDispatcherServer.java:24)
at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:160)
at com.icesoft.faces.webapp.http.servlet.SessionDispatcher$1.service(SessionDispatcher.java:38)
at com.icesoft.faces.webapp.http.servlet.ThreadBlockingAdaptingServlet.service(ThreadBlockingAdaptingServlet.java:19)
at com.icesoft.faces.webapp.http.servlet.EnvironmentAdaptingServlet.service(EnvironmentAdaptingServlet.java:63)
at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:55)
at com.icesoft.faces.webapp.http.servlet.SessionVerifier.service(SessionVerifier.java:19)
at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:23)
at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:91)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at com.icesoft.faces.webapp.xmlhttp.BlockingServlet.service(BlockingServlet.java:56)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.NullPointerException
at aa.PersonneBean.commit(PersonneBean.java:90)
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:597)
at org.apache.el.parser.AstValue.invoke(AstValue.java:172)
at org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
at com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:88)
... 37 more
11 mai 2009 09:42:19 com.sun.faces.lifecycle.Phase doPhase
GRAVE: JSF1054: (Phase ID: INVOKE_APPLICATION 5, View ID: /Page1.jsp) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@e776f7] |
un objet non référencié ?
A priori, il semblerait que le pb vienne de la référence sur l'objet service injecté par IOC JSF. En effet, j'ai retiré le code du commit pour ne faire afficher QUE un string "test ok" et le message d'erreur persiste.
Dans mon faces-config.xml
Code:
1 2 3 4 5 6 7 8 9 10 11 12
|
(......)
<managed-bean>
<managed-bean-name>PersonneBean</managed-bean-name>
<managed-bean-class>aa.PersonneBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>service</property-name>
<value>#{service}</value>
</managed-property>
</managed-bean>
(......) |
Dans mon managed bean
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
|
public void commit(ActionEvent e) throws IOException{
String strTest="";
FileHandler fh = new FileHandler("log.out");
// Send logger output to FileHandler.
logger.addHandler(fh);
// Log all
logger.setLevel(Level.FINE);
//Personne persResult=null;
String strMessage = "DEBUT DEBUG TEST";
logger.log(Level.FINE, strMessage);
personne.setPrenom(tempPrenom);
personne.setNom(tempNom);
strMessage = "Prénom : "+personne.getPrenom();
logger.log(Level.FINE, strMessage);
strMessage = "nom : "+personne.getNom();
logger.log(Level.FINE, strMessage);
strTest=service.getTest();
//Personne persResult = service.updateOne(personne);
logger.log(Level.FINE, strTest);
expanded = !expanded;
} |
L'implémentation de service est réalisée via l'interface IService
Code:
1 2
|
public String getTest(); |
implémenté dans Service
Code:
1 2 3 4
|
public String getTest(){
return "test service ok";
} |
Les injections sont vérifiées correctes donc rien de ce côté-là, le scope session de PersonneBean .... ben pour le moment j'ai mis ça mais je devrais probablement passer en scope Request ... pas d'impact sur mon Pb actuel
Donc même en ne voulant afficher dans le log QUE le résultat de getTest() j'ai le NullPointer exception ..... Qqn a une idée du pourquoi ?!?! :?