Mule可以运行JavaEE Web应用程序吗? [英] Can Mule run a JavaEE web-application?

查看:85
本文介绍了Mule可以运行JavaEE Web应用程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Java servlet转换为Mule Web服务,但我的程序有多个类。我已经看过很多关于在Java组件中使用POJO和Mule的教程,但从来没有一个包含多个类的程序。如何做到这一点?

I'm trying to turn a Java servlet into a Mule web service, but my program has more than one class. I've seen many tutorials about using POJOs with Mule in a Java component, but never a program with several classes. How can this be done?

编辑:我的servlet当前正在tomcat服务器上运行。它接收带有搜索详细信息的xml文档,搜索数据库,然后输出带有搜索结果的xml文档。 xml解析和生成,以及数据库连接和查询都由servlet当前处理。我只是希望能够使用Mule而不是在tomcat服务器上运行它。

My servlet is currently running on a tomcat server. It takes in an xml document with details for a search, searches a database, then outputs an xml document with the search results. The xml parsing and generation, and the database connection and queries are all handled by the servlet currently. I'd just like to be able to run it using Mule, rather than on the tomcat server.

推荐答案

Mule可以运行JavaEE web-apps归功于其嵌入式Jetty容器。

Mule can run JavaEE web-apps thanks to its embedded Jetty container.

查看随独立分发捆绑的Bookstore示例,了解它是如何完成的。这个例子确实在Mule独立版中部署了两个web-apps, bookstore bookstore-admin

Look at the Bookstore example that comes bundled with the standalone distribution to see how it is done. This example indeed does deploy two web-apps, bookstore and bookstore-admin inside Mule standalone.

假设你的web-app是 xmlproc.war ,你在Mule应用程序Zip中想要的布局是:

Assuming your web-app is xmlproc.war, the layout you want in your Mule application Zip is:

.
├── mule-config.xml
├── classes
│   ├── <classes and resources from xmlproc/WEB-INF/classes>
├── lib
│   ├── <non-provided libs from xmlproc/WEB-INF/lib>
└── webapps
    └── xmlproc
        ├── <jsps>
        └── WEB-INF
            └── web.xml

With mule-config.xml:

With mule-config.xml:

<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:jetty="http://www.mulesoft.org/schema/mule/jetty"
      xsi:schemaLocation="
        http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
        http://www.mulesoft.org/schema/mule/jetty http://www.mulesoft.org/schema/mule/jetty/current/mule-jetty.xsd">

    <jetty:connector name="jettyConnector">
        <jetty:webapps directory="${app.home}/webapps" port="8083"/>
    </jetty:connector>
</mule>

未提供库意味着你不应该嵌入找到的库在$ MULE_HOME / lib /**.

Non-provided libs means you shouldn't embed libs that are found under $MULE_HOME/lib/**.

这篇关于Mule可以运行JavaEE Web应用程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆