In order to provide portable and reliable EJB elements, the following restrictions apply to EJB code implementation:
1. Avoid using static non-final fields. Defining all static fields in EJB component as final is recommended. This enables the EJB container to provide instances across multiple JVMs.
2. Avoid starting a using thread or new thread synchronization.
3. Avoid using Swing or AWT functionality. EJBs are server side business elements.
4. Avoid using java.io operations or file access. EJB business elements are meant to use source managers such as JDBC to retrieve and store application data. But deployment descriptors may be used to store .
5. Avoid listening or accepting to socket connections. EJB components are not meant to give network socket functionality. However the specification lets EJB elements act as RMI clients or socket clients.
6. Avoid using the reflection API of java. This restriction enforces Java security.