cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1079
Views
1
Helpful
1
Replies

System.console() sometimes returns null when using the command "java -cp . com.cisco.axl.shn.AUBV"

jialinli
Level 1
Level 1

Hi,

I start my code with this sample : https://developer.cisco.com/site/axl/learn/how-to/axl-java-sample-application.gsp

The problem I met is that, for example, when I ran the command "java -cp .  com.cisco.axl.shn.AUBV" in shell directly, everything went well, but when I put the command in a shell file, like "upgradeBEV.sh"  which is triggered by another server, System.console() sometimes returns null. The code about the console is :

//verify JVM has a console

    Console cons = System.console();

    if(cons == null){

   System.err.println("The Cisco AXL Sample App requires a console.");
   System.exit(1);

    } else {

   AUBV.informUser("%nWelcome to Alpha Daily Upgrade Tool.%n");

    }

Sometimes more than one java are triggered, the time interval is about ten minutes, then some application could get the console while others could not. Seems AXL requires the console...  I'm using centOS 6.5 to run the script. How can I fix this problem? I'd like to run serveral scripts at the same time (or with minutes apart). Are there any ways to get multiple consoles?

Thanks,

Jialing

1 Reply 1

dstaudt
Cisco Employee
Cisco Employee

As the AXL service is just an HTTP web service, on its own there is no dependency on a Java console.  I suspect what you are experiencing is a limitation or issue with a Java WSDL framework you may be using, or perhaps the JVM version itself...

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: