NetBeans does not correctly generate EJB session beans when WildFly is selected as the server
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;
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