1

Basically, I'm a newbie in Tapestry and I have to work on a project with this framework. In order to do this, I started the Tutorial Point and DoubleNegative jumpstart tutorials.

So far, I managed to complete the hibernate part of Tutorial point, but I have several difficulties with the JPA part. I currently have a problem with the JPA integration, about the implementation of the PersistenceProvider into the runtime environment.

Each time that I build the project, it returns me this error message :

[ERROR] ioc.Registry java.lang.IllegalStateException: No PersistenceProvider implementation available in the runtime environment.

But I have a persistence.xml file, and in the correct place (src/main/resources/META-INF).

As my project need Java 1.7, I use the last versions for the dependencies tapestry-core and tapestry-jpa (${tapestry-release-version}) and the 5.1.17 for the hibernate-core.

(Here, the dependecy tree integration conrresponding to hibernate

[INFO] +- org.hibernate:hibernate-core:jar:5.1.17.Final:compile
[INFO] |  +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] |  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] |  +- org.javassist:javassist:jar:3.20.0-GA:compile
[INFO] |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  +- org.apache.geronimo.specs:geronimo-jta_1.1_spec:jar:1.1.1:compile
[INFO] |  +- org.jboss:jandex:jar:2.0.3.Final:compile
[INFO] |  +- com.fasterxml:classmate:jar:1.3.0:compile
[INFO] |  +- org.dom4j:dom4j:jar:2.1.1:compile
[INFO] |  \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.19:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.19:compile
[INFO] |  \- log4j:log4j:jar:1.2.17:compile

)

So far, I have this without any result :

  • change the provider from org.hibernate.ejb.HibernatePersistence to the current version in the persistence file
  • replace the commands used in the persistence into the AppModule
  • use the mapping balises into the persistence file
  • use the addJarFileUrl functions into the configurePersistenceUnitInfos (commented bellow but useless)

This is a fragment of my persistence.xml file :

<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name="ryuJPA" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<properties>
<property name="hibernate.archive.autodetection" value="class" />
<property name="hibernate.dialect" value="com.mysema.query.jpa.support.ExtendedHSQLDialect" />
<property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver" />
<property name="hibernate.connection.url" value="jdbc:hsqldb:file:./localhost/ryu;shutdown=true" />
<property name="hibernate.connection.user" value="sa" />
<property name="hibernate.show_sql" value="true"/> 
<property name="hibernate.hbm2ddl.auto" value="update" />
</properties>
</persistence-unit>
</persistence>

There is the part of the AppModule.java corresponding :

@Contribute(EntityManagerSource.class)
    public static void configurePersistenceUnitInfos(MappedConfiguration<String,PersistenceUnitConfigurer> cfg) {
        PersistenceUnitConfigurer configurer = new PersistenceUnitConfigurer() {
            public void configure(TapestryPersistenceUnitInfo unitInfo) {
                unitInfo
                //.addJarFileUrl("hibernate-release-5.1.17.Final\\lib\\jpa\\hibernate-entitymanager-5.1.17.Final.jar")
                //.addJarFileUrl("org.hibernate.ejb.HibernatePersistence")
                .addProperty("hibernate.archive.autodetection", "class")
                .addProperty("hibernate.dialect", "com.mysema.query.jpa.support.ExtendedHSQLDialect")
                .addProperty("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver")
                .addProperty("hibernate.connection.url", "jdbc:hsqldb:file:./localhost/ryu;shutdown=true")
                .addProperty("hibernate.show_sql", "sa")
                .addProperty("hibernate.show_sql", "true")
                .addProperty("hibernate.hbm2ddl.auto", "update")
                ;
                }
            };
            cfg.add("ryuJPA", configurer);
            }

Currently, jetty can't compile the project, the return is :

[ERROR] ioc.Registry java.lang.IllegalStateException: No PersistenceProvider implementation available in the runtime environment.

Currently, I don't have enough experience into this framework to see how to solve this, it's seem correct for me.

Thanks for any kind of help.

ElieCTP
  • 11
  • 2
  • Can you show how you include Hibernate? Would be best if you post dependency report from Maven/Gradle. It looks like classpath issue and has nothing to do with Tapestry: https://github.com/apache/tapestry-5/blob/7fb7cb11d7f467a3c5382753d5fd8cae90c3ac50/tapestry-jpa/src/main/java/org/apache/tapestry5/internal/jpa/EntityManagerSourceImpl.java#L235-L243 – Dmitry Gusev Jun 22 '19 at 16:40
  • Sorry for the delay, and thank you for your answer. I have upgraded the subject with the dependecy tree corresponding. – ElieCTP Jun 24 '19 at 08:49

0 Answers0