我正在开发的项目由几个组件组成 - 几个编译为JAR的独立库,以及一个引用它们的主项目。所有都是用Scala编写的。
我在其中一个库中内部使用ChronicleMap,使用带有自己的marshaller的自定义值类。 运行主项目时,我遇到了这些错误:
/net/openhft/chronicle/core/values/ByteValue$$Native.java:15: error: cannot find symbol
public class ByteValue$$Native implements ByteValue, Copyable<ByteValue>, BytesMarshallable, Byteable {
^
symbol: class ByteValue
/net/openhft/chronicle/core/values/ByteValue$$Native.java:15: error: cannot find symbol
public class ByteValue$$Native implements ByteValue, Copyable<ByteValue>, BytesMarshallable, Byteable {
^
symbol: class ByteValue
/net/openhft/chronicle/core/values/ByteValue$$Native.java:39: error: cannot find symbol
public void copyFrom(ByteValue from) {
^
symbol: class ByteValue
location: class net.openhft.chronicle.core.values.ByteValue$$Native
/net/openhft/chronicle/core/values/ByteValue$$Heap.java:12: error: cannot find symbol
public class ByteValue$$Heap implements ByteValue, Copyable<ByteValue>, BytesMarshallable {
^
symbol: class ByteValue
/net/openhft/chronicle/core/values/ByteValue$$Heap.java:12: error: cannot find symbol
public class ByteValue$$Heap implements ByteValue, Copyable<ByteValue>, BytesMarshallable {
^
symbol: class ByteValue
/net/openhft/chronicle/core/values/ByteValue$$Heap.java:34: error: cannot find symbol
public void copyFrom(ByteValue from) {
^
symbol: class ByteValue
location: class net.openhft.chronicle.core.values.ByteValue$$Heap
/net/openhft/chronicle/core/values/ByteValue$$Native.java:20: error: method does not override or implement a method from a supertype
@Override
^
/net/openhft/chronicle/core/values/ByteValue$$Native.java:25: error: method does not override or implement a method from a supertype
@Override
^
/net/openhft/chronicle/core/values/ByteValue$$Native.java:30: error: method does not override or implement a method from a supertype
@Override
^
/net/openhft/chronicle/core/values/ByteValue$$Native.java:65: error: cannot find symbol
if (!(obj instanceof ByteValue)) return false;
^
symbol: class ByteValue
location: class net.openhft.chronicle.core.values.ByteValue$$Native
/net/openhft/chronicle/core/values/ByteValue$$Native.java:66: error: cannot find symbol
ByteValue other = (ByteValue) obj;
^
symbol: class ByteValue
location: class net.openhft.chronicle.core.values.ByteValue$$Native
/net/openhft/chronicle/core/values/ByteValue$$Native.java:66: error: cannot find symbol
ByteValue other = (ByteValue) obj;
^
symbol: class ByteValue
location: class net.openhft.chronicle.core.values.ByteValue$$Native
/net/openhft/chronicle/core/values/ByteValue$$Heap.java:15: error: method does not override or implement a method from a supertype
@Override
^
/net/openhft/chronicle/core/values/ByteValue$$Heap.java:21: error: method does not override or implement a method from a supertype
@Override
^
/net/openhft/chronicle/core/values/ByteValue$$Heap.java:26: error: method does not override or implement a method from a supertype
@Override
^
/net/openhft/chronicle/core/values/ByteValue$$Heap.java:57: error: cannot find symbol
if (!(obj instanceof ByteValue)) return false;
^
symbol: class ByteValue
location: class net.openhft.chronicle.core.values.ByteValue$$Heap
/net/openhft/chronicle/core/values/ByteValue$$Heap.java:58: error: cannot find symbol
ByteValue other = (ByteValue) obj;
^
symbol: class ByteValue
location: class net.openhft.chronicle.core.values.ByteValue$$Heap
/net/openhft/chronicle/core/values/ByteValue$$Heap.java:58: error: cannot find symbol
ByteValue other = (ByteValue) obj;
^
symbol: class ByteValue
location: class net.openhft.chronicle.core.values.ByteValue$$Heap
仅当从Intellij IDEA运行项目时才会发生这种情况,而不是从命令行运行时。
另外,如果我设置一个独立的项目,使用相同的ChronicleMap和相同的自定义类和marshaller,我从IDE运行它没有任何问题。只有在运行从IDE使用我的库的项目时才会出现此问题。
所以我认为这可能与类加载顺序有关,也可能没有,或者可能是IDE中缺少的某些依赖项。
我能做些什么来找出我无法从IDE运行的原因吗?
答案 0 :(得分:0)
肯定看起来像某种配置问题。
通过使用-XX:+TraceClassLoading
运行代码并比较程序成功/不成功执行之间的输出,您可以获得有关正在进行的类加载的更多信息。