简体   繁体   中英

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

I am new to 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 need an application server like JBoss, WebSphere, WebLogic, GlassFish, etc. Pure web servers like Tomcat or Jetty cannot run EJB.

All application servers can also function as a web server.

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.

A more technical explanation is that you need an EJB container to run EJBs and a web container to run servlets and JSPs. A web server has only a web container. An application server has both.

You need an EJB container to run EJB with all the features (ie transaction, security etc.). But if you are are using EJB3 you can use something like ejb3unit to unit test the functionality of the EJB classes.

http://ejb3unit.sourceforge.net/

You need a EJB container to run EJB applications. However, it is easy to run one on your computer, just as it is easy to run Apache server for HTML/PHP applications. Glassfish is an example server which contains an EJB container.

If you only want the EntityManager functionality from EJBs, then you can simply use Java SE. See here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM