• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

cannot inject ejb into jsf application in wildfly  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
author
Posts: 194
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Heiko Wiesner
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
On top of spaghetti all covered in cheese, there was this tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!