I am trying to call a java service from python. I am appending current timestamp to the file name to create a dynamic file name and passing it as a parameter in the java command. When I don't append the timestamp and pass the parameter as is, the code works but when I append the timestamp, I get Uncaught exception spotted in thread main: java.lang.AbstractMethodError error.
The code that doesn't works:
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)
The code that works,
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)
The full error is:
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)
Could you please help me understand what is giving me AbstractMethodError Exception as I really want to have timestamp in the filename.