I've come across what looks like a bug in the EJB3 deployed with JBossAS 5.1.0, but I thought I would post here first for some confirmation.
We have a web app which may be deployed in the same container or externally, and thus makes calls to remote EJB interfaces. In the same-container case, I found that the calls were still going through the network stack, and narrowed it down to IsLocalProxyFactoryInterceptor in org.jboss.ejb3.proxy.impl.remoting.
In this class, it seems to use the system time of the class's initialization to determine if the call is local or not. The problem seems to lie in the static initialization, where the singleton instance is constructed _before_ the static 'stamp' variable is initialized. This results in marshalledStamp getting a value of zero, and when later compared to stamp in isLocal(), is always not-equal, and thus is never considered a local call.
I've patched the class by moving the stamp variable initialization to before the singleton init. I'm not clear on the relationship between this singleton and other deserialized instances, or how I might have affected other things, but my fix seems to work for us so far.
I can make a JIRA on this if my analysis here isn't completely off-base :)