简体   繁体   English

添加neo4j-spatial依赖性会导致错误

[英]Adding neo4j-spatial dependency causes error

I have a project that includes, among others, Apache Pivot and Neo4j. 我有一个项目,其中包括Apache Pivot和Neo4j。 My project compiles and runs. 我的项目编译并运行。 When I try to add Neo4j/Spatial: 当我尝试添加Neo4j / Spatial时:

<dependency>
  <groupId>org.neo4j</groupId>
  <artifactId>neo4j-spatial</artifactId>
  <version>0.11-SNAPSHOT</version>
</dependency>

The project compiles but will not run. 该项目将编译,但不会运行。 The compiler sources the error at one of the BXML files: 编译器在BXML文件之一中产生错误:

org.apache.pivot.serialization.SerializationException: java.util.ServiceConfigurationError: javax.imageio.spi.ImageOutputStreamSpi: Provider com.sun.media.imageioimpl.stream.ChannelImageOutputStreamSpi could not be instantiated: java.lang.IllegalArgumentException: vendorName == null!

I can't understand how adding a dependency can break the project at runtime. 我不明白如何添加依赖项会在运行时破坏项目。 I did not change any code. 我没有更改任何代码。 I'll post whatever code is necessary as asked. 我将按照要求张贴任何代码。

UPDATE : I've tried a previous, stable version with the same result. 更新 :我已经尝试了具有相同结果的先前的稳定版本。 Also, I've added "vendor" and version information to my jar manifest that seems to fix the vendorName == null error and causes the project to hang on close rather than open. 另外,我在jar清单中添加了“供应商”和版本信息,这似乎可以解决vendorName == null错误,并导致项目在关闭而不是打开时挂起。 But my question, which I'll rephrase here, is the same. 但是我的问题,我将在这里重新表述,它是相同的。

How does adding a dependency, without changing code, cause a functioning project to fail at runtime? 在不更改代码的情况下添加依赖项如何导致运行中的项目失败? I don't understand how adding the dependency changes the execution if I don't call it. 我不明白如果不调用依赖关系,如何添加依赖关系会改变执行。

There can be issues with versioning. 版本控制可能存在问题。 If you add a dependency, and you have another library which has the same dependency but a different version, the usual behaviour of Maven is for the latest version to be imported, and occasionally that can break the code that depended on the old version, due to a changed interface or whatever. 如果添加依赖项,并且有另一个具有相同依赖项但版本不同的库,则Maven的通常行为是要导入最新版本,并且由于某些原因,偶尔会破坏依赖于旧版本的代码更改的界面或其他内容。

So if A depends on B v1, and C depends on Bv2, then when you add C, it overwrites Bv1 with Bv2 in the effective POM, which in theory could break it. 因此,如果A依赖于B v1,而C依赖于Bv2,则在添加C时,它会在有效POM中用Bv2覆盖Bv1,从理论上讲可能会破坏它。

I am sure that there is a way around this, but I am not an expert with Maven. 我敢肯定有办法解决这个问题,但是我不是Maven的专家。 SO check your effective POM for changes to versions when you import the new thing. 因此,当您导入新内容时,请检查您的有效POM是否有版本更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM