如何修复使用stanford nlp和liquigraph一起造成的错误?

时间:2017-01-12 11:30:36

标签: spring spring-mvc spring-boot neo4j database-migration

我一直试图在我的项目上实施liquigraph。我正在使用此示例https://github.com/fbiville/liquigraph-spring-boot-example。该示例运行正常,直到我尝试从Stanford NLP添加两个依赖项:

    <dependency>
        <groupId>edu.stanford.nlp</groupId>
        <artifactId>stanford-corenlp</artifactId>
        <version>3.6.0</version>
    </dependency>
    <dependency>
        <groupId>edu.stanford.nlp</groupId>
        <artifactId>stanford-corenlp</artifactId>
        <version>3.6.0</version>
        <classifier>models</classifier>
    </dependency>

在我添加这两个依赖项之后,我收到了这个错误:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'liquigraph' defined in class path resource [org/liquigraph/spring/starter/LiquigraphAutoConfiguration$LiquigraphConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: 
cvc-elt.1: Cannot find the declaration of element 'changelog'.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1583) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:754) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542) ~[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE]
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:761) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:371) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1186) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1175) [spring-boot-1.4.2.RELEASE.jar:1.4.2.RELEASE]
at org.liquigraph.examples.spring.SampleController.main(SampleController.java:48) [classes/:na]

Caused by: java.lang.IllegalArgumentException: 
    cvc-elt.1: Cannot find the declaration of element 'changelog'.
    at org.liquigraph.core.io.xml.ChangelogParser.parseChangelog(ChangelogParser.java:67) ~[liquigraph-core-3.0.2-SNAPSHOT.jar:na]
    at org.liquigraph.core.io.xml.ChangelogParser.parse(ChangelogParser.java:59) ~[liquigraph-core-3.0.2-SNAPSHOT.jar:na]
    at org.liquigraph.core.api.MigrationRunner.parseChangesets(MigrationRunner.java:87) ~[liquigraph-core-3.0.2-SNAPSHOT.jar:na]
    at org.liquigraph.core.api.MigrationRunner.runMigrations(MigrationRunner.java:68) ~[liquigraph-core-3.0.2-SNAPSHOT.jar:na]
    at org.liquigraph.core.api.Liquigraph.runMigrations(Liquigraph.java:63) ~[liquigraph-core-3.0.2-SNAPSHOT.jar:na]
    at org.liquigraph.spring.SpringLiquigraph.afterPropertiesSet(SpringLiquigraph.java:52) ~[liquigraph-spring-boot-starter-3.0.2-SNAPSHOT.jar:na]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1642) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1579) ~[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE]
    ... 16 common frames omitted

如何解决此错误?

1 个答案:

答案 0 :(得分:0)

这已经filed并通过排除因斯坦福NLP依赖而传递获取的Xerces-impl来修复:

<dependency>
    <groupId>edu.stanford.nlp</groupId>
    <artifactId>stanford-corenlp</artifactId>
    <version>3.6.0</version>
    <exclusions>
        <exclusion>
            <groupId>xerces</groupId>
            <artifactId>xercesImpl</artifactId>
        </exclusion>
    </exclusions>
</dependency>