This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes JBoss/WildFly and the fly likes Not able to locate jndi via sar file ...continuation.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Not able to locate jndi via sar file ...continuation.." Watch "Not able to locate jndi via sar file ...continuation.." New topic

Not able to locate jndi via sar file ...continuation..

Amee Dabo
Ranch Hand

Joined: Dec 22, 2001
Posts: 74

I am still trying to access JNDI through start() method of my MBean as follows:

I have written rebind() method (referred documentation):

private void rebind() throws NamingException
private String jndiName = "ejb/Results1Bean";
InitialContext rootCtx = new InitialContext();
// Get the parent context into which we are to bind
Name fullName = rootCtx.getNameParser("").parse(jndiName);
Name parentName = fullName;
if( fullName.size() > 1 )
parentName = fullName.getPrefix(fullName.size()-1);
System.out.append("fullName Size is not greater than 1 -----> ");
Context parentCtx = createContext(rootCtx, parentName);
Name atomName = fullName.getSuffix(fullName.size()-1);
String atom = atomName.get(0);
NonSerializableFactory.rebind(parentCtx, atom, contextMap);

Now Results1Bean is getting bound to JNDI tree correctly.

In my client I have following code:
InitialContext context = new javax.naming.InitialContext(); //Line 1
Results1RemoteHome results1RemoteHome = (Results1RemoteHome)context.lookup("ejb/Results1Bean"); //Line 2

At Line 2 I am getting error as
Exception in thread "Thread-4"
java.lang.ClassCastException: java.util.HashMap

Can anybody please guide me what should I do to solve this ?

I have searched all dcumentation available on JBoss but was of no use.
Please help me I am with no clue left ;(

Thanks in advance,

I agree. Here's the link:
subject: Not able to locate jndi via sar file ...continuation..
Similar Threads
How to get EJB bean instance using a factory.
Probelem with MDB l(on weblogic 7.0) listening to MQ (Start-up class issue )
JNDI lookup in EJBHomeFactory pattern
Basic JNDI caching questions.