代码之家  ›  专栏  ›  技术社区  ›  James

列出我在Websphere中部署的所有应用程序及其各自的端口

  •  0
  • James  · 技术社区  · 6 年前

    我只想使用命令行管理WebSphere Application Server中的一些东西,但是我很难获得已部署的应用程序和端口的列表。

    我想要的:

    我需要一份我的部门应用程序及其端口的列表。我是WAS管理的新手,与Apache Web服务器相比,我需要类似命令的东西 apachectl -t -D DUMP_VHOSTS

    apachectl输出示例:

    虚拟主机配置:

    *:80 mysite.com(/etc/apache2/sites enabled/site.conf:1)

    *:443 secure.com(/etc/apache2/sites enabled/secure.conf:2)

    注意:我知道Apache和WAS不是同一件事(WAS和Apache Tomcat更相似),但它只是我想要输出的一个例子:我的应用程序列表(Apache示例中的虚拟主机)和它们各自的端口

    我现在所拥有的:

    由于需要从命令行执行此操作,因此我将按照以下步骤使用wsadmin shell(Debian服务器):

    cd <Was_Root_Dir>/AppServer/bin
    ./wsadmin.sh -lang jython -user user -password pass
    wsadmin>print AddminApp.list()
    

    结果如下:

    默认应用程序 网站 保护

    这是我想要的列表,但我不知道每个应用程序的端口,我找不到如何实现它在任何地方。

    我认为这个列表很广泛,包括所有服务器和我的WAS实例的所有配置文件中的应用程序。我就在这里吗?

    另外:

    一个包含所有已部署应用程序的列表是很好的,但是一个附加值可以是一种只过滤使用SSL安全端口的应用程序的方法。

    有可能吗?我是不是误会了什么?

    1 回复  |  直到 6 年前
        1
  •  1
  •   M I P    6 年前

    使用wsadmin listApplicationServerPorts命令列出端口,以便访问特定的应用程序。请参阅IBM KC链接( listApplicationServerPorts )更多细节。

    我已经为您准备了一个脚本,将下面的内容复制并粘贴到一个文件(script.py)中,并使用wsadmin运行它,如下所示

    ./wsadmin.sh-lang jython-user-pass-f脚本.py

    #Get the list of ALL installed APPs
    appList=AdminApp.list().splitlines()
    
    #Get the list of Application ports for each APP
    for app in appList:
        print "  "
        #print APP Name
        print app
        #Get the list of Application Ports
        portList=AdminTask.listApplicationPorts(app).splitlines()
        for port in portList:
            #Print the port Details for the APP
            print port
    

    这将打印应用程序名和应用程序端口列表。

    从这个列表中 默认主机 “端口可用于 http “而且” WC_defaulthost_安全 “为了 https协议 .