apache / apache/netbeans

NetBeans does not correctly generate EJB session beans when WildFly is selected as the server

Open
#8,530 0 comments 0 reactions 0 assignees View on GitHub
Java EE/Jakarta EE kind:bug needs:triage
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 25

### What happened

When using the `JSF Pages from Entity Classes` feature in NetBeans, if **GlassFish** is selected as the application server, the tool properly generates Session Beans (Facade Beans) in a separate package such as `session`. However, if **WildFly** is selected, this structure is not respected, and the Session Beans are created within the entity package or under a general `JPA package`.

This behavior leads to poor project organization, inconsistency with common Java EE architecture practices, and harder maintainability.

### Language / Project Type / NetBeans Component

java maven web application

### How to reproduce

NetBeans should generate Session Beans package (e.g., `YourEntityFacade.java`) in a separate and clearly named package when select wildfly server similar to the behavior with GlassFish. Should not use the JPA model

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

Distro: Linux Mint 22.1 Xia base: Ubuntu 24.04 noble Kernel: 6.8.0-60-generic arch: x86_64

### JDK

openjdk version "24" 2025-03-18

### Apache NetBeans packaging

Apache NetBeans binary zip

### Anything else

In NetBeans, when using the "JSF Pages from Entity Classes" feature and selecting WildFly as the application server, during the Generate JSF Pages and Classes step, the IDE does not generate proper Session Bean classes (e.g., stateless EJBs in a separate package like session or ejb).

Instead, it only generates classes based on JPA architecture such as JPA controller package that include manual transaction handling code, and places them under a general package (e.g., controller.jpa), without leveraging the EJB container model.
for example:

public ActorJpaController(UserTransaction utx, EntityManagerFactory emf) {
this.utx = utx;
this.emf = emf;
}
private UserTransaction utx = null;
private EntityManagerFactory emf = null;

public EntityManager getEntityManager() {
return emf.createEntityManager();
}

This behavior deviates from the standard Java EE layered architecture, where entity classes (model), session beans (logic layer), and JSF pages (view) are clearly separated. It increases maintenance complexity and results in poorly structured code.
Should be in that way:
-------------------------------------------------------------------------------------------
public class ActorController implements Serializable {
@EJB
private Beans.Session.ActorFacade ejbFacade;
------------------------------------------------------------------------------------------------------

![Image](https://github.com/user-attachments/assets/6ee7f9d7-4654-4aa2-8d40-ca0c0c3f96d0)

![Image](https://github.com/user-attachments/assets/f26b6f2b-e68e-4288-82f2-aef270831db7)

And the correct production of session classes That related to Session Beans.

This issue occurs only when WildFly is selected as the target server. When GlassFish is used instead, NetBeans correctly generates Session Beans in a dedicated package and follows the recommended Java EE application structure
## 🧩 Suggested Fix:

- Detect EJB module and structure even in single-module web projects.
- Provide an option to set the target package for Session Beans in the wizard.
- Ensure better compatibility with application servers like WildFly and Payara.

---

## 🔁 Reproducibility:

✅ Always reproducible when using WildFly.

### Are you willing to submit a pull request?

Yes

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the JSF Pages from Entity Classes wizard with WildFly and GlassFish, then trace the server-specific generation path and compare their outputs. The work is done when WildFly generates session beans in a dedicated package and JSF controllers reference them through EJBs, matching the GlassFish structure.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.