wood burning stoves*
The moose likes JBoss/WildFly and the fly likes cannot inject ejb into jsf application in wildfly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "cannot inject ejb into jsf application in wildfly" Watch "cannot inject ejb into jsf application in wildfly" New topic

cannot inject ejb into jsf application in wildfly

Heiko Wiesner

Joined: Mar 18, 2014
Posts: 3

i want to use an ejb from a framework in a jsf application.
the framework hannymede is deployed as an ear.
the webapp is deployed in a seperate war.

Here the jndi names:


Here my EJB Client Class:

I tried all the names from the jndi names list as @EJB(name="...").

but always get Caused by: java.lang.RuntimeException: javax.naming.NameNotFoundException: ejb/GenericFactoryBean

How can i reference the ejb?

best regards

Francesco Marchioni
Ranch Hand

Joined: Sep 22, 2003
Posts: 190
assumed that you have correctly solved the dependencies to the EJB Contained in the EAR file (for example including in the Web application Dependencies: deployment.YouEarApp.ear.YourEJBApp.jar) then there is no need to specify the EJB name, it should work out of the box with:

Besides this, the JNDI name you specified is uncorrect. For an external application you had to specify the java:/app namespace (if you really need to do it):


WildFly 8 Administration Book - JBoss Tutorials
Heiko Wiesner

Joined: Mar 18, 2014
Posts: 3
Thank you for your answer.

When i include the ejb's in my war - it works, but i want to have the framework in it's own ear cause i want to use it in other Apps too.

The java:app namespace does unfortunately not work.

What do you mean with correctly solved the dependencies? I referenced it in maven as provided.

best regards

Heiko Wiesner

Joined: Mar 18, 2014
Posts: 3

for all with the same problem: mappedName was the problem.
Following worked for me:

@EJB(mappedName = "java:jboss/exported/hannymede-server-ear-0.0.2-SNAPSHOT/hannymede-server-ejb/GenericFactory!de.itwiesner.hannymede.common.interfaces.GenericFactoryBeanRemote")

best regards
It is sorta covered in the JavaRanch Style Guide.
subject: cannot inject ejb into jsf application in wildfly
Similar Threads
How does Jboss 7 AS registers JNDI
Getting "No EJB receiver available for handling [appName:,modulename:EJB3TimerService,distinctname:]
Problem with EJB lookup on JBoss 7.1
EJB naming environment related questions ?
EJB JNDI lookup not working