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, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content