This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android 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
Author

cannot inject ejb into jsf application in wildfly

Heiko Wiesner
Greenhorn

Joined: Mar 18, 2014
Posts: 3
Hello,

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:

java:global/hannymede-server-ear-0.0.2-SNAPSHOT/hannymede-server-ejb-0.0.2-SNAPSHOT/GenericFactoryBean!de.itwiesner.hannymede.common.interfaces.GenericFactoryBeanLocal
java:app/hannymede-server-ejb-0.0.2-SNAPSHOT/GenericFactoryBean!de.itwiesner.hannymede.common.interfaces.GenericFactoryBeanLocal
java:module/GenericFactoryBean!de.itwiesner.hannymede.common.interfaces.GenericFactoryBeanLocal
java:global/hannymede-server-ear-0.0.2-SNAPSHOT/hannymede-server-ejb-0.0.2-SNAPSHOT/GenericFactoryBean!de.itwiesner.hannymede.common.interfaces.GenericFactoryBeanRemote
java:app/hannymede-server-ejb-0.0.2-SNAPSHOT/GenericFactoryBean!de.itwiesner.hannymede.common.interfaces.GenericFactoryBeanRemote
java:module/GenericFactoryBean!de.itwiesner.hannymede.common.interfaces.GenericFactoryBeanRemote
java:jboss/exported/hannymede-server-ear-0.0.2-SNAPSHOT/hannymede-server-ejb-0.0.2-SNAPSHOT/GenericFactoryBean!de.itwiesner.hannymede.common.interfaces.GenericFactoryBeanRemote

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

Heiko
Francesco Marchioni
author
Ranch Hand

Joined: Sep 22, 2003
Posts: 190
Hi,
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):


Regards
Francesco


WildFly 8 Administration Book - JBoss Tutorials
Heiko Wiesner
Greenhorn

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
Heiko Wiesner
Greenhorn

Joined: Mar 18, 2014
Posts: 3
Hello,

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cannot inject ejb into jsf application in wildfly
 
Similar Threads
Problem with EJB lookup on JBoss 7.1
How does Jboss 7 AS registers JNDI
EJB JNDI lookup not working
Getting "No EJB receiver available for handling [appName:,modulename:EJB3TimerService,distinctname:]
EJB naming environment related questions ?