await导致incompatibleClassChangeError的方法:实现类

时间:2015-08-21 10:57:07

标签: java playframework playframework-1.x

我使用play-1.2.5。对于async我在我的控制器中使用await()方法。但是在我的应用程序启动期间await()导致IncompatibleClassChangeError。我真的不明白这个原因。

当我评论await()行时,该错误就消失了。

这是我的控制器操作:

public static void loadScheduledConfigs() {
    Future<JsonObject> future = Startup.THREAD_POOL.submit(new MyCallable());
    JsonObject object = null;
    /*
    I also tried this
        Future<JsonObject> future =  new FutureTask<JsonObject>( new MyCallable());
        JsonObject object =  await(future);
    */
    try{
        object = future.get(); 
    }catch(Exception e) {
        log.error(e.getMessage(), e);
    }
    renderJSON(object);
}

例外:

Oops: IncompatibleClassChangeError
An unexpected error occured caused by exception IncompatibleClassChangeError: Implementing class

play.exceptions.UnexpectedException: Unexpected Error
    at play.Invoker$Invocation.onException(Invoker.java:244) ~[play-1.2.5rc4.jar:na]
    at play.Invoker$Invocation.run(Invoker.java:286) ~[play-1.2.5rc4.jar:na]
    at Invocation.HTTP Request(Play!) ~[na:na]
Caused by: java.lang.IncompatibleClassChangeError: Implementing class
    at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.7.0_07]
    at java.lang.ClassLoader.defineClass(ClassLoader.java:791) ~[na:1.7.0_07]
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.7.0_07]
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) ~[na:1.7.0_07]
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71) ~[na:1.7.0_07]
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[na:1.7.0_07]
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[na:1.7.0_07]
    at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_07]
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[na:1.7.0_07]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423) ~[na:1.7.0_07]
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) ~[na:1.7.0_07]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ~[na:1.7.0_07]
    at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.7.0_07]
    at java.lang.ClassLoader.defineClass(ClassLoader.java:791) ~[na:1.7.0_07]
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) ~[na:1.7.0_07]
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) ~[na:1.7.0_07]
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71) ~[na:1.7.0_07]
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361) ~[na:1.7.0_07]
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[na:1.7.0_07]
    at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_07]
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354) ~[na:1.7.0_07]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423) ~[na:1.7.0_07]
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) ~[na:1.7.0_07]
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356) ~[na:1.7.0_07]
    at play.classloading.enhancers.ContinuationEnhancer.enhanceThisClass(ContinuationEnhancer.java:74) ~[play-1.2.5rc4.jar:na]
    at play.CorePlugin.enhance(CorePlugin.java:297) ~[play-1.2.5rc4.jar:na]
    at play.plugins.PluginCollection.enhance(PluginCollection.java:551) ~[play-1.2.5rc4.jar:na]
    at play.classloading.ApplicationClasses$ApplicationClass.enhance(ApplicationClasses.java:235) ~[play-1.2.5rc4.jar:na]
    at play.classloading.ApplicationClassloader.loadApplicationClass(ApplicationClassloader.java:167) ~[play-1.2.5rc4.jar:na]
    at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:431) ~[play-1.2.5rc4.jar:na]
    at play.Play.start(Play.java:516) ~[play-1.2.5rc4.jar:na]
    at play.Play.detectChanges(Play.java:642) ~[play-1.2.5rc4.jar:na]
    at play.Invoker$Invocation.init(Invoker.java:198) ~[play-1.2.5rc4.jar:na]
    ... 1 common frames omitted

我不知道问题是在我编码的方式,还是某些依赖关系引起了这个问题。 (我检查了我的项目的lib文件夹和类路径/依赖项,我没有找到任何冲突的库)

0 个答案:

没有答案