尝试运行maven测试时遇到此问题。不确定是什么导致了这个问题,因为这些测试之前没有问题。我的依赖项由maven管理
Caused by: java.lang.NoClassDefFoundError: Could not initialize class liquibase.sqlgenerator.core.LockDatabaseChangeLogGenerator
at sun.reflect.GeneratedConstructorAccessor379.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at liquibase.sqlgenerator.SqlGeneratorFactory.<init>(SqlGeneratorFactory.java:39)
at liquibase.sqlgenerator.SqlGeneratorFactory.getInstance(SqlGeneratorFactory.java:53)
at liquibase.executor.AbstractExecutor.applyVisitors(AbstractExecutor.java:22)
at liquibase.executor.jvm.JdbcExecutor.access$500(JdbcExecutor.java:35)
at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:284)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:54)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:106)
at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:96)
at liquibase.lockservice.StandardLockService.init(StandardLockService.java:83)
at liquibase.lockservice.StandardLockService.acquireLock(StandardLockService.java:182)
at liquibase.lockservice.StandardLockService.waitForLock(StandardLockService.java:148)
at liquibase.Liquibase.update(Liquibase.java:189)
at liquibase.Liquibase.update(Liquibase.java:181)
at liquibase.integration.spring.SpringLiquibase.performUpdate(SpringLiquibase.java:342)
at liquibase.integration.spring.SpringLiquibase.afterPropertiesSet(SpringLiquibase.java:299)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1571)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1509)
答案 0 :(得分:4)
在OSX上测试快速修复:
输入您的控制台:
$ hostname -f
输出应该看起来像这样:
MAC008.local
将此文件作为本地主机添加到您的主机文件中:
$ sudo vi /etc/hosts
看起来有点像这样:
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
127.0.0.1 MAC008.local
更改网络后重复。
答案 1 :(得分:0)
从Windows切换到Linux后我遇到了同样的问题。我找到了simulair bug https://liquibase.jira.com/browse/CORE-1943 我配置了nss-myhostname,这个错误消失了。