我正在使用Trident風暴並試圖在函數prepare方法內啓動一個網格實例。同樣的配置文件適用於本地集羣。當我在remore集羣中提交它時,我得到錯誤。Gridgain異常java.lang.IncompatibleClassChangeError:實現類
代碼:
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]
謝謝..這是由於該項目內有多個log4j罐子。我做了一些清理並投入了網格增值版本,它運行良好。 – user3072054