"ENC setup failed java.lang.NullPointerException" when deploying an application on EAP 5.1.2.

Solution Unverified - Updated -

Issue

  • While trying to deploy a web application (war file) as a singleton application. The application uses data source defined as "*-ds.xml" file.

  • The application is using Spring framework to construct beans at the startup and uses Spring’s constructor dependency injection.

  • When the application is deployed as a “normal” application i.e. in server’s $PROFILE/deploy folder everything works as expected.

  • But when tried to deploy the same war file as a singleton application (by putting it into $PROFILE/deploy-hasingleton folder) facing deployment errors. The exception is (full log attached):

ERROR [org.jboss.web.tomcat.service.deployers.TomcatDeployment] (main) ENC setup failed
java.lang.NullPointerException
      at org.jboss.injection.PersistenceUnitHandler.getEntityManagerFactory(PersistenceUnitHandler.java:172)
  • It is suspected that the problem is related to the order of deployment. The singleton application is deployed before datasources and at the time on initialization the datasource jndi name is not bound yet.

  • Tried to move the ds file to hasingleton folder but the error was the same. Adding depend tag in the jboss-web.xml had also no effect.

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 5.1.2

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.