Question

Problem: Attempting to use the JYTHON command below and I cannot retrieve the id of my active specification defined at a node-server level in Websphere. I believe its a syntax issue but I'm not sure what.

Code:

AdminConfig.getid('/Cell:mycell/Node:mynode/Server:myserver/J2CActivationSpec:myActiveSpecName/')

Problem Notes:

  • I do not get a invalid object error so I believe I have the syntax right but it just cannot find the resource even though it exists.
  • I am using the AdminConfig.getid() as a way to check if the resource already exists in order to do a modify or a create.
  • If I use the following code: AdminConfig.getid('/J2CActivationSpec:myActiveSpecName/') it will find it but not if I use a more specific path listed above.

Reference Material:

IBM Documentation

Was it helpful?

Solution

Containment paths are always a little tricky. In my (limited) experience, even if you can trace the path by AdminConfig.parents, you may not always be able to use getid.

Are you restricted to using getid? If not, here are some alternatives that will get you an ActivationSpec at the /Cell/Node/Server level:

Querying using AdminConfig.list

This approach will list the Activation Specifications at the specified scope (in our case, the server), and grab the one that has it's name attribute equal to 'myActiveSpecName'.

server = AdminConfig.getid('/Cell:mycell/Node:mynode/Server:myserver')
activationSpec = ''

for as in AdminConfig.list('J2CActivationSpec', server).splitlines():
    if AdminConfig.showAttribute(as, 'name') == 'myActiveSpecName'
        activationSpec = as
        print 'found it :)'

Using Wildcards

This approah uses AdminConfig.list as well, but with a pattern to narrow down your list. If you know your activation spec's configuration begins with myActiveSpecName, then you can do the following:

activationSpec = AdminConfig.list('J2CActivationSpec', 'myActiveSpecName*')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top