我是Liquibase和JHipster的新手,並且在使用maven插件生成diff時遇到了一些問題。liquibase.exception.DatabaseException:java.lang.ClassNotFoundException
運行mvn liquibase:diff -e -X
我的聚甲醛的有關章節時,我收到以下錯誤:
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>${liquibase.version}</version>
<dependencies>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.18.2-GA</version>
</dependency>
<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-hibernate4</artifactId>
<version>${liquibase-hibernate4.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.1.Final</version>
</dependency>
</dependencies>
<configuration>
<changeLogFile>src/main/resources/config/liquibase/master.xml</changeLogFile>
<diffChangeLogFile>
src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml
</diffChangeLogFile>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost/shiftwork</url>
<defaultSchemaName/>
<username>postgres</username>
<password/>
<referenceUrl>hibernate:spring:com.teammachine.staffrostering.domain?dialect=org.hibernate.dialect.PostgreSQL94Dialect&hibernate.ejb.naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy</referenceUrl>
<verbose>true</verbose>
<logging>debug</logging>
</configuration>
</plugin>
<changeLogFile>src/main/resources/config/liquibase/master.xml</changeLogFile>
<diffChangeLogFile>
src/main/resources/config/liquibase/changelog/${maven.build.timestamp}_changelog.xml
</diffChangeLogFile>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost/myApp</url>
<defaultSchemaName/>
<username>postgres</username>
<password/>
<referenceUrl>hibernate:spring:com.myapp.domain?dialect=&hibernate.ejb.naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringNamingStrategy</referenceUrl>
<verbose>true</verbose>
<logging>debug</logging>
</configuration>
</plugin>
也許我錯了,但我的理解是缺少類(org.hibernate作爲.boot)是Hibernate Core的一部分,它包含在內。
Number of foreign imports: 1
import: Entry[import from realm ClassRealm[maven.api, parent: null]]
-----------------------------------------------------
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:166)
... 21 more
Caused by: java.lang.NoClassDefFoundError: org/hibernate/boot/registry/classloading/internal/ClassLoaderServiceImpl$Work
at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:45)
at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:57)
at liquibase.ext.hibernate.database.HibernateSpringDatabase.buildConfigurationFromScanning(HibernateSpringDatabase.java:243)
at liquibase.ext.hibernate.database.HibernateSpringDatabase.buildConfiguration(HibernateSpringDatabase.java:55)
at liquibase.ext.hibernate.database.HibernateDatabase.setConnection(HibernateDatabase.java:45)
at liquibase.database.DatabaseFactory.findCorrectDatabaseImplementation(DatabaseFactory.java:131)
at liquibase.database.DatabaseFactory.openDatabase(DatabaseFactory.java:151)
at liquibase.integration.commandline.CommandLineUtils.createDatabaseObject(CommandLineUtils.java:85)
at org.liquibase.maven.plugins.LiquibaseDatabaseDiff.performLiquibaseTask(LiquibaseDatabaseDiff.java:166)
at org.liquibase.maven.plugins.AbstractLiquibaseMojo.execute(AbstractLiquibaseMojo.java:394)
at org.liquibase.maven.plugins.LiquibaseDatabaseDiff.execute(LiquibaseDatabaseDiff.java:146)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
... 21 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$Work
at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
... 33 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
[email protected]:~/git/hughestech/shiftwork/staffservice$
謝謝。我已經添加了這個並更新了我的問題。 – Magick
@Magick這是由衝突版本的Hibernate引起的不同錯誤。因爲這個問題真的不相關,所以最好發表一個新的問題。在這個新問題中,請確保發佈Liquibase和Hibernate的確切版本。因爲Liquibase依賴於Hibernate 4,所以我會嘗試去除對'hibernate-core' 5的依賴。 – Tunaki
@Magick我做了一個編輯。 – Tunaki