4

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

Community
  • 1
  • 1
Jeevanantham
  • 984
  • 3
  • 19
  • 48
  • i m very fresh to mule, need the assistance to move further. thanks in advance – Jeevanantham Feb 12 '13 at 11:04
  • Share what errors are you getting with the app you tried to create. – Seba Feb 12 '13 at 13:06
  • Is your Maven project packaging set to 'war'? What's the Mule configuration file name(s)? Also share your `web.xml` config. – David Dossot Feb 12 '13 at 15:53
  • hi all, i couldn't able to create the war that is my main issue.. @David Dossot, there is no web.xml file in my mule Project.How to start creating war from scratch plz assist.I have installed maven plugin, but created a project as Mule project, do i need change the Project type also? – Jeevanantham Feb 13 '13 at 03:33
  • @Seba, Mule Project works fine while run in Mule ESB, now how can i convert it into deploy-able file for Jboss. – Jeevanantham Feb 13 '13 at 05:52
  • 1
    It's not really "convertible". You can probably reuse much of the logic, but you need to remake the project structure and test it again as things work a bit different – Petter Nordlander Feb 13 '13 at 13:27

2 Answers2

6
  • 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" />

And you should be good to go!

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>

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

David Dossot
  • 33,403
  • 4
  • 38
  • 72
  • thanks @David Dossot .. May i how to deploy mule project (with out maven) directly into Mule standalone runtime. Is there any Deploy folder like Jboss, before this process do i need to build the Mule project in specific format, plz assist.. – Jeevanantham Feb 16 '13 at 05:02
  • That's a completely different question you're asking here, which is not great to do in a comment. You should use Maven to package an Mule application (packaging = mule) into a deployable ZIP that you then drop in MULE_HOME/apps (the deploy folder of Mule standalone). If you persist in not using Maven, you'll have to build a ZIP that follows this format: http://www.mulesoft.org/documentation/display/current/Application+Format – David Dossot Feb 16 '13 at 18:01
0

Here you have the required steps: http://www.mulesoft.org/documentation/display/current/Deploying+Mule+to+JBoss

Seba
  • 2,319
  • 15
  • 14