[英]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.