使用jython部署时NameNotFoundException

时间:2016-04-12 13:54:05

标签: jms jndi jython websphere-8 ibm-was

我正在IBM WAS上通过jython脚本部署EAR文件,但在部署时我收到错误并且应用程序没有出现。

错误代码:

     J2CA0052E: The lookup of the Activation Specification with JNDI Name jms/SampleQueueListener failed due to the following exception: javax.naming.NameNotFoundException: Context: cell01/nodes/dmgr11/servers/dmgr, name: jms/SampleQueueListener: First component in name jms/SampleQueueListener not found. [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]

jms/SampleQueueListener已经存在。我正在使用WAS 8.5.5.8并在Linux OS上通过Jython脚本部署应用程序,我也使用节点代理和dmgr。

部署应用程序的python脚本:

def installapps():
try:
    print "********************************************************"
    print "Installing  Application in IBM WAS"
    print "********************************************************"
    print "\n Installing ear file -- %s " % eFile 
    AdminApp.install(eFile,["-usedefaultbindings", "-BindJndiForEJBMessageBinding",[["samplesystemservice.jar", "ServiceActivator", "sampleservices.jar,META-INF/ejb-jar.xml", "SampleQueueListener", "jms/SampleQueueListener", "jms/SampleJMSQueue"], ["sampleystemservices.jar", "BootstrapMessageBean", "samplesystemservices.jar,META-INF/ejb-jar.xml", "SampleTopicListener", "jms/SampleTopicListener", "jms/SampleJMSTopic"]]])
AdminConfig.save()
print "***************hello22***********"
AdminApp.install(wFile, ["-appname", wName, "-contextroot", ctxroot])
print "***************hello33**********"
    AdminConfig.save()
    print "Completed installing applications.\n"
    print "Saving configuration. This may take time, please wait...."
    print "********************************************************\n"
    print "********************************************************"
    print "Completed the installation of  Application in IBM WAS"
    print "********************************************************"
except:
    AdminControl.stopServer("server1", node)
print "Unable to install  Application"
print "********************************************************"
sys.exit(0)
try:
    print "********************************************************"
    print "Stop the WAS for post configuration of  Application"
    AdminControl.stopServer("server1", node)    
except:

1 个答案:

答案 0 :(得分:2)

您必须修复脚本。目前您正在将应用部署到Context: cell01/nodes/dmgr11/servers/dmgr, name: jms/SampleQueueListener服务器,请参阅上下文:

server1

dmgr服务器仅用于管理,而不用于部署您自己的应用和资源。如果要部署到ND环境,则需要提供nodeName和serverName或clusterName。通常,应用程序的服务器称为MapModulesToServers。如果您没有任何服务器,则可能需要创建它。

我建议先使用网络管理控制台,直到您更好地了解拓扑和管理。

<强>更新

您需要将模块映射到正确的服务器,请参阅AdminApp.install('DefaultApplication.ear', ['-appname', 'TEST', '-MapModulesToServers', [['.*', '.*', 'WebSphere:cell=myCell,node=myNode,server=myServer']]]) 选项,如下所示:

AdminApplication.installAppWithNodeAndServerOptions(appName, earFile,
 nodeName, serverName)

或者您可以使用库中提供的脚本,这可能更容易,更方便:

start on (local-filesystems and net-device-up IFACE=eth0)
stop on runlevel [!12345]

respawn

setuid myuser
setgid myuser

chdir /home/myuser/

exec . bin/runapp

另见:

相关问题