MICHAEL SPURGEON
MICHAEL SPURGEON

Reputation: 11

can a request directly come to ejb container or it should first come to web container.can anyone please explain?

can a request directly come to ejb container or it should first come to web >container and hit ejb?can anyone please explain?

I want to know the runtime flow of the application in middleware server

Upvotes: 0

Views: 64

Answers (1)

Brett Kail
Brett Kail

Reputation: 33946

Yes, in two cases:

  • A session bean exposes a remote interface. In this case, a client can directly invoke the EJB.
  • A message-driven bean is configured, and a message is sent that it is listening for.

There are a few additional cases where the EJB can get control without any request:

  • A singleton session bean is annotated (or configured via XML) to be @Startup and defines a PostConstruct method. In this case, the bean will get control when the application is deployed.
  • A session bean is annotated (or configured via XML) to be @Schedule. In this case, the bean will get control at the specified time.

In all other cases, another component (e.g., a servlet) must get control first and invoke the EJB.

Upvotes: 2

Related Questions