---
title: "CWE-7: J2EE Misconfiguration: Missing Custom Error Page"
url: https://radicalnotion.ai/cwe/cwe-7
type: cwe
description: "The product has a J2EE component that does not have a custom error page."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-7: J2EE Misconfiguration: Missing Custom Error Page

- **Abstraction:** Variant
- **Structure:** Simple
- **Status:** Incomplete
- **CVEs with this as primary weakness:** 0
- **Of those, in CISA KEV:** 0
- **New in 2026:** 0
- **CWE catalog version:** 4.21

## Description

The product has a J2EE component that does not have a custom error page.

## Applicable platforms

**Languages:** Java (Undetermined)

**Technologies:** Web Based (Undetermined), Web Server (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality | Read Application Data | When an attacker explores a web site looking for vulnerabilities, the amount of information that the site provides is crucial to the eventual success or failure of any attempted attacks. A stack trace might show the attacker a malformed SQL query string, the type of database being used, and the version of the application container. This information enables the attacker to target known vulnerabilities in these components. |

## Potential mitigations

### Implementation

Handle exceptions appropriately in source code. Catch java.lang.Throwable exceptions to prevent attackers from mining information from the application container's built-in error response.

### Implementation, System Configuration

Always define appropriate error pages, including for 4xx errors (e.g. 404) and 5xx (e.g. 500) errors. The application configuration should specify a default error page in order to guarantee that the application will never leak error messages to an attacker. Handling standard HTTP error codes is useful and user-friendly in addition to being a good security practice, and a good configuration will also define a last-chance error handler that catches any exception that could possibly be thrown by the application.

### Implementation

Do not attempt to process an error or attempt to mask it.

### Implementation

Verify return values are correct and do not supply sensitive information about the system.

## Detection methods

### Automated Static Analysis

Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

## Demonstrative examples

### Example 1

In the snippet below, an unchecked runtime exception thrown from within the try block may cause the container to display its default error page (which may contain a full stack trace, among other things).

Bad code:

```java
Public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    try {
        ...
    } catch (ApplicationSpecificException ase) {
        logger.error("Caught: " + ase.toString());
    }
}
```

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-756](https://radicalnotion.ai/cwe/cwe-756) | Missing Custom Error Page |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| 7 Pernicious Kingdoms | J2EE Misconfiguration: Missing Error Handling | - | - |

## Frequently asked questions

### What is CWE-7?

The product has a J2EE component that does not have a custom error page.

### How do you prevent CWE-7?

Handle exceptions appropriately in source code. Catch java.lang.Throwable exceptions to prevent attackers from mining information from the application container's built-in error response.

### How is CWE-7 detected?

Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

### What are the consequences of CWE-7?

Exploiting CWE-7 can lead to: Read Application Data.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/7.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-7). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
