Reputation: 2148
I am running a Jython script from wsadmin
. This is the portion where its throwing an error.
SCRIPT:
..
..
objNameString = AdminControl.completeObjectName('WebSphere:type=Server,*')
NODE_NAME=AdminControl.getAttribute(objNameString, 'nodeName')
CELL_NAME=AdminControl.getCell()
SERVER_NAME= "MyAppServer"
..
..
# Start Web application
print "Starting Web Application..."
appManager = AdminControl.queryNames('cell='+ CELL_NAME +',node='+ NODE_NAME +',type=ApplicationManager,process='+ SERVER_NAME +',*')
print appManager
AdminControl.invoke(appManager, 'startApplication', 'AppName')
print "Web Application Started..."
ERROR:
Starting Web Application...
WASX7017E: Exception received while running file "/scratch/py/CreateWPSDomain.py"; exception information: com.ibm.ws.scripting.ScriptingException: WASX7025E: Error found in String ""; cannot create ObjectName.
Anything wrong with the way I have concatenated ? Coz the error like this seems to come when values are empty or not registered properly.
Update: Is there any sample jython scripts which I can reference. My req: 1. Creates a server > 2. Install the war file > 3. Creates Datasources > 4. Starts the Server > 5. Starts the Application.
Upvotes: 0
Views: 19433
Reputation: 355
In my case, the server was up and I was still getting this error.
The issue is that I wasn't connecting to any server because I was including -conntype NONE when running the script via wsadmin.
The fix is to avoid -conntype NONE to be able to run AdminControl commands
/opt/WebSphere/AppServer/profiles/default/bin/wsadmin.sh -conntype NONE -user -password -f
Upvotes: 0
Reputation: 1
/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/bin>./wsadmin.sh -conntype NONE
WASX7357I: By request, this scripting client is not connected to any server process. Certain configuration and application operations will be available in local mode.
WASX7029I: For help, enter: "$Help help" wsadmin>wsadmin>wsadmin>securityon wsadmin IWWWWW WASX7015E: Exception running command: "securityon wsadmin IWWWWW"; exception information: com.ibm.ws.scripting.ScriptingException: AdminControl service not available
wsadmin>securityoff LOCAL OS security is off now but you need to restart server1 to make it affected.
wsadmin>
Upvotes: 0
Reputation: 1929
Please make sure that your server is started, I think when you are calling the command... the Server is not started yet. Give a delay or keep a check whether the server is up ...then issue the command
Upvotes: 4
Reputation: 2950
The error message says that ObjectName cannot be created from empty string. That empty string was returned from queryNames
.
Try this:
appManager = AdminControl.queryNames('WebSphere:cell='+ CELL_NAME +',node='+ NODE_NAME +',type=ApplicationManager,process='+ SERVER_NAME +',*')
BTW: with WDR library (http://wdr.github.io/WDR/) your script would be much simpler. With some other improvements it could look as follows:
SERVER_NAME= "MyAppServer"
# Start Web application
print "Starting Web Application..."
appManager = getMBean1(process = SERVER_NAME, type = 'ApplicationManager')
print appManager
appManager.startApplication('AppName')
print "Web Application Started..."
Disclosure: I'm one of key WDR contributors.
Upvotes: 2
Reputation: 4152
The error is thrown at this line:
AdminControl.invoke(appManager, 'startApplication', 'AppName')
Check your appManager
variable, and make sure it is not empty.
AdminControl.queryNames(..)
will return an empty string if a match is not found.
AdminControl.invoke(..)
requires an MBean descriptor (object name) string to be passed as the first argument, and the error you are receiving is wsadmin
telling you that an MBean cannot be resolved with what it received. The WASX7025E: Error found in String ""
section of the error is telling you that it received an empty string ("")
for the MBean descriptor.
Upvotes: 0