Problem with JPA while migration from play 2.3 to 2.6

Hi,
I am facing few issues while migrating from play 2.3 to 2.6.There were few usages of JPA.em() method in my code. But it was just deprecated so I thought I can use them as of now. I am getting this exception on getting a request from one of the controller:

[error] p.c.s.n.PlayRequestHandler - Cannot invoke the action
com.google.inject.ProvisionException: Unable to provision, see the following errors:

1) Error injecting constructor, javax.persistence.PersistenceException: No Persistence provider for EntityManager named dicaf
  at play.db.jpa.DefaultJPAApi$JPAApiProvider.<init>(DefaultJPAApi.java:44)
  at play.db.jpa.DefaultJPAApi$JPAApiProvider.class(DefaultJPAApi.java:39)
  while locating play.db.jpa.DefaultJPAApi$JPAApiProvider
  while locating play.db.jpa.JPAApi
    for the 1st parameter of play.db.jpa.TransactionalAction.<init>(TransactionalAction.java:20)
  while locating play.db.jpa.TransactionalAction

1 error
        at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1028)
        at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1054)
        at play.api.inject.guice.GuiceInjector.instanceOf(GuiceInjectorBuilder.scala:409)
        at play.api.inject.ContextClassLoaderInjector.$anonfun$instanceOf$3(Injector.scala:118)
        at play.api.inject.ContextClassLoaderInjector.withContext(Injector.scala:126)
Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named dicaf
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:61)
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
        at play.db.jpa.DefaultJPAApi.lambda$start$1(DefaultJPAApi.java:65)
        at java.lang.Iterable.forEach(Iterable.java:75)
        at play.db.jpa.DefaultJPAApi.start(DefaultJPAApi.java:64)
[error] application - 

My configuration files are:
application.conf:

play.http.secret.key="35o&gt;_QTGKK:kmSJ3Nht7Ju:eUY4vl;1?gI]bk[KHnvWga3Osnn4Rp3fDp`9ppGFp"

play.filters.disabled+=play.filters.csrf.CSRFFilter
play.filters.disabled+=play.filters.headers.SecurityHeadersFilter
play.filters.disabled+=play.filters.hosts.AllowedHostsFilter

db.default {
  logSql=true
  url="jdbc:mysql://localhost/display_prod"
  driver=com.mysql.jdbc.Driver
  username=display_rw
  password=f4m3d
  autocommit=true
  partitionCount=2
  maxConnectionsPerPartition=30
  minConnectionsPerPartition=10
  acquireIncrement=4
  acquireRetryAttempts=10
  acquireRetryDelay=10seconds
  connectionTimeout=20seconds
  idleMaxAge=10minutes
  idleConnectionTestPeriod=5minutes
  initSQL="SELECT1"
  maxConnectionAge=8hours
  jndiName=DicafDS
}

jpa.default=dicaf

build.sbt:

libraryDependencies ++= Seq(
  javaWs,
  javaJdbc,
  javaJpa,
  cacheApi,
  ws,
  evolutions,
  jdbc,
  guice,
  "com.google.inject" % "guice" % "4.0-beta",
  "ch.qos.logback" % "logback-core" % "1.0.7",
  "ch.qos.logback" % "logback-classic" % "1.0.7",
  "mysql" % "mysql-connector-java" % "5.1.31",
  "org.hibernate" % "hibernate-entitymanager" % "5.1.0.Final",
  "javax.el" % "javax.el-api" % "3.0.0",
  "org.glassfish.web" % "el-impl" % "2.2",
  "org.springframework.ldap" % "spring-ldap-core" % "2.0.4.RELEASE",
  "org.springframework" % "spring-dao" % "2.0.8",
  "org.springframework" % "spring-expression" % "4.2.4.RELEASE",
  "com.typesafe.play" %% "play-json" % "2.6.0",
  "org.json" % "json" % "20080701",
  "org.apache.poi" % "poi" % "3.10-FINAL",
  "org.apache.poi" % "poi-ooxml" % "3.10-FINAL",
  "com.walmartlabs.display" % "MySqlConnector" % "1.0-SNAPSHOT",
  "javax.mail" % "mail" % "1.4.7",
  "com.netflix.astyanax" % "astyanax" % "1.56.37",
  "com.walmart.labs.lsp" % "kson" % "1.0",
  "com.walmartlabs.display" % "EhCache" % "1.0-SNAPSHOT" excludeAll(excludeHadoop, excludeFlumeNg, excludeCassandra),
  "com.walmartlabs.display" % "redis-client" % "1.0-SNAPSHOT",
  "com.restfb" % "restfb" % "1.33.0",
  "org.ehcache" % "ehcache" % "3.4.0",
  "com.h2database" % "h2" % "1.4.192"
)

persistence.xml:

<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
             version="2.1">

    <persistence-unit name="dicaf" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.ejb.HibernatePersistenceProvider</provider>
        <non-jta-data-source>DicafDS</non-jta-data-source>

        <!-- Any classes used from external jars should be added here. !-->
        <class>com.walmartlabs.display.mysql.dicaf.experiments.Experiment</class>
        <class>com.walmartlabs.display.mysql.dicaf.experiments.SubprogramTags</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.Account</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.AdserverResources</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.AdserverServiceMapping</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.AttributionModel</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.Contract</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.ContractId</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.CoreAccountAttributionModel</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.CoreContractAttributionModel</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.DailyContractReport</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.DailyContractReportId</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.DailyEdgeReport</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.DailyEdgeReportId</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.DailyLineItem</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.DailyLineItemId</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.DailyProgramReport</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.DailyProgramReportId</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.FeedHandler</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.ItemSegment</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.ItemSegmentMetadata</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.Partner</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.PaymentModel</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.Program</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.ProgramId</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.RecommendationsGeneratorConfig</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.Subprogram</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.SubprogramIntegConfig</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.UserSegment</class>
        <class>com.walmartlabs.display.mysql.dicaf.framework.UserModelGeneratorConfig</class>

        <properties>
            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
            <property name="hibernate.hbm2ddl.auto" value="update"/>
        </properties>
    </persistence-unit>

</persistence>

Any help is appreciated.

Hi @vidhey,

I could not spot any problems with only with the given information. Maybe you can create a small project that reproduces the problem?

Best.