jython script: Mail Session attribute is set but when i restart the console it is not able to detect the mail seesion

丶灬走出姿态 提交于 2019-12-12 02:33:59

问题


I have written Jython script to create a mail session in IBM websphere.

Jython Script :

import sys

nodeName =sys.argv[0]
serverName =sys.argv[1]

def createSession(nodeName,serverName):
     print "Creating mailsession"
     ds =AdminConfig.getid('/Node:'+nodeName+'/Server:'+serverName+'/MailProvider:Built-in Mail Provider/')
     print ds
     print AdminConfig.required('MailSession')
     name = ['name','MailSession']
     jndi = ['jndiName','mail/Session']
     host = ['mailTransportHost','mailhost.misys.global.ad']
     storehost = ['mailStoreHost','mailhost.misys.global.ad']
     mailAttrs=[name,jndi,host,storehost]
     print mailAttrs
     ss = AdminConfig.create('MailSession',ds,mailAttrs)
     AdminConfig.save()

After running the script i am able to see mail session created by script in console. but it is throwing an error on server as below :

[Root exception is javax.naming.NameNotFoundException: Context: MyServer20Cell/nodes/MyServer20Node/servers/MyServer20,
name: mail/Session: First component in name mail/Session not found. 

But the strange thing is when i opened the IBM Console and go to mail Session , without modifying any value in mail session, click on apply changes ,save it and restart the server .It Works fine and server is not throwing any error.

Can any one tell did i have done anything wrong in Script. How i can resolve this issue.


回答1:


This problem is solved. need to add this property - mailTransportProtocol and add it in attributes



来源:https://stackoverflow.com/questions/43361687/jython-script-mail-session-attribute-is-set-but-when-i-restart-the-console-it-i

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!