1300
CWE-574: EJB Bad Practices: Use of Synchronization Primitives
Weakness ID : 574
Structure : Simple
Abstraction : Variant
Description
The product violates the Enterprise JavaBeans (EJB) specification by using thread synchronization
primitives.
Extended Description
The Enterprise JavaBeans specification requires that every bean provider follow a set of
programming guidelines designed to ensure that the bean will be portable and behave consistently
in any EJB container. In this case, the product violates the following EJB guideline: "An enterprise
bean must not use thread synchronization primitives to synchronize execution of multiple
instances." The specification justifies this requirement in the following way: "This rule is required to
ensure consistent runtime semantics because while some EJB containers may use a single JVM to
execute all enterprise bean's instances, others may distribute the instances across multiple JVMs."
Relationships
The table(s) below shows the weaknesses and high level categories that are related to this
weakness. These relationships are defined as ChildOf, ParentOf, MemberOr and give insight to
similar items that may exist at higher and lower levels of abstraction. In addition, relationships such
as PeerOf and CanAlsoBe are defined to show similar weaknesses that may want to be explored.
Relevant to the view "Research Concepts" (CWE-1000)
Nature Type ID Name Page
ChildOf 695 Use of Low-Level Functionality 1524
ChildOf 821 Incorrect Synchronization 1722
Applicable Platforms
Language : Java (Prevalence = Undetermined)
Common Consequences
Scope Impact Likelihood
Other Quality Degradation
Potential Mitigations
Phase: Implementation
Do not use Synchronization Primitives when writing EJBs.
Demonstrative Examples
Example 1:
In the following Java example a Customer Entity EJB provides access to customer information in a
database for a business application.
Example Language: Java (Bad)
@Entity
public class Customer implements Serializable {
private String id;
private String firstName;
private String lastName;
private Address address;
public Customer() {...}
public Customer(String id, String firstName, String lastName) {...}
@Id
public String getCustomerId() {...}
CWE Version 4.14
CWE-575: EJB Bad Practices: Use of AWT Swing
CWE-575: EJB Bad Practices: Use of AWT Swing