File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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..
It's not a secret anymore!