Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Amee Dabo
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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,
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!