play framework 2.6 injecting JPAApi

Viewed 293

I am trying to connect my play app with hibernate according to official docs here. My persistence.xml file `http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd" version="2.1">

<persistence-unit name="defaultPersistenceUnit" transaction-type="RESOURCE_LOCAL">
    <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
    <non-jta-data-source>DefaultDS</non-jta-data-source>
    <properties>
        <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
        <property name="hibernate.hbm2ddl.auto" value="update"/>
    </properties>
</persistence-unit>

`

However, after injecting JPAApi to controller constructor, I'm getting the following error:

    `[ERROR] [11/07/2017 17:37:08.944] [play-dev-mode-akka.actor.default-dispatcher-6] [akka.actor.ActorSystemImpl(play-dev-mode)] Internal server error, sending 500 response
com.google.common.util.concurrent.UncheckedExecutionException: java.lang.IllegalArgumentException
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2218)
    at com.google.common.cache.LocalCache.get(LocalCache.java:4147)
    at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:4151)
`

It lools like DI mechanism can not find proper realization to JPAApi interface. How can I fix this issue?

0 Answers
Related