Friday, June 25, 2010

EJB CONTINUES ... 3

QUESTION: What is the basic requirement for in-memory replication in Weblogic?
ANSWER:
1. The data in session should consist only of Serialized objects.
2. Only setAttribute function should be used to set objects in session


QUESTION: How JDBC services can be used in clustered environment?
ANSWER: Identical DataSource has to be created in each clustered server instances and configure to use different connection pools.

QUESTION: What are the services that should not be used in a Clustered Environment?
ANSWER: Non-clustered services:
1. File Services
2. Time services
3. Weblogic events
4. Weblogic Workspaces (In WebLogic 5.1)

QUESTION: Mention some tools to cluster Web Servers?
ANSWER: Web Servers can be clustered using
1. Edge Server.
2. DNS

QUESTION: What is in-memory replication?
ANSWER: The process by which the contents in the memory of one physical m/c are replicated in all the m/c in the cluster is called in-memory replication.

QUESTION: How do you get Column names only for a table (SQL Server)? Write the Query. (JDBC)
ANSWER: select name from syscolumns where id=(select id from sysobjects where name='user_hdr') order by colid --user_hdr is the table name

QUESTION: What is the need for Clustering?
ANSWER: To scale the application so that it
1. Is Highly Available
2. Has High Throughput.

QUESTION: Is is possible for an EJB client to marshall an object of class java.lang.Class to an EJB?
ANSWER: Technically yes, spec. compliant NO! - The enterprise bean must not attempt to query a class to obtain information about the declared members that are not otherwise accessible to the enterprise bean because of the security rules of the Java language.

QUESTION: Is it legal to have static initializer blocks in EJB?
ANSWER: Although technically it is legal, static initializer blocks are used to execute some piece of code before executing any constructor or method while instantiating a class. Static initializer blocks are also typically used to initialize static fields - which may be illegal in EJB if they are read/write - In EJB this can be achieved by including the code in either the ejbCreate(), setSessionContext() or setEntityContext() methods.

QUESTION: How can I implement a thread-safe JSP page?
ANSWER: You can make your JSPs thread-safe by having them implement the SingleThreadModel interface. This is done by adding the directive