Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Markus Schmider
Ranch Hand
Posts: 128
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 128
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18093
48
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic