真正的Enterprise Java Bean是什么? [英] What is an Enterprise Java Bean really?

查看:96
本文介绍了真正的Enterprise Java Bean是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Tomcat常见问题上说: Tomcat不是EJB服务器。Tomcat不是完整的J2EE服务器。

On the Tomcat FAQ it says: "Tomcat is not an EJB server. Tomcat is not a full J2EE server."

但是如果我:


  • 使用Spring提供应用程序上下文

  • 使用JPA
    批注对我的实体进行批注(并使用Hibernate作为
    JPA提供商)

  • 将C3P0配置为连接池数据

  • 注释我的服务方法
    与@Transactional(并使用Atomikos
    作为JTA提供程序)

  • 使用JAXB进行编组和解编

  • ,并可能添加我自己的JNDI功能

  • use Spring to supply an application context
  • annotate my entities with JPA annotations (and use Hibernate as a JPA provider)
  • configure C3P0 as a connection pooling data source
  • annotate my service methods with @Transactional (and use Atomikos as JTA provider)
  • Use JAXB for marshalling and unmarshalling
  • and possibly add my own JNDI capability

那么我没有有效地拥有Java EE应用程序服务器吗?那不是我的bean EJB吗?还是有其他一些定义性特征?

then don't I effectively have a Java EE application server? And then aren't my beans EJBs? Or is there some other defining characteristic?

与Java EE兼容的应用程序服务器给您带来了什么,您无法轻易/轻松地从Tomcat那里通过第三者获得它是什么?

What is it that a Java EE compliant app server gives you that you can't easily/readily get from Tomcat with some 3rd party subsystems?

推荐答案


但是如果我加上(...),那么我实际上就没有Java EE应用程序服务器?那不是我的bean EJB吗?还是有其他一些定义性特征?

But if I add (...) then don't I effectively have a Java EE application server? And then aren't my beans EJBs? Or is there some other defining characteristic?

不,您没有Java EE应用程序服务器,没有成熟的Java EE应用服务器不仅仅是Tomcat + Spring +独立的事务管理器。而且,即使添加了JMS提供程序和EJB容器,您仍将没有Java EE服务器。所有部分之间的粘合对IMO很重要,并且是Java EE容器附加值的一部分。

No, you don't have a Java EE application server, a full-fledged Java EE application server is more than Tomcat + Spring + a standalone Transaction Manager. And even if you add a JMS provider and an EJB container, you still won't have a Java EE server. The glue between all parts is IMO important and is part of the added value of a Java EE container.

关于EJB,EJB规范远比JPA和规范还重要。会话Bean和消息驱动Bean(实际上,即使出于历史原因,即使JPA是Java EE 5中的EJB 3.0规范的一部分,我也不认为JPA实体是EJB -在Java EE 6,JPA 2.0和EJB 3.1是单独的规范)。
我还应该提到,用 @Transactional 注释的Spring Bean不等同于Session Bean。 Java EE容器可以对会话Bean进行更多操作(请参见下文)。

Regarding EJBs, the EJB specification is much more than JPA and specifices also Session Beans and Message Driven Beans (actually, I don't really consider JPA Entities as EJBs even if JPA is part of the EJB 3.0 specification in Java EE 5 for historical reasons - which is not true anymore in Java EE 6, JPA 2.0 and EJB 3.1 are separate specifications). I should also mention that a Spring bean annotated with @Transactional is not equivalent to a Session Bean. A Java EE container can do more things with Session Beans (see below). You may not need them though but still, they are not strictly equivalent.

最后,Java EE容器实现了一个标准,Spring容器却没有,它是专有的。

Last thing, Java EE containers implement a standard, the Spring container does not, it is proprietary.


与Java EE兼容的应用程序服务器为您提供了什么,使您无法轻松/轻松地从Tomcat与某些第三方第三方子系统中获得信息

What is it that a Java EE compliant app server gives you that you can't easily/readily get from Tomcat with some 3rd party subsystems?

我说过,我认为胶水是附加值的一部分,对提高产品的耐用性有很大贡献。整个。然后,ewernli的 answer 很好地强调了难点达到。我只是添加:

As I said, I think that the "glue" is a part of the added value and highly contributes to the robustness of the whole. Then, ewernli's answer underlined very well what is difficult to achieve. I'd just add:


  • 集群和故障转移(以实现容错)
  • >
  • 管理工具

  • Clustering and Fail-over (to achieve fault-tolerance)
  • Administration facilities

是的,好的Java EE服务器会做得很整洁,以提高容错能力(连接池,JNDI树,JMS目标,使用幂等bean的自动重试,智能EJB客户端,事务恢复,服务迁移等的集群。对于关键任务应用程序-绝大多数不是-这很重要。在这种情况下,Servlet API之上的库不能替代IMO。

Yes, a good Java EE server will do pretty neat things to improve fault tolerance (clustering of connection pools, JNDI tree, JMS destinations, automatic retry with idempotent beans, smart EJB clients, transaction recovery, migration of services, etc). For "mission critical" applications - the vast majority are not - this is important. And in such cases, libraries on top of the Servlet API are IMO not a replacement.

这篇关于真正的Enterprise Java Bean是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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