我正在处理的项目由几个组件组成--几个被编译成JAR的独立库,以及一个引用它们的主项目。所有这些都是用Scala编写的。
我在其中一个库中内部使用了ChronicleMap,使用一个带有自己的封送处理程序的自定义值类。在运行主项目时,我收到以下错误:
/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和相同的自定义类和编组程序,那么在集成开发环境中运行它不会有任何问题。只有在IDE中运行使用我的库的项目时,才会出现问题。
因此,我认为这可能与类加载顺序有关,也可能与类加载顺序无关,或者可能与IDE中缺少的某些依赖项有关。
我能做些什么来找出我不能从IDE运行的原因吗?
发布于 2017-08-02 16:07:04
这看起来确实像是某种配置问题。
通过使用-XX:+TraceClassLoading运行代码并比较程序成功执行/不成功执行之间的输出,您可能能够获得有关正在进行的类加载的更多信息。
https://stackoverflow.com/questions/45441179
复制相似问题