• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

InitialContext - don't understand how to set this from an app not hosted by appserver

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,

I know this is a common question because I've searched the forum and read through peoples problems and solutions, but I'm still not understanding, and I wondered if I could get some advice.

I have an application client in the form of standalone java classes which calls a remote EJB on a WAS server. I understand i can make a JNDI call to a server and port and I know I have to set the InitialContext, but I don't know what i should set it to.

Lots of people seem to suggest "org.jnp.interfaces.NamingContextFactory" but I'm not sure if this is something appserver specific like JBoss.

What would people advise?

Many thanks


Marc
 
marc dauncey
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, answering my own question here - worked out that the app needs to run as an application client (rather than invoking main(string[] args) like a normal java app.

Just noticed the mindboggling jvm options i am going to need - this is going to cause me a big problem since my code will be running inside of another java application (IBM extended search) - don't have control of the jvm and really not sure how i am going to get round this.

The fact that you need all this stuff just to make a jndi call and get back an ejb strikes me as tight coupling. Or have I misunderstood?
 
Ranch Hand
Posts: 2108
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you show the look up code? i have same problem
 
marc dauncey
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've now successfully got an ejb lookup working in a POJO without running it as an application client.

Basically for WAS, you need the following JARs on your project classpath:

wssec.jar
naming.jar
namingclient.jar
lmproxy.jar
sas.jar
ecutils.jar

you also need a reference to a folder containing this file:
implfactory.properties

i then did the following JNDI lookup:



It works fine, just got to get this working in Extended Search now, which is a bigger challenge!

Marc
 
Arch enemy? I mean, I don't like you, but I don't think you qualify as "arch enemy". Here, try this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic