Deployment fails with @Singleton annotation and private constructor in EAP 6

Solution Unverified - Updated -

Issue

  • There are number of classes with private constructors and @Singleton deployed in EAP 6.0.0.
              :
@Startup
public class JBossServiceExample implements JBossServiceExampleMBean {
  private Logger log = Logger.getLogger(this.getClass().getName());

  private JBossServiceExample()
  {
  }
              :

However form EAP 6.0.1 onwards, deployments fail with error:

Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS014227: EJB JBossServiceExample of type com.redhat.JBossServiceExample must have public default constructor
    at org.jboss.as.ejb3.component.EJBValidationConfigurator.configure(EJBValidationConfigurator.java:62)
    at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:80)

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.