StackOverflow due à une exception qui ne passe pas par un bloc catch
Bonjour,
J'ai un soucis d'une exception qui se lève lorsque j'attaque une méthode d'un EJB qui doit me retourner une instance d'un objet.
Lorsque la méthode vendorService.getByWorkflowId(this.workflowId); me retourne bien une instance d'un objet , je n'ai pas de soucis. Seulement lorsque le workflow n'existe pas une exception est renvoyée ( du moins c'est ce que l'interface me dit ) et devrait être normalement renvoyée. Ce que je souhaiterais faire est de renvoyer un message sur ma page. Seulement ni la page est affichée et j'ai ceci qui s'affiche.
J'ai beau cherché , je n'arrive pas à trouver de solution.
Le problème à la source est que je recois un id qui initialise un attribut de mon managedBean. A partir de cette id , je dois également initialisé un autre objet afin que celui-ci puisse être exploité dans ma page jsf.
Code:
1 2 3 4 5
|
java.lang.StackOverflowError
at java.lang.ClassLoader.checkPackageAccess(ClassLoader.java:336)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:522)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) |
Il semblerait que l'exception ne passe pas dans mon bloc catch ( j'ai tenté avec Exception à la place de BusinnessException).
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
<managed-bean>
<managed-bean-name>approverBean</managed-bean-name>
<managed-bean-class>com.agc.sapvendor.ApproverBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>vendorService</property-name>
<value>#{VendorService}</value>
</managed-property>
<!-- This must come after the vendor service -->
<managed-property>
<property-name>workflowId</property-name>
<value>#{param.workflowId}</value>
</managed-property>
</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 class ApproverBean {
.....
private Vendor vendor;
.....
public Vendor getVendor(){
if (workflowId != null){
workFlow = findWorkflow();
this.vendor = workFlow.getVendor();
this.requestedVendorId = vendor.getId();
}
return vendor;
}
private Workflow findWorkflow(){
Workflow wk = null;
try{
logger.debug("try to find workflow :"+this.workflowId);
wk = vendorService.getByWorkflowId(this.workflowId);
logger.debug("Find workflow :"+wk);
}catch(BusinessException e){
logger.debug("Worflow Not exist");
FacesContext.getCurrentInstance().addMessage( null, new FacesMessage( FacesMessage.SEVERITY_ERROR, translator.translate( "message.data-no-exist" ), null ) );
}finally{
return wk;
}
} |
Code:
1 2
|
public Workflow getByWorkflowId( String id ) throws BusinessException; |
Code:
1 2 3 4
|
SEVERE: [WorkflowDao:public com.agc.sapvendor.model.Workflow com.agc.sapvendor.dao.WorkflowDaoImpl.getById(java.lang.String)] exception occurred during method invocation: javax.ejb.TransactionRolledbackLocalException: javax.persistence.NoResultException: getSingleResult() did not retrieve any entities.; nested exception is: javax.persistence.NoResultException: getSingleResult() did not retrieve any entities.
javax.ejb.TransactionRolledbackLocalException: javax.persistence.NoResultException: getSingleResult() did not retrieve any entities.; nested exception is: javax.persistence.NoResultException: getSingleResult() did not retrieve any entities.
javax.persistence.NoResultException: getSingleResult() did not retrieve any entities. |