Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
marc dauncey
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?
 
Jesus Angeles
Ranch Hand
Posts: 2068
  • 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