File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes Injection of EJB into CDI Bean call of method not allowed. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Injection of EJB into CDI Bean call of method not allowed." Watch "Injection of EJB into CDI Bean call of method not allowed." New topic
Author

Injection of EJB into CDI Bean call of method not allowed.

Markus Schmider
Ranch Hand

Joined: Feb 25, 2007
Posts: 103
Hello,
In an JEE6 webprofile project, using JBoss EAP 6.1:

I have a CDI Bean:


and an SLSB:


When I call doCreate() I get
javax.servlet.ServletException: javax.ejb.EJBAccessException: JBAS014502: Aufruf an Methode: public abstract void de.dpunkt.myaktion.services.OrganisatorDAO.save(de.dpunkt.myaktion.model.Organisator) von Bean: OrganisatorDAOBean ist nicht gestattet
javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)

which translates to: call of method: .... from Bean ... is not allowed

What is my mistake?

Many thanks for any input
Markus Schmider
Ranch Hand

Joined: Feb 25, 2007
Posts: 103
After adding

@PermitAll
public void save(Organisator organisator)

the error disappears. I don't why I have add this annotation since I have no other security annotations on this bean.
The next problem is that all fields of my Organisator Entiy are empty when I try to save it. The relevant JSF code is:
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16022
    
  20

Standard warning: JSF Backing Beans are not Controllers. You do not code Controllers when using JSF as they are pre-written parts of the JSF framework itself. Backing beans are always Models.

As to why you were getting that error: my wager is that you aren't actually seeing a JSF problem, but rather an EJB problem. EJB provides security mechanisms at the per-method level for its bean methods and apparently your EJB was not configured with sufficient permissions. The @PermitAll changed the rules being applied to allow the method to be invoked.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Injection of EJB into CDI Bean call of method not allowed.