Exercise 1

Question 1 :

Which of the following statements are true regarding MDBs (Message Driven Beans) on version 6.0 of WebLogic App Server?

A). MDBs support concurrent processing for both Topics and Queues.
B). MDBs support concurrent processing for only Topics.
C). MDBs support concurrent processing for only Queues.
D). MDBs support concurrent processing neither Topics nor Queues.
Answer : Option A

Explanation :

MDBs support concurrent processing for both Topics and Queues. Previously, only concurrent processing for Queues was supported. To ensure concurrency, change the weblogic-ejb-jar.xml deployment descriptor max-beans-in-free-pool setting to >1. If this element is set to more than one, the container will spawn as many threads as specified. WebLogic Server maintains a free pool of EJBs for every stateless session bean and message driven bean class. 
The max-beans-in-free-pool element defines the size of this pool. By default, max-beans-in-free-pool has no limit; the maximum number of beans in the free pool is limited only by the available memory.

Question 2 :

The two primary cluster services provided by WebLogic Server are?

A). Http Session State Clustering
B). File Service Clustering
C). Time Service Clustering
D). Object Clustering
E). Event Clustering
Answer : Option A

Explanation :

A WebLogic Server cluster is a group of servers that work together to provide a more scalable and reliable application platform than a single server. A clustered service is an API or interface that is available on multiple servers in the cluster. HTTP session state clustering and object clustering are the two primary cluster services that WebLogic Server provides. WebLogic Server also provides cluster support for JMS destinations and JDBC connections. WebLogic Server provides clustering support for servlets and JSPs by replicating the HTTP session state of clients that access clustered servlets and JSPs. To benefit from HTTP session state clustering, you must ensure that the session state is persistent, either by configure in-memory replication, file system persistence, or JDBC persistence. If an object is clustered, instances of the object are deployed on all WebLogic Servers in the cluster. The client has a choice about which instance of the object to call. This is Object Clustering. The APIs and internal services that cannot be clustered in WebLogic Server version6.0 are File services, Time services, WebLogic Events, Workspaces and ZAC.

Question 3 :

Which of the following are recommended practices to be performed in the ejbPassivate() method of a stateful session bean?

A). Close any open resources, like database connections
B). All non-transient, non-serializable fields(except some special types) should be set to null.
C). All transient fields should be set to null
D). Make all database connection reference fields transient
E). All primitive type fields should be set to null
Answer : Option A, OptionB, Option D

Explanation :

When a bean is about to be passivated, its ejbPassivate() method is invoked, alerting the bean instance that it is about to enter the Passivated state. At this time, the bean instance should close any open resources and set all non transient, non serializable fields to null. This will prevent problems from occurring when the bean is serialized. Transient fields will simply be ignored.Serializable fields will be saved. Open resources such as sockets or JDBC connections must be closed whenever the bean is passivated. In stateful session beans, open resources will not be maintained for the life of the bean instance. When a stateful session bean is passivated, any open resource can cause problems with the activation mechanism. 
A bean's conversational state may consist of only primitive values, objects that are serializable, and the following special types-SessionContext, EJBhome, EJBObject, UserTransaction and Context (only when it references the JNDI ENC) . The types in this list (and their subtypes) are handled specially by the passivation mechanism. They don't need to be serializable; they will be maintained through passivation and restored automatically to the bean instance when it is activated

Question 4 :

While packaging the Web Application DefaultWebApp for deployment into the WebLogic server, the home and remote interfaces of the enterprise beans used by the servlets should reside in which directory?

A). DefaultWebApp/META_INF/classes
B). DefaultWebApp/META_INF/lib
C). DefaultWebApp/WEB_INF/lib
D). DefaultWebApp/WEB_INF/classes
E). DefaultWebApp/classes
Answer : Option D

Explanation :

When packaging a web application create META-INF and WEB-INF subdirectories in the application directory to hold deployment descriptors and compiled Java classes. All servlet classes and helper classes should reside in the WEB-INF/classes subdirectory. The home and remote interface classes for enterprise beans used by the servlets into the WEB-INF/classes subdirectory. 
All the HTML files, JSP files, images, and any other files that these Web pages reference should exist in the application directory, maintaining the directory structure for referenced files. The META_INF directory contains the deployment descriptors for the enterprise beans, but not the classes.

Question 5 :

How many deployment descriptor files does a CMP entity bean deployed on the WebLogic Server have?

A). One J2EE specific deployment descriptor and two WebLogic specific deployment descriptors
B). One J2EE specific deployment descriptor and one WebLogic specific deployment descriptors
C). One J2EE specific deployment descriptor only
D). One WebLogic specific deployment descriptor only
Answer : Option A

Explanation :

Deployment descriptors are text documents formatted with XML tags. The J2EE specifications define standard, portable deployment descriptors for J2EE components and applications. BEA defines additional WebLogic-specific deployment descriptors required to deploy a component or application in the WebLogic Server environment. 
When packaging an enterprise bean, we need to create an ejb-jar.xml deployment descriptor in the META-INF subdirectory and add entries for the bean. We also need to create a weblogic-ejb-jar.xml deployment descriptor in the META-INF subdirectory and add entries for the bean. If the bean is an entity bean with container-managed persistence, first we create a weblogic-rdbms-cmp-jar-bean_name.xml deployment descriptor in the META-INF directory with entries for the bean. Then we map the bean to this CMP deployment descriptor with a attribute in the weblogic-ejb-jar.xml file.