• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Best way to invoke remote EJB

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to improve my understanding of remote EJB invocation.

I have code like this working, which does a remote JNDI lookup on my server:


But that seems way to complicated, and hardcodes a lot of application-specific data into my application; for example, if I wanted to use a different server or renumber my network, I would have to modify my application then recompile and redeploy.

I have seen some solutions that use "jndi.properties", but so far I haven't gotten any to work, and at any rate this would still require me to recompile and redeploy to change anything.

Is there a simpler way of doing this that doesn't require hardcoding my network details into my app? Or is this the best I can do?

Thanks!

-----Scott.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The jndi.properties is the typical way to externalize that information. What problems did you run into while using that file? Also where is this lookup happening from? A standalone client application?
 
Scott Gifford
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jaikiran Pai wrote:The jndi.properties is the typical way to externalize that information. What problems did you run into while using that file?


I could not figure out where to put the file so it would be recognized, and I wasn't able to find clear documentation of where it should go, or any good way to troubleshoot.

Also where is this lookup happening from? A standalone client application?


A servlet.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Scott Gifford wrote:

Jaikiran Pai wrote:The jndi.properties is the typical way to externalize that information. What problems did you run into while using that file?


I could not figure out where to put the file so it would be recognized, and I wasn't able to find clear documentation of where it should go, or any good way to troubleshoot.



It should be in the classpath of the invoking application. Since you say you are invoking it from a servlet, try placing the jndi.properties in the .war/WEB-INF/classes folder since the resources in that folder are available in the classpath of the application.
 
Won't you please? Please won't you be my neighbor? - Fred Rogers. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic