Thread th = Thread.curreentThread();
ClassLoader cloader = th.getContextClassLoader();
try{
InitialContext cont = new InitialContext();
Object obj = cont.lookup("ejb\YourJNDI");
Classloader ejb_cloader = obj.getClass().getClassLoader();
th.setContextClassLoader(ejb_loader);
YourLocalHome you = (YourLocalHome)obj;
.......
}
catch(){}
finally{ th.setContextClassLoader(cloader);}
May be i have tried lot of things but , like , i cahnged jbosswebloder=false and islotaion for ear false, setting classloader for ears ... lots of problem ; but still i was getting problems ie. CLassCastException but this the way im Working now . May Be some would be having a better way to suggest. Thanks