Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
915 views
in Technique[技术] by (71.8m points)

java - Wildfly/JBOSS persistence error MSC000001: Failed to start service jboss.persistenceunit

We are migrating from Wildfly 8(for tests) and 9(for deployment) up to 21, Yay :). Unfortunately I am getting this error message when attempting to run the standalone.sh script: ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 78) MSC000001: Failed to start service jboss.persistenceunit."projectName.war#ertDatasource": org.jboss.msc.service.StartException in service jboss.persistenceunit."projectName.war#ertDatasource": java.lang.NoClassDefFoundError: javax/persistence/TableGenerators

From what i have gathered online, this should exist in the hibernate persistence that we are using: hibernate-jpa-2.1-api-1.0.0.Final. Wondering what i may have missed?

Hibernate is set as a dependency in the pom.xml:

    <dependency>
        <groupId>org.hibernate.common</groupId>
        <artifactId>hibernate-commons-annotations</artifactId>
        <version>4.0.4.Final</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.3.7.Final</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-jpamodelgen</artifactId>
        <version>4.3.9.Final</version>
        <scope>compile</scope>
    </dependency>

And these dependencies worked fine while we were on wildfly 8 and 9. Wondering what i may have missed in the config?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you look at wildfly pom.xml at https://github.com/wildfly/wildfly/blob/21.0.2.Final/pom.xml you see that:

version.org.hibernate is 5.3.20.Final
version.org.hibernate.commons.annotations is 5.0.5.Final

I suggest removing all hibernate dependencies and include only the API spec:

<dependency>
    <groupId>jakarta.persistence</groupId>
    <artifactId>jakarta.persistence-api</artifactId>
    <scope>provided</scope>
</dependency>

The version of jpa used by wildfly 21.x is 2.2.3.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...