• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

initialContext becoming null when a new class is added

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm working on an application that has the following code.



The initialContext.lookup is working fine.
It does return the content it is supposed to.

Now I need to add a new Entity class to the application model.
When I do that, for some reason that I cant't understand, the above code (which is in another class) is affected and the initialContext.lookup line starts to return null to lup.

Any idea on why that could be happening?

Plus, where is "abc/xyz/loc" content located?
I searched everywhere and couldn't find it.

It is a JBoss server.
 
Marshal
Posts: 74048
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please provide more information; for example, is initialContext behaving as some sort of Map? If not, what type is it?
 
Jf Okeeffe
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, it's not a map.

It comes from this:

It's EJB/JNDI java application.
 
Campbell Ritchie
Marshal
Posts: 74048
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And how did you populate initialContext?
 
Jf Okeeffe
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is what I'm trying to understand.

Like mentioned on the original message there's a lookup for "abc/xyz/loc" on initialContext.

And that returns a value.

But I can't find where that value is being assigned to "abc/xyz/loc".

The application was developed by someone else.

So that was already implemented.
 
Saloon Keeper
Posts: 24321
167
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That looks like an attempt to do a JNDI lookup of an Enterprise JavaBean.

A couple of things stand out. First, you'd normally specify a server context: "java:comp/env". So the more common format would look like this:


You can use relative directory references once you have a starting context.

Secondly, you'll have to register the EJB into the JNDI directory supplied by the EJB host so that that resource path will in fact locate the EJB in question.

How you do that these days, I'm not sure. It's probably in a metadata file for the EJB. I suggest looking at the docs for the JEE server that you are using.
 
reply
    Bookmark Topic Watch Topic
  • New Topic