如何列出 wildfly 部署的 http servlet

how to list wildfly deployed http servlets

如何列出 wildfly(版本 16)部署的 http servlets?从 web 控制台端口 8080 还是 cli? 我已经部署了一个工作示例:

2021-04-07 19:10:28,579 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0027: Starting deployment of "h2-console.war" (runtime-name: "h2-console.war")
2021-04-07 19:10:28,719 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 124) WFLYUT0021: Registered web context: '/h2-console' for server 'default-server'

这有效:http://172.21.93.102:8080/h2-console/console/login.jsp?jsessionid=bf0d51b655f42eb956ba4f2bf98a1de9

是否可以列出已部署的 http servlet,类似于已部署的 EJB 列表? 是否必须部署 EJB,而可以说 http servlet 在启动时关闭 web.xml "load-on-startup" :

<servlet>
    <servlet-name>H2Console</servlet-name>
    <servlet-class>org.h2.server.web.WebServlet</servlet-class>
    
    <init-param>
        <param-name>webAllowOthers</param-name>
        <param-value></param-value>
    </init-param>
    <init-param>
        <param-name>trace</param-name>
        <param-value></param-value>
    </init-param>
    
    <load-on-startup>1</load-on-startup>
</servlet>

在 Web 控制台的 configuration/runtime 选项卡中有一些“undertow”http 服务器会话,但我找不到 servlet 列表

配置选项卡:

运行时选项卡:

已部署的 EJB 列表(另外显示 jar/war):

更新:

Runtime -> Server -> Web -> Deployment -> deployment -> view 确实显示了已部署的 servlet,如正确答案所示,除此之外,我需要从servlet,但我有这个错误:

javax.naming.NameNotFoundException: MFProLoginBean/remote -- 服务 jboss.naming.context.java.MFProLoginBean.remote

此 EJB 列在 wildfly 16 的 Web 控制台中,可通过 wget 获取:http://wildfly:8080//TServerXmlRpc/login/PreLoginServlet

EJB(好像是EJB 3.0?):

import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import org.jboss.annotation.ejb.Clustered;
import org.jboss.annotation.ejb.RemoteBinding;
import org.jboss.annotation.ejb.RemoteBindings;

@Clustered
@Stateless
@RemoteBindings({
        @RemoteBinding(jndiBinding = "MFProLoginBean/remote"),
        @RemoteBinding(jndiBinding = "MFProLoginBean/httpremote", clientBindUrl = "servlet://${tserver.ejb3.client.address}${tserver.ejb3.client.port}${tserver.ejb3.client.url}", factory = it.company.tserver.ejb3.StatelessClusterProxyFactory.class) })
public class MFProLoginBean implements MFProLogin, MFProLoginLocal {

servlet 中失败的调用:

public class LoginServlet 扩展了 HttpServlet {

私有无效进程(HttpServletRequest 请求,HttpServletResponse 响应)抛出 ServletException,IOException {

javax.naming.Contextctx=InitialContextFactory.create(); MFProLogin loginBean = (MFProLogin) ctx.lookup("MFProLoginBean/remote");

TUserSession userSession = loginBean.loginUser(authReq, new TInfoRequest(launcherVersion, descriptorVersion, environmentPath));

这些变量在 wildfly 启动脚本中设置:

JBoss Bootstrap 环境

JBOSS_HOME: /opt/wildfly

JAVA: /usr/bin/java

JAVA_OPTS: -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n -Dtserver.ejb3.client.address=jbosscollaudomfpro.classlocale.it -Dtserver.ejb3.client.port=:8080 -Dtserver.ejb3.client.url=//unified-invoker/Ejb3ServerInvokerServlet?return-exception=true
-Dtserver.http.client.address=jbosscollaudomfpro.classlocale.it -Dtserver.http.client.port=8080 -Dtserver.jms.http.client.url=/jmsmessaging/connector
-Dorg.jboss.logging.Log4jService.catchSystemOut=false -Dlogmanager.log4jimpl.properties=tserver-log4j.properties -DpropsDomain=

从 AS 7 开始不再使用“unified-invoker.sar”?

这似乎可以替代 java 变量? :

package it.company.tserver.ejb3;

import org.jboss.annotation.ejb.RemoteBinding;
import org.jboss.annotation.ejb.RemoteBindingImpl;

public class StatelessClusterProxyFactory extends org.jboss.ejb3.stateless.StatelessClusterProxyFactory 
{
    @Override
    public void setRemoteBinding(RemoteBinding binding) {
        String uri = binding.clientBindUrl();
        if (uri!=null && uri.indexOf("${")>=0) {
            uri = ReplacePropertiesUtil.replace(uri);
            RemoteBindingImpl b = new RemoteBindingImpl(binding.jndiBinding(), binding.interceptorStack(), uri, binding.factory());
            super.setRemoteBinding(b);
        }
        else
            super.setRemoteBinding(binding);
    }
}

在 Web 控制台中转到运行时 -> 服务器 -> Web -> 部署然后 select 你想要的部署并单击“查看”。从那里您可以看到左侧 Servlet 选项卡中的 servlet。

在 CLI 中,您可以执行类似以下的命令来列出名称。

/deployment=YOUR.war/subsystem=undertow:read-children-names(child-type=servlet)

或类似以下内容以列出更多详细信息:

/deployment=helloworld-html5.war/subsystem=undertow:read-children-resources(child-type=servlet, include-runtime=true)