EJB Interview Questions
Can you explain how the EJB Invocation happens?
Retrieve Home Object reference from Naming Service via JNDI. Return Home Object reference to the client. Create me a new EJB Object through Home Object interface. Create EJB Object from the Ejb Object. Return EJB Object reference to the client. Invoke business method using EJB Object reference. Delegate request to Bean (Enterprise Bean).
Can you explain how J2EE relate to Enterprise JavaBeans technology?
Enterprise JavaBeans (EJB) technology is the basis of J2EE. EJB technology provides the scalable
architecture for executing business logic in a distributed computing environment. J2EE makes the life of an
enterprise developer easier by combining the EJB component architecture with other enterprise
technologies to solutions on the Java platform for seamless development and deployment of server side
What should I do if I encounter the following exception: java.rmi.AccessException: CORBA NO_PERMISSION No?
With 1.3.1 final release, the J2EE SDK became strict about checking adherence to the security policies of
How can you make your application run under the Final Release?
1. If you don’t want security checks, do the following:
Use the deploytool to build a deployment descriptor that does not require a strict security policy:
Under the Security screen of the EJB wizard or the Security tab of the EJB inspector in deploytool, click ‘Deployment Settings’. Under the box “Client Authentication”, make sure “Support Client Choice” is checked instead of “Certificate” or “Password”.
2. To require the application pass security checks to run, do the following:
When an enterprise bean specifies “Certificate” or “Password” as the method of Client Authentication, use a J2EE application client, instead of a standalone Java application, to access the bean. You will need to login as a valid J2EE user
Can you explain how a “guest” principal is returned by getCallerPrinicipal() in an enterprise bean even when the caller is authenticated with a specific principal?
This can be achieved when you specify “Certificate” or “Password” as in the Deployment Settings for the enterprise bean.
Can you explain whether it is possible to share an HttpSession between a JSP and EJB? What happens when I change a value in the HttpSession from inside an EJB?
You can pass the HttpSession as parameter to an EJB method, only if all objects in session are serializable.This has to be consider as passed-by-value, that means that it’s read-only in the EJB. If anything is altered from inside the EJB, it won’t be reflected back to the HttpSession of the Servlet Container.The pass-by-reference can be used between EJBs Remote Interfaces, as they are remote references. While it is possible to pass an HttpSession as a parameter to an EJB object, it is considered to be bad practice in terms of object-oriented design. This is because you are creating an unnecessary coupling between back-end objects (EJBs) and front-end objects (HttpSession). Create a higher-level of abstraction for your EJBs API. Rather than passing the whole, fat, HttpSession (which carries with it a bunch of http semantics), create a class that acts as a value object (or structure) that holds all the data you need to pass back and forth between front-end/back-end. Consider the case where your EJB needs to support a non HTTP-based client. This higher level of abstraction will be flexible enough to support it.
Is it possible for the primary key in the entity bean be a Java primitive type such as int?
The primary key can’t be a primitive type. Use the primitive wrapper classes, instead. For example, you can use java.lang.Integer as the primary key class, but not int (it has to be a class, not a primitive).
Exlpain how we can invoke one EJB from another EJB?
EJBs can be clients of other EJBs. It just works. Use JNDI to locate the Home Interface of the other bean, then acquire an instance reference, and so forth.
- What are EJBs?
- An Overview of EJBs
- Writing an EJB from scratch
- Deploying the Session Bean
- EJB Handles
- EJB environment variables
- Linked EJBs
- Accessing JDBC from EJBs
- Transaction handling in EJB
- Security in EJB
- EJB Interview Questions
- Deploying and testing Stateless Session Bean
- Why EJB
- EJB3 – The Basics
- EJB3-Create an Entity Bean
- EJB3 Stateless Session Bean
- EJB3 – Creating a test client
- EJB 3.0 Features and Advantages