本文介绍了将应用程序入可部署的WAR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将Mule应用程序直接转换为war文件,以在Jboss应用服务器中进行部署,我尝试并失败了,因为手动创建了war文件,如所述此处,并通过,但在这部分上仍不清楚.请提供帮助举个例子.注意:我的示例m子应用程序中没有Mule-config.xml文件

How the Mule application can be directly convert into a war file, to deploy in Jboss application server, i tried and failed with creating the war file manually as mentioned here and gone through this too, but still didn't get a clear view on this part.Provide a assistance with example. Note: there is no Mule-config.xml file in my sample mule application program

推荐答案

  • pom.xml中,确保您拥有<packaging>war</packaging>
  • 使用下面的模板创建src/main/webapp/WEB-INF/web.xml,用逗号分隔的Mule配置列表替换YOUR_CONFIGS,并用所需的Mule servlet路径替换YOUR_PATH
  • 将所有入站HTTP端点替换为Servlet端点,例如<servlet:inbound-endpoint path="/YOUR_ENDPOINT_PATH" />
    • In the pom.xml, ensure you have <packaging>war</packaging>
    • Create src/main/webapp/WEB-INF/web.xml using the template below, replacing YOUR_CONFIGS with a comma-separated list of Mule configurations and YOUR_PATH with the path you want for the Mule servlet,
    • Replace all your inbound HTTP endpoints with Servlet endpoints, like <servlet:inbound-endpoint path="/YOUR_ENDPOINT_PATH" />
    • 你应该很好!

      web.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
          version="2.5">
      
          <context-param>
              <param-name>org.mule.config</param-name>
              <param-value>YOUR_CONFIGS</param-value>
          </context-param>
      
          <listener>
              <listener-class>org.mule.config.builders.MuleXmlBuilderContextListener</listener-class>
          </listener>
      
          <servlet>
              <servlet-name>muleServlet</servlet-name>
              <servlet-class>org.mule.transport.servlet.MuleReceiverServlet</servlet-class>
          </servlet>
          <servlet-mapping>
              <servlet-name>muleServlet</servlet-name>
              <url-pattern>/YOUR_PATH/*</url-pattern>
          </servlet-mapping>
      </web-app>
      

      编辑:我已经开源了一个正在运行的演示: https: //github.com/ddossot/mule-webapp-example

      EDIT I've open-sourced a running demo: https://github.com/ddossot/mule-webapp-example

      这篇关于将应用程序入可部署的WAR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 00:54