Originally posted by Andreas Schaefer:
Be aware that if you call a method of an EJB without going through the Local/Remote interface then none of the EJB services like transaction, security etc are used. In case you need to call another method in your EJB then you need to obtain the Remote interface from the EJB context.
If you call a method of the class directly without going through the container there is no ejb context. You only get an ejb context because the container provided you with one via the setSession(etc)Context callback. If you've created your own instance of the class, the container never had the option of invoking those callbacks, so you have no hooks to the container at all except JNDI - and not even reliable access to the ENC, just the global JNDI tree. Also if you do all this via threads you've spawned, you can seriously mess with the container's ability to manage resources, stop and undeploy applications, etc.