Verifying EJB 2.1 compliance

The checks implemented verify that EJBs comply with the EJB 2.1 specification, which is unfortunately not available as HTML document.

Static fields

Section 25.1.2 does not allow modifiable static fields, because the EJB tier may be deployed in a distributed environment.

Severity level: 2

Thread synchronization

Section 25.1.2 does not allow beans to use thread synchronization, because the EJB tier may be deployed in a distributed environment.

Severity level: 1

Native code

Section 25.1.2 does not allow native code in EJBs.

Severity level: 1

Field is not serializable

All Enterprise Beans extend the Serializable interface, which dictates that all non-transient fields must be serializable, which is not the case for the mentioned field.

Severity level: 1

EJB uses prohibited class

Section 25.1.2 prohibits the use of the following classes:

  • java.io.File
  • java.io.FileInputStream
  • java.io.FileOutputStream
  • java.io.FileReader
  • java.io.FileWriter
  • java.net.ServerSocket
  • java.io.RandomAccessFile
  • java.lang.ClassLoader
  • java.lang.Thread
  • java.lang.ThreadGroup

Severity level: 1

EJB uses forbidden method call

Section 25.1.2 prohibits the use of:

  • AWT and Swing for input and output
  • java.io for input and output
  • java.io.FileOutputStream
  • java.io.FileReader
  • java.io.FileWriter
  • java.net.Socket.setSocketImplFactory
  • java.net.ServerSocket
  • java.io.RandomAccessFile
  • java.lang.ClassLoader
  • java.lang.Thread
  • java.lang.ThreadGroup

Severity level: 1

Missing default constructor

Sections 7.11.2, 10.6.2, 12.2.2, and 15.7.2 state that the bean must have a public constructor that takes no arguments.

Severity level: 1

Initialization in constructor

Initialization should be performed in setEntityContext or setSessionContext.

Severity level: 1

Wrong class modifiers for session

Section 7.11.2 requires that a session beans class modifier must be public, and must not be final nor abstract.

Severity level: 1

EJB implements finalize()

Sections 7.11.2, 10.6.2, 12.2.2, and 15.7.2 state that an EJB must not implement the finalize() method.

Severity level: 1

Session Bean ejbCreate signature

Sections 7.11.2 states that ejbCreate methods must return void, and must not be final nor static.

Severity level: 1

Use of RemoteException

Sections 7.11.2, 10.6.2, and 12.2.2 recommend to use javax.ejb.EJBEXception instead of RemoteException.

Severity level: 1