日期:2014-05-19  浏览次数:20823 次

EJB类型转换问题,cannot be cast to
代码如下:
Test   tt   =   (Test)   context.lookup( "TestBean/local ");

提示出错castException,   cannot   be   cast   $Proxy(181)   to   src.Test
有一个接口Test,   为local
有一个TestBean

找不出什么原因,请高手指点。

------解决方案--------------------
Object objref = initial.lookup( "TestBean/local ");

Test tt = (Test) PortableRemoteObject.narrow(objref,Test.class);