Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code forum!
  • 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

WildFly, OpenEJB and simple ejb application

 
Ranch Hand
Posts: 89
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Everyone,

Could someone please help to cope with JNDI naming in WildFly? I have deployed a simple stateless session bean into WildFly AS. The output of the server is as follows:

java:global/firstejb/EmployeeServiceBean!com.sze.ejb.EmployeeService
java:app/firstejb/EmployeeServiceBean!com.sze.ejb.EmployeeService
java:module/EmployeeServiceBean!com.sze.ejb.EmployeeService
java:jboss/exported/firstejb/EmployeeServiceBean!com.sze.ejb.EmployeeService
java:global/firstejb/EmployeeServiceBean
java:app/firstejb/EmployeeServiceBean
java:module/EmployeeServiceBean

My bean is a simple transaction scoped stateless session bean with container-managed transaction demarcation:



It has a remote view, so the clients are able to get a reference to it from a separate JVM. My remote client has the following code:



This code works fine with OpenEJB when I specify an OpenEJB context factory. But in WildFly I am always getting the following error:

javax.naming.NameNotFoundException: global/firstejb/EmployeeServiceBean!com.sze.ejb.EmployeeService -- service jboss.naming.context.java.jboss.exported.global.firstejb."EmployeeServiceBean!com.sze.ejb.EmployeeService"
at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:104)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:202)
at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:179)
at org.jboss.naming.remote.protocol.v1.Protocol$1.handleServerMessage(Protocol.java:127)
at org.jboss.naming.remote.protocol.v1.RemoteNamingServerV1$MessageReciever$1.run(RemoteNamingServerV1.java:73)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
 
Sergei Zhylinski
Ranch Hand
Posts: 89
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for everyone, who has read the topic and is willing to help. I managed to cope with this by myself. I should have read this article first. I have also found the topic on CodeRanch about this issue. So my remote client should look as follows:



Thanks again.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


java:global/firstejb/EmployeeServiceBean!com.sze.ejb.EmployeeService



Try


 
Sheriff
Posts: 3108
459
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had a similar problem before and found that I needed to prefix the JNDI name with ejb:(instead of java:).
 
Ron McLeod
Sheriff
Posts: 3108
459
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a working example that I had - similar to what you are trying:

 
Destiny's powerful hand has made the bed of my future. And this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic