Java 为什么 Jboss 比 Tomcat“更好”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3672859/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-14 03:22:02  来源:igfitidea点击:

Why is Jboss "better" than Tomcat?

javatomcat6jboss5.x

提问by Chepech

I'm currently starting a new app development. The app architect insists we use JBoss5because its "better". Do anyone has a wider definition of "better" (if its the case)?

我目前正在开始一个新的应用程序开发。应用程序架构师坚持我们使用JBoss5,因为它“更好”。有没有人对“更好”有更广泛的定义(如果是这样的话)?

I have experience using Tomcat5and 6 in large scale applications with big user loads and it handles pretty well (IMHO). Both would be running over a RedHat6in identical hardware conditions (in case the implementation matters).

我有在具有大用户负载的大型应用程序中使用Tomcat5和 6 的经验,并且它处理得很好(恕我直言)。两者都将在相同的硬件条件下运行在RedHat6上(以防实现很重要)。

Thanks in advance

提前致谢

采纳答案by Javid Jamae

To say that any tool or framework is just 'better' is ridiculous. It always depends on the situation, architecture, etc. You don't necessarily want to use a hammer to drive a screw.

说任何工具或框架只是“更好”是荒谬的。它始终取决于情况、架构等。您不一定要使用锤子来驱动螺钉。

I wrote JBoss in Action, so I obviously like the JBoss technology, but I'll be the first to say that JBoss can be overkill in many situations. For example, for the last two sites I've developed, it made more sense to build with Grails and deploy on a standalone Tomcat instance.

我写了 JBoss in Action,所以我显然喜欢 JBoss 技术,但我会第一个说 JBoss 在许多情况下可能是矫枉过正。例如,对于我开发的最后两个站点,使用 Grails 构建并部署在独立的 Tomcat 实例上更有意义。

Its a bit unfair to say that all you get when using JBoss is EJB and JMS. JBoss offers many services and features, including:

说使用 JBoss 时你得到的只是 EJB 和 JMS 有点不公平。JBoss 提供许多服务和功能,包括:

  • Servlet/JSP container
  • JNDI
  • EJB
  • JTA
  • clustering
  • caching
  • JMS
  • Datasource / Resource management
  • JMX integration
  • OSGi support
  • web services
  • portals
  • Web Beans (Seam)
  • Some administrative consoles
  • an IoC container
  • etc.
  • Servlet/JSP 容器
  • JNDI
  • EJB
  • JTA
  • 聚类
  • 缓存
  • 联合管理系统
  • 数据源/资源管理
  • JMX 集成
  • OSGi 支持
  • 网页服务
  • 门户网站
  • 网豆(接缝)
  • 一些管理控制台
  • 一个 IoC 容器
  • 等等。

The thing that attracts many architects to JBoss is its flexibility. It uses a plugin architecture that allows you to add and remove services. As other have said, in uses Tomcat as its Servlet container, so you can literally whittle JBoss down to where it is practically just a Tomcat server. What is the benefit of doing this? Future proofing if you think that you're going to utilize other features of JBoss.

JBoss 吸引许多架构师的地方在于它的灵活性。它使用插件架构,允许您添加和删除服务。正如其他人所说,in 使用 Tomcat 作为其 Servlet 容器,因此您可以从字面上将 JBoss 缩减到它实际上只是一个 Tomcat 服务器的位置。这样做有什么好处?如果您认为您将使用 JBoss 的其他功能,则可以面向未来。

These services in JBoss come pre-integrated and strive to provide a consistent deployment model that minimizes your effort in writing application logic or configuration to integrate them yourself. That being said, other frameworks like Spring also do a great job of supporting a uniform ways of integrating many popular libraries and frameworks. But since they focus on integrating 3rd party libraries, the interoperability between services is up to you. Because JBoss is building the services and the integration platform, they spend time developing (and providing support) for interoperability.

JBoss 中的这些服务是预先集成的,并努力提供一致的部署模型,最大限度地减少编写应用程序逻辑或配置以自行集成它们的工作。话虽如此,其他框架(如 Spring)在支持以统一方式集成许多流行的库和框架方面也做得很好。但由于他们专注于集成 3rd 方库,因此服务之间的互操作性取决于您。因为 JBoss 正在构建服务和集成平台,所以他们花时间开发(并提供支持)以实现互操作性。

Some questions to ask when making a choice are:

做出选择时要问的一些问题是:

  • Are you going to use standard JavaEE architectural components like EJB?
    • BTW, EJB can be run in standalone Tomcat using the JBoss embedded container, so if EJB is all you're using, then you still don't have to use JBoss
  • Are you going to utilize Web Services, Portals, JMS?
  • Are you looking into building with Web Beans or Seam?
  • What deployment platforms (Tomcat, JBoss, etc) does your IT, support, and development staff currently use? If you are going to use something new, you will incur additional cost to learn the new platform.
  • If you're selling a product that customers will deploy, what impact will it have on the customers' IT organization.
  • Are you going to need paid support?
    • You can find support for Tomcat through many companies (including Red Hat I believe).
    • You'll need to compare the costs, because I don't think JBoss support is cheap, though I haven't looked up prices lately.
  • Will you need to do any sophisticated clustering?
    • JBoss has some wonderful clustering capabilities, and you'll probably get good clustering support through Red Hat. Though, for full disclosure, I've never done any complex clustering with any other frameworks to be able to compare.
  • Are you going to need advanced transaction management (distributed transactions, 2-phase commits, etc)
  • 您是否打算使用标准的 JavaEE 架构组件,如 EJB?
    • 顺便说一句,EJB 可以使用 JBoss 嵌入式容器在独立的 Tomcat 中运行,所以如果您只使用 EJB,那么您仍然不必使用 JBoss
  • 您打算使用 Web 服务、门户、JMS 吗?
  • 您是否正在考虑使用 Web Beans 或 Seam 进行构建?
  • 您的 IT、支持和开发人员目前使用哪些部署平台(Tomcat、JBoss 等)?如果您打算使用新的东西,您将需要支付额外的费用来学习新平台。
  • 如果您销售的是客户将部署的产品,它将对客户的 IT 组织产生什么影响。
  • 您需要付费支持吗?
    • 您可以通过许多公司(我相信包括 Red Hat)找到对 Tomcat 的支持。
    • 您需要比较成本,因为我认为 JBoss 支持并不便宜,尽管我最近没有查过价格。
  • 您是否需要进行任何复杂的聚类?
    • JBoss 具有一些出色的集群功能,您可能会通过 Red Hat 获得良好的集群支持。不过,为了全面披露,我从未与任何其他框架进行过任何复杂的聚类以进行比较。
  • 您是否需要高级事务管理(分布式事务、两阶段提交等)

Not to sound like a shameless plug, but the first chapter of JBoss in Action is available for freeon the Manning website. Though we don't do a directcomparison between JBoss and other applications servers and deployment environments in the chapter, we do talk about the architectural differences a bit, which is relevant to your question.

听起来不像是一个无耻的插件,但 JBoss in Action 的第一章在 Manning 网站上免费获得。虽然我们在本章中没有直接比较 JBoss 和其他应用程序服务器和部署环境,但我们确实谈到了架构差异,这与您的问题相关。

回答by duffymo

I'm currently starting a new app development. The app architect insists we use JBoss5 because it's "better". Do anyone has a wider definition of "better" (if its the case)?

我目前正在开始一个新的应用程序开发。应用程序架构师坚持我们使用 JBoss5,因为它“更好”。有没有人对“更好”有更广泛的定义(如果是这样的话)?

Funny, because JBOSS uses Tomcat as its servlet/JSP engine.

有趣,因为 JBOSS 使用 Tomcat 作为它的 servlet/JSP 引擎。

Sounds like "better" means "supports EJBs and JMS", because Tomcat out of the box has neither.

听起来“更好”的意思是“支持 EJB 和 JMS”,因为开箱即用的 Tomcat 两者都没有。

But that's not an issue if your application doesn't use EJBs or JMS.

但是,如果您的应用程序不使用 EJB 或 JMS,这不是问题。

And if you do need them, you can add them to Tomcat with OpenEJB and RabbitMQ or ActiveMQ.

如果您确实需要它们,您可以使用 OpenEJB 和 RabbitMQ 或 ActiveMQ 将它们添加到 Tomcat。

I'd ask your app arch when the last time they wrote something besides Power Point slides or UML documents. The response might surprise you.

我会问你的应用程序架构,他们最后一次写除了 Power Point 幻灯片或 UML 文档之外的东西是什么时候。答案可能会让您感到惊讶。

回答by Pascal Thivent

As @duffymo points out, JBoss uses Tomcat for its web container so bettermakes not much sense if we compare equivalent things (i.e. Tomcat and the web container part of JBoss). And if you are not going to use JTA, EJBs, JMS, JMX, etc, there is no real advantage at using JBoss, especially during development (Tomcat is lighter and starts faster, this is often appreciated by development teams).

正如@duffymo 指出的那样,JBoss 将 Tomcat 用于其 Web 容器,因此如果我们比较等效的事物(即 Tomcat 和 JBoss 的 Web 容器部分),那么更好的意义不大。而如果你不打算使用 JTA、EJBs、JMS、JMX 等,那么使用 JBoss 并没有真正的优势,尤其是在开发过程中(Tomcat 更轻,启动速度更快,这通常受到开发团队的赞赏)。

There are some cases where you could prefer JBoss for productionthough (I'm still assuming you're not using EJBs, etc):

在某些情况下,您可能更喜欢使用 JBoss进行生产(我仍然假设您没有使用 EJB 等):

  • The production team is trained or used to use JBoss in production, tools (deployment, monitoring, etc) are tailored for JBoss.
  • The company has a support contract for JBoss (although you can also get support for Tomcat).
  • 生产团队经过培训或习惯在生产中使用 JBoss,工具(部署、监控等)是为 JBoss 量身定制的。
  • 该公司与 JBoss 签订了支持合同(尽管您也可以获得对 Tomcat 的支持)。

But I'm not sure this is what the app architect meant. I would try to discuss this choice with the architect, maybe he has a rationale explanation. And if really JBoss has to be used in production, you can always use Tomcat or Jetty during development.

但我不确定这是应用架构师的意思。我会尝试与建筑师讨论这个选择,也许他有一个合理的解释。如果真的必须在生产中使用 JBoss,您可以在开发过程中始终使用 Tomcat 或 Jetty。

回答by OscarRyz

JBoss is an Application Serverwhile Tomcat is a Servlet container

JBoss 是一个应用服务器,而 Tomcat 是一个Servlet 容器

So JBoss may be better than Tomcat in the sense it contains it, plus other components. That's it.

因此,JBoss 可能比 Tomcat 更好,因为它包含它以及其他组件。就是这样。

If you're not going to use those other components, you're wasting resources. If you need those other components then Tomcat is not enough.

如果您不打算使用那些其他组件,那么您就是在浪费资源。如果您需要那些其他组件,那么 Tomcat 是不够的。

It depends, probably your Architect has something else in mind.

这取决于,您的架构师可能还有其他想法。

I wonder what would he say if you ask him directly?

我想知道如果你直接问他,他会怎么说?

回答by Thilo

It's not better, it's just more. JBoss includes Tomcat.

不是更好,只是更多。JBoss 包括 Tomcat。

回答by Dennis C

If you use JBoss, you can pay Jboss.org for support. But it is not the case with Tomcat.

如果您使用 JBoss,您可以向 Jboss.org 支付支持费用。但 Tomcat 的情况并非如此。

This is true, however RedHat (who bought out Jboss.org) will require you to change to one of their supported versions of JBoss

这是真的,但是 RedHat(收购了 Jboss.org)将要求您更改为他们支持的 JBoss 版本之一

回答by Simon

JBoss is J2EE specification compliant, it supports J2EE specification very well, such as EJB, JTA,JMS, JNDI and etc. Tomcat is only a servlet container, although it also supports a bit J2ee specification. When you want to use J2EE component, you should consider JBoss first.

JBoss 是 J2EE 规范兼容的,它很好地支持 J2EE 规范,例如 EJB、JTA、JMS、JNDI 等。Tomcat 只是一个 servlet 容器,虽然它也支持一点 J2ee 规范。当您要使用 J2EE 组件时,您应该首先考虑 JBoss。

Forgot a point, JBoss supports JMX very well, especially in version 4.*. I have experienced a project, it doesn't have a web UI, JBoss is used just as a platform and EJB container to integrate all the standalone application on it use MBean.

忘了一点,JBoss 对 JMX 的支持非常好,尤其是在 4.* 版本中。我经历过一个项目,它没有 Web UI,JBoss 只是用作平台和 EJB 容器,使用 MBean 将所有独立应用程序集成到其上。