我正在使用tridentstorm并尝试在function prepare方法中启动一个网格示例。同一个配置文件适用于本地集群。。当我在remore集群中提交它时,我得到了一个错误。
代码:
public class MemoryGrid extends BaseFunction {
private static final long serialVersionUID = -4574506761580804738L;
private static final String configFileLocation = "file:///home/path/config.xml";
MemGridDAO memgriddao;
public void prepare(Map conf, TridentOperationContext context){
this.memgriddao = new MemGridDAO (configFileLocation);
}
public void execute(TridentTuple tuple, TridentCollector collector) {
try {
memgriddao.put("cahcename",tuple.getValue(0),tuple.getValue(1));
} catch (GridException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
collector.emit(null);
}
public class MemGridDAO {
public MemGridDAO(String configFile){
Grid grid = GridGain.start(configFile);
}
}
错误
java.lang.IncompatibleClassChangeError: Implementing class
at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.7.0_45]
at java.lang.ClassLoader.defineClass(ClassLoader.java:800) ~[na:1.7.0_45]
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.7.0_45]
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) ~[na:1.7.0_45]
at java.net.URLClassLoader.access$100(URLClassLoader.java:71) ~[na:1.7.0_45]
at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[na:1.7.0_45]
at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[na:1.7.0_45]
at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_45]
at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[na:1.7.0_45]
at java.lang.ClassLoader.loadClass(ClassLoader.java:425) ~[na:1.7.0_45]
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) ~[na:1.7.0_45]
at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ~[na:1.7.0_45]
at java.lang.Class.forName0(Native Method) ~[na:1.7.0_45]
at java.lang.Class.forName(Class.java:190) ~[na:1.7.0_45]
at org.gridgain.grid.util.GridUtils.addLog4jNoOpLogger(GridUtils.java:7697) ~[stormjar.jar:na]
at org.gridgain.grid.kernal.GridGainEx.start(GridGainEx.java:732) ~[stormjar.jar:na]
at org.gridgain.grid.kernal.GridGainEx.start(GridGainEx.java:677) ~[stormjar.jar:na]
at org.gridgain.grid.kernal.GridGainEx.start(GridGainEx.java:524) ~[stormjar.jar:na]
at org.gridgain.grid.kernal.GridGainEx.start(GridGainEx.java:494) ~[stormjar.jar:na]
at org.gridgain.grid.GridGain.start(GridGain.java:314) ~[stormjar.jar:na]
2条答案
按热度按时间zc0qhyus1#
看起来在远程集群应用程序类路径中有多个不兼容的log4jjar版本(很可能,其中一个是gridgain依赖项,另一个已经存在于应用程序依赖项中)。
您需要使用与gridgain相同的log4j版本,或者将gridgain配置为使用非log4j日志。例如,如果您想保留您的log4j版本,可以使用
GridSlf4jLogger
以及适当的slf4j-to-log4j绑定。li9yvcax2#
这可能是一个编译问题。试着干净利落。可能是因为.class文件中所有依赖类之间不匹配。
CompatibleClassChangeError扩展了linkageerror,该错误与编译子类后发生更改的基类引起的问题有关。
更多信息:http://examples.javacodegeeks.com/java-basics/exceptions/java-lang-incompatibleclasschangeerror-how-to-resolve-incompatible-class-change-error/