解决在线程main中发现的未捕获异常:java.lang.AbstractMethodError

时间:2017-12-28 16:58:44

标签: java python uncaught-exception

我正在尝试从python调用java服务。我将当前时间戳附加到文件名以创建动态文件名并将其作为参数传递给java命令。当我没有附加时间戳并按原样传递参数时,代码可以工作,但是当我附加时间戳时,我在线程main中发现了未捕获的异常:java.lang.AbstractMethodError 错误。

不起作用的代码:

import subprocess
import time

Class DH:

    @staticmethod
    def restart_server(CLASSPATH, CLIENT_JVM_OPTIONS, SERVER_JVM_OPTIONS, SERVER_CONNECTION, DB_CONFIG, USER, SERVER_LOG, VERBOSE_OPTION):
        subprocess.call("java -cp " + CLASSPATH + " " + CLIENT_JVM_OPTIONS + " -Djava.security.policy=..\\conf\\rmi.policy lib/main/Run -s " + SERVER_CONNECTION + " -user " + USER + " " + VERBOSE_OPTION + " shutdown SERVER")
        timestr = time.strftime("%Y%m%d - %H%M%S")
        log_file_name = "..\logs\DHLogFile" + timestr + ".log"
        print(log_file_name)
        subprocess.call("java -cp " + CLASSPATH + " " + SERVER_JVM_OPTIONS + " -Djava.security.policy=..\conf\\rmi.policy lib/main/Server -export " + SERVER_CONNECTION + " -db " + DB_CONFIG + " -log " + log_file_name + " -loglevel EFWIT " + VERBOSE_OPTION)

有效的代码,

import subprocess
import time

Class DH:

    @staticmethod
    def restart_server(CLASSPATH, CLIENT_JVM_OPTIONS, SERVER_JVM_OPTIONS, SERVER_CONNECTION, DB_CONFIG, USER, SERVER_LOG, VERBOSE_OPTION):
        subprocess.call("java -cp " + CLASSPATH + " " + CLIENT_JVM_OPTIONS + " -Djava.security.policy=..\\conf\\rmi.policy lib/main/Run -s " + SERVER_CONNECTION + " -user " + USER + " " + VERBOSE_OPTION + " shutdown SERVER")
        log_file_name = "..\logs\DHLogFile.log"
        subprocess.call("java -cp " + CLASSPATH + " " + SERVER_JVM_OPTIONS + " -Djava.security.policy=..\conf\\rmi.policy lib/main/Server -export " + SERVER_CONNECTION + " -db " + DB_CONFIG + " -log " + log_file_name + " -loglevel EFWIT " + VERBOSE_OPTION)

完整错误是:

E 28/12/17-11:37:36.358 [-5]  Uncaught exception spotted in thread main: java.lang.AbstractMethodError
E 28/12/17-11:37:36.358 [-5]  java.lang.AbstractMethodError : 
lib.main.a$a.a([Ljava/lang/String;I)I
java.lang.AbstractMethodError: lib.main.a$a.a([Ljava/lang/String;I)I
    at lib.main.a.processArgs(SourceFile:646)
    at lib.main.a.setupEnv(SourceFile:1078)
    at lib.main.Server.main(SourceFile:157)

你能帮我理解是什么给了我AbstractMethodError Exception,因为我真的想在文件名中加上时间戳。

0 个答案:

没有答案