1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

how to list wildfly deployed http servlets

Discussão em 'StackOverflow' iniciado por Stack, Abril 22, 2021.

  1. Stack

    Stack Membro Participativo

    how to list wildfly (version 16) deployed http servlets ? either from web console port 8080 or the cli ? I have deployed a working example :

    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'


    this works : http://172.21.93.102:8080/h2-console/console/login.jsp?jsessionid=bf0d51b655f42eb956ba4f2bf98a1de9

    is it possible to list the deployed http servlets, similar to the list of deployed EJB ? could it be that EJB are necessarily deployed, whereas http servlets could be say switched off at startup in 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>


    in the configuration/runtime tabs of the web console there is something for "undertow" http server sessions, but I can't find a list of servlets

    configuration tab : [​IMG]

    runtime tab: [​IMG]

    list of deployed EJBs (it displays which jar/war additionally): [​IMG]

    update :

    Runtime -> Server -> Web -> Deployment -> deployment -> view does indeed show the deployed servlet, as in the correct answer, further to that, I'd need to call an EJB 3.0 bean from the servlet, but I have this error :

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

    this EJB is listed in the web console of wildfly 16, and is fetchable with wget at : http://wildfly:8080//TServerXmlRpc/login/PreLoginServlet

    the EJB (it seems 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 {


    the invocation that fails in the servlet :

    public class LoginServlet extends HttpServlet {

    private void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

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

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

    those variables are set in the wildfly start script :

    JBoss Bootstrap Environment

    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=

    that "unified-invoker.sar" is no longer used since AS 7 ?

    this seems to substitute java variables ? :

    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);
    }
    }

    Continue reading...

Compartilhe esta Página