0

I have an EJB accessed remotely from a Swing client as well as locally by servlet/JSP. I want to switch the packaging for my EJB from a EJB/WAR/EAR to a EJB/WAR since it is simpler to work with.

What do I mean by simpler? In Eclipse, for example, I can have a single project with my EJB/web classes rather than having a EJB + WAR + EAR project (My client is a separate project in Eclipse).

Is it possible to package a EJB in a WAR and have it be accessible remotely?

Raylite3
  • 837
  • 2
  • 11
  • 22

2 Answers2

2

The intent of EJB-in-WAR was primarily to simplify packaging for local EJBs used by the WAR. However, I cannot find a restriction for remote EJBs packaged in a WAR even though there are restrictions on other technologies (specifically, entity beans and JAX-RPC endpoints are not allowed), which leads me to believe remote views are allowed in WARs from a specification perspective. I don't have broad knowledge of vendor implementations, but I have tested that it works on WebSphere Application Server.

Brett Kail
  • 33,593
  • 2
  • 85
  • 90
1

According to the web profile and EJB 3.1 specs, Java EE web profile products are only required to provide EJB Lite, which doesn't support remote clients to EJBs.

But they can provide remote ejb client connection as a product optional component.

So if you want to package remote EJBs in a WAR you'll have to look for a Java EE web server that provides this service and be aware that the same behaviour isn't required in other Java EE 6 web servers.

Useful links: http://download.oracle.com/otndocs/jcp/javaee_web_profile-6.0-fr-eval-oth-JSpec/

http://download.oracle.com/otndocs/jcp/ejb-3.1-fr-eval-oth-JSpec/

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
marciopd
  • 132
  • 11