This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

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

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • 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
  • 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: 2081
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!