tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <>
Subject Re: EJB remote access (WAR to WAR) throws java.lang.ClassCastException: com.sun.proxy.$Proxy*** cannot be cast to ***
Date Mon, 19 Dec 2016 15:26:04 GMT
2016-12-19 16:04 GMT+01:00 alltomee <>:

> This is not the point. Share or not HelloJNDI as a standalone JAR will not
> make it work, because the problem resides at @LocalBean annotation, that
> works differently at TomEE. As I've said, the same example works at
> Glassfish and Wildfly.
was just explaining you what you were allowed to expect respecting
tomcat/tomee/ee (all three) classloading.

> By definition for newest EJB annotations, if I do not define any
> interfaces,
> EJB can only be accessed locally (older versions of EJB would need and
> interface). But if I define the @Remote interface for example, the EJB will
> not be accessible locally if I don't define @Local interface. The
> workaround
> was to use the @LocalBean annotation, who let EJB be accessible locally
> without interface, but this is not working at TomEE. My question refers to
> that, why @LocalBean blocks the EJB to be accessible remotely.
@Remote == expose remotely based on the API (same rule as @Local for API
determination but based on remote interface instead of @Local)
@Local == the use passed as argument or if not the single interface as
@LocalBean == skip interfaces and use the class API (public methods) as
contract - more or less fake an interface)

If you use @LocalBean then TomEE will create a proxy based on the class
which includes automatically interfaces. In a single container, by defaut,
tomee skips the serialization IIRC and therefore passes the direct instance
which means it will work if you share the API you request tomee to expose
in tomee/lib for inter apps communication.

> --
> View this message in context: http://tomee-openejb.979440.
> lang-ClassCastException-com-sun-proxy-Proxy-cannot-be-
> cast--tp4680774p4680791.html
> Sent from the TomEE Users mailing list archive at

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message