aspose file tools*
The moose likes Jython/Python and the fly likes Jython code not working for Horizontal Clustering Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Languages » Jython/Python
Bookmark "Jython code not working for Horizontal Clustering " Watch "Jython code not working for Horizontal Clustering " New topic
Author

Jython code not working for Horizontal Clustering

arvind pai
Greenhorn

Joined: Sep 03, 2008
Posts: 1
Hi,
I got the foll error when working on Websphere NW Dmgr and 2 custom profile nodes with the WAS Version being 6.1.0.17 :

WASX7017E: Exception received while running file "configure_server.py"; exception information: com.ibm.bsf.BSFException: exception from Jython:
Traceback (innermost last):
File "", line 184, in ?
File "", line 156, in addSSLSignerCertsFromPropfile

com.ibm.ws.scripting.ScriptingException: com.ibm.websphere.management.cmdframewo
rk.CommandException
com.ibm.websphere.management.cmdframework.CommandValidationException: The keyStores name NodeDefaultTrustStore and scopeName (cell) mgr01Cell01 is not found

The 2 functions involved but do not know why it is asking for Dmgr node when actually the certs have to be put in Cluster created eg "TESTCLUSTER" and not on single server instances.
Kindly have a look and suggest what could be the issue, I tried removing the nodename and adding the cluster name instead in the code but still the same error.

1st Function :
+++++++++++++
def addSSLSignerCertsFromPropfile(pfile, nodeName=None):
"""Adds signer certs as defined in properties file on a node.
If node is empty, this is WAS base, single node and it needs not be specified."""
scriptlog.entry()
iter = pfile.getPropertyGroupIterator("signercert")
while iter.hasNext():
scriptlog.info ("Adding signer certificate from group %s" \
% iter.getCurrentPrefix())
alias = iter.getCurrentProperty("alias")
file = iter.getCurrentProperty("file")
if file==None or file=="" \
or alias==None or alias=="":
scriptlog.error ("Certificate alias (alias)"+\
" and full path to certificate file (file) must both be specified for a Signer Certificate")
raise ValueError ("Incomplete Signer Certificate specification")

# convert file name to full path
dirname = os.path.dirname(file)
if dirname == None or dirname == "":
# file name only, no dir; prepend current dir
file = os.path.abspath(os.path.join (".", file))
scriptlog.debug ("File name is %s" % file)

if not os.path.exists(file) and os.path.isfile(file):
scriptlog.error("File %s does not exist" % file)
raise ValueError ("Signer Certificate file does not exist")

# to guard against quote expansion, replace backslash with forward slash
file = file.replace("\\", "/")
wsadmin_funcs.addSignerCertificate("NodeDefaultTrustStore", file, alias, nodeName)
scriptlog.exit()


2nd Function:
+++++++++++++
def addSignerCertificate(keystorename, certfile, alias, nodeName=None, isBase64="false"):
"""Adds a signer certificate from a certificate file to a key store.
If node name is specified, it is the scope.
For ND, node name must be specified."""
entry()
keystorestring = "-keyStoreName " + keystorename
if nodeName!=None and nodeName!="":
cellName = getCellName()
keystorestring += " -keyStoreScope '(cell):%s node):%s'" % (cellName, nodeName)
debug ("checking if cert alias is already in store")
# check if this alias already exists in store;
certlist = filter(None, AdminTask.listSignerCertificates(keystorestring).split(lineSeparator))
debug ("cert list obtained")
for cert in certlist:
# we need to find [alias xxxx]
wordlist = cert.split()
if wordlist.count("[alias")>0:
indexx = wordlist.index("[alias")
debug ("[alias is item # %d" % indexx)
old_alias = wordlist[indexx+1]
# chop off trailing "]"
if old_alias[:-1]==alias:
# if exists, delete alias
warning \
("Signer certificate alias %s already exists and will be deleted"\
% alias)
AdminTask.deleteSignerCertificate\
(keystorestring + " -certificateAlias " + alias)
info ("old certificate deleted")
break
if isBase64 !="true":
isBase64 = "false"
command = keystorestring + \
" -certificateFilePath '%s' -certificateAlias %s -base64Encoded %s" \
% (certfile, alias, isBase64)
debug ("about to execute AdminTask command: " + command)
AdminTask.addSignerCertificate(command)
exit()

[ September 03, 2008: Message edited by: arvind pai ]

[ September 03, 2008: Message edited by: arvind pai ]
[ September 03, 2008: Message edited by: arvind pai ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jython code not working for Horizontal Clustering