javax.ejb.EJBException: Attempt to pass a reference to an EJBLocalObject to a remote client奇怪,你的程序报错说你远程调用一个本地方法...
另外你贴的 ejb ql 语句也有误,不知是不是你的手误:应为:SELECT OBJECT(i) FROM TbImgproduce AS i WHERE i.colEast = ?1 AND i.colWest = ?2 AND i.colSouth = ?3 AND i.colNorth = ?4 AND i.type = ?5 AND i.colLevel = ?6 AND i.colBegintime > ?7

解决方案 »

  1.   

    会话bean和实体bean如果在一个包里,会话bean使用remote接口,客户端调用会话bean,应该不会出现你说的问题,我估计是没有写成OBJECT(i),出现的一种假相错误!
      

  2.   

    Attempt to pass a reference to an EJBLocalObject to a remote client.  A local EJB component may only be accessed by clients co-located in the same ear or standalone jar file.你的EntityBean是Local的,不能直接返回Entity给RemoteClient
      

  3.   

    楼主在SessionBean的queryByKey2()中是不是直接把EntityBean的finder得到的collection直接返回,然后在TestClient中测试吧?
      

  4.   

    proZeus(proZeus),我是直接把EntityBean的finder得到的collection直接返回,然后在TestClient中测试,这样做有问题吗?请帮帮我。
      

  5.   

    proZeus(proZeus),我把EntityBean的finder的返回植改为TbImgproduce(实例)就不出错了,这是怎么回事?还有我怎样才能用finder返回collection?
      

  6.   

    楼主试试把sql语句放在CDATA中:<!CDATA[[SQL]]>
      

  7.   

    例子SQL:
    select object(o) from RpItemAttr o where o.rpTypeCode = ?1 and o.rpItemAttrCode >= ?2 and o.rpItemAttrCode <= ?3写法:
    <ejb-ql>select object(o) from RpItemAttr o where o.rpTypeCode = ?1 and o.rpItemAttrCode &gt;= ?2 and o.rpItemAttrCode &lt;= ?3</ejb-ql>
      

  8.   

    楼主试试把sql语句放在CDATA中:<!CDATA[[SQL]]>