简体   繁体   English

EJB是否需要专用服务器才能使用?

[英]Does EJB need a dedicated server in order to be used?

I am new to Java EE. 我是Java EE的新手。 Does EJB need a dedicated server in order to be used or can I potentially make a Java EE application simulation on my laptop via only a web server? EJB是否需要专用服务器才能使用,还是可以仅通过Web服务器在笔记本电脑上进行Java EE应用程序仿真?

EJB need an application server like JBoss, WebSphere, WebLogic, GlassFish, etc. Pure web servers like Tomcat or Jetty cannot run EJB. EJB需要像JBoss,WebSphere,WebLogic,GlassFish等应用程序服务器。像Tomcat或Jetty这样的纯Web服务器不能运行EJB。

All application servers can also function as a web server. 所有应用程序服务器也可以充当Web服务器。

So the answer to your question is - no, you can't run EJB only via a web server but yes, you can run an application server on your laptop and use it to run web and EJBs. 因此,您的问题的答案是-不,您不能仅通过Web服务器运行EJB,但是可以,您可以在便携式计算机上运行应用程序服务器并使用它运行Web和EJB。

A more technical explanation is that you need an EJB container to run EJBs and a web container to run servlets and JSPs. 更具技术性的解释是,您需要一个EJB容器来运行EJB,并且需要一个Web容器来运行servlet和JSP。 A web server has only a web container. Web服务器只有一个Web容器。 An application server has both. 应用服务器同时具有两者。

You need an EJB container to run EJB with all the features (ie transaction, security etc.). 您需要一个EJB容器来运行具有所有功能(即事务,安全性等)的EJB。 But if you are are using EJB3 you can use something like ejb3unit to unit test the functionality of the EJB classes. 但是,如果您使用的是EJB3,则可以使用ejb3unit之类的工具对EJB类的功能进行单元测试。

http://ejb3unit.sourceforge.net/ http://ejb3unit.sourceforge.net/

You need a EJB container to run EJB applications. 您需要一个EJB容器来运行EJB应用程序。 However, it is easy to run one on your computer, just as it is easy to run Apache server for HTML/PHP applications. 但是,很容易在计算机上运行一个,就像为HTML / PHP应用程序运行Apache服务器一样容易。 Glassfish is an example server which contains an EJB container. Glassfish是包含EJB容器的示例服务器。

If you only want the EntityManager functionality from EJBs, then you can simply use Java SE. 如果只希望从EJB获得EntityManager功能,则可以简单地使用Java SE。 See here . 看这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为了线程安全,是否需要将EJB_Y(由EJB_X调用)注释为“ @Stateful”? - Does EJB_Y (called by EJB_X) need to be annotated as “@Stateful” in order to be thread safe? 为什么进程专用内存在服务器上减少了? - Why does dedicated memory to a process reduces on the server? 为什么当 ejb-invoker 端点与 payara 服务器一起用于通过 http 进行 EJB 远程调用时找不到 EJB - Why EJB not found when ejb-invoker endpoint used with payara server for EJB remote calls via http EJB客户端如何在没有url的情况下找到EJB服务器? - How does the EJB client locate the EJB server without url? JAVA EE中的@EJB是否加载要在页面上使用的模型? - Does @EJB in JAVA EE load models to be used on the page? 虚拟专用服务器问题 - Virtual Dedicated Server Question 为什么我的EJB接口需要扩展可序列化? - Why does my EJB interface need to extend serializable? EJB:容器是否需要同步实体Bean才能持久化? - EJB : does container need to synchronize entity bean persist? 专用服务器上的elasticsearch RemoteTransportException - elasticsearch RemoteTransportException on dedicated server 部署后,EJB服务器是否支持错误跟踪? - Does EJB server supports error tracking after Deployment?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM