Débutant JSF: Probleme avec Managed Bean (JSF)..
Bonjour à tous,
J'utilise Netbeans 6.1 + Glassfish v2 + JSF
Ma question: A part face-config et sun-web.xml créé comme décrit ci-dessous, y a t-il un paramétrage à faire avant d'utiliser un ManagedBean?
Merci du temps consacré à me répondre.
==============
J'ai fait une page evaluations.jsp ou j'utilise un bean managé evaluationController
pour afficher les lignes d'une table de BD dans un tableau.
ce bean est déclaré dans face-config.xml comme suit:
Code:
1 2 3 4 5
| <managed-bean>
<managed-bean-name>evaluationController</managed-bean-name>
<managed-bean-class>com.petrone.controller.EvaluationController</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean> |
===================
Mon fichier sun-web.xml
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
<sun-web-app error-url="">
<context-root>/TEST-war</context-root>
<ejb-ref>
<ejb-ref-name>java:comp/env/com.petrone.controller.EvaluationController/evaluationLocal</ejb-ref-name>
<jndi-name>EvaluationBeanBis</jndi-name>
</ejb-ref>
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</sun-web-app> |
====================
Ma classe Evaluation Controller
Code:
1 2 3 4 5 6
| package com.petrone.controller;
public class EvaluationController extends Controller{
@EJB
private EvaluationLocal evaluationLocal;
private List<Evaluation> evaluations; |
===================J'ai le message suivant quand j'essaie d'excuter ma page
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
| This web app [C:\TEST\TEST-war\build\web] has no ejb reference by the name of [java:comp/env/com.petrone.controller.EvaluationController/evaluationLocal]
Cannot resolve reference Unresolved Ejb-Ref com.petrone.controller.EvaluationController/evaluationLocal@jndi: @null@com.petrone.business.evaluation.EvaluationLocal@Session@null
Exception occured in J2EEC Phasejava.lang.RuntimeException: Cannot resolve reference Unresolved Ejb-Ref com.petrone.controller.EvaluationController/evaluationLocal@jndi: @null@com.petrone.business.evaluation.EvaluationLocal@Session@null
com.sun.enterprise.deployment.backend.IASDeploymentException: Error loading deployment descriptors for module [TEST-war] -- Cannot resolve reference Unresolved Ejb-Ref com.petrone.controller.EvaluationController/evaluationLocal@jndi: @null@com.petrone.business.evaluation.EvaluationLocal@Session@null
at com.sun.enterprise.deployment.backend.Deployer.loadDescriptors(Deployer.java:390)
at com.sun.enterprise.deployment.backend.ModuleDeployer.loadDescriptors(ModuleDeployer.java:423)
at com.sun.enterprise.deployment.backend.WebModuleDeployer.deploy(WebModuleDeployer.java:157)
at com.sun.enterprise.deployment.backend.ModuleDeployer.doRequestFinish(ModuleDeployer.java:179)
at com.sun.enterprise.deployment.phasing.J2EECPhase.runPhase(J2EECPhase.java:191)
at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:108)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:919)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:279)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:788)
at com.sun.enterprise.management.deploy.DeployThread.deploy(DeployThread.java:187)
at com.sun.enterprise.management.deploy.DeployThread.run(DeployThread.java:223)
Caused by: java.lang.RuntimeException: Cannot resolve reference Unresolved Ejb-Ref com.petrone.controller.EvaluationController/evaluationLocal@jndi: @null@com.petrone.business.evaluation.EvaluationLocal@Session@null
at com.sun.enterprise.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:430)
at com.sun.enterprise.deployment.WebBundleDescriptor.visit(WebBundleDescriptor.java:1406)
at com.sun.enterprise.deployment.archivist.WebArchivist.validate(WebArchivist.java:188)
at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openArchive(ApplicationArchivist.java:790)
at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openArchive(ApplicationArchivist.java:744)
at com.sun.enterprise.deployment.backend.Deployer.loadDescriptors(Deployer.java:349)
... 10 more
This web app [C:\TEST\TEST-war\build\web] has no ejb reference by the name of [java:comp/env/com.petrone.controller.EvaluationController/evaluationLocal] |
=========================j'ai utilisé la commande verify sur le projet Web
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13
|
Could not verify successfully.
java.lang.RuntimeException: Cannot resolve reference Unresolved Ejb-Ref com.petrone.controller.EvaluationController/evaluationLocal@jndi: @null@com.petrone.business.evaluation.EvaluationLocal@Session@null
at com.sun.enterprise.deployment.util.EjbBundleValidator.accept(EjbBundleValidator.java:430)
at com.sun.enterprise.deployment.WebBundleDescriptor.visit(WebBundleDescriptor.java:1406)
at com.sun.enterprise.deployment.archivist.WebArchivist.validate(WebArchivist.java:188)
at com.sun.enterprise.deployment.archivist.ApplicationArchivist.openArchive(ApplicationArchivist.java:790)
at com.sun.enterprise.tools.verifier.VerificationHandler.createApplicationDescriptor0(VerificationHandler.java:464)
at com.sun.enterprise.tools.verifier.VerificationHandler.createApplicationDescriptor(VerificationHandler.java:265)
at com.sun.enterprise.tools.verifier.VerificationHandler.initStandalone(VerificationHandler.java:216)
at com.sun.enterprise.tools.verifier.VerificationHandler.<init>(VerificationHandler.java:109)
at com.sun.enterprise.tools.verifier.Verifier.verify(Verifier.java:140)
at com.sun.enterprise.tools.verifier.Verifier.main(Verifier.java:114) |
Edit par romaintaz : pensez à :tagcode: :D