简体   繁体   中英

WebSphere wsadmin script to create custom properties for JMS provider

I have created a custom JMS provider in WebSphere 8. Now I want to add custom properties to this JMS provider, but the usual procedure does not work.

I created the JMS provider with the following commands (Jython):

server = AdminConfig.getid('/Cell:cell/Node:node0/Server:appserver/')
jms_provider = AdminConfig.create('JMSProvider', server, '[[name "ActiveMQ"] [externalInitialContextFactory "org.apache.activemq.jndi.ActiveMQWASInitialContextFactory"] [externalProviderURL "tcp://10.1.1.1:61616"]]')

Usually, I would get a custom property set in order to popultate it, but I just get "None":

wsadmin> print(AdminConfig.showAttribute(jms_provider, 'propertySet'))
(None)

Creating a new one does not work either:

wsadmin> AdminConfig.create('J2EEResourceProperty', jms_provider, [])

WASX7015E: Exception running command: "AdminConfig.create('J2EEResourceProperty', jms_provider, [])"; exception information:
 com.ibm.ws.scripting.ScriptingException: WASX7129E: Cannot create objects of type "J2EEResourceProperty" in parents of type "JMSProvider"

How can I create the initial property set for a JMS provider?

Solution was to create a J2EEResourcePropertySet instead of a J2EEResourceProperty:

props = AdminConfig.create('J2EEResourcePropertySet', jms_provider, [])
AdminConfig.create('J2EEResourceProperty', props, '[[name "java.naming.queue.Queue1"] [value "Queue1"]]')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM