December 12th, 2010
Vinay
Enterprise JavaBeans (EJB) technology is the server-side component architecture for Java Platform, Enterprise Edition (Java EE).
EJB 3 specification defines the new simplified EJB API targeted at ease of development. It also includes the new Java Persistence framework, JPA
This EJB Interview questions test will help you prepare for interviews
You can also check out this post
Difference between Spring’s Transaction management and EJB’s Container managed transaction
There is no standard way as per Java EE specs for JNDI naming conventions, hence most of the application servers have their own way of JNDI naming.
On specifying a Datasource’s JNDI name as ‘myDatasource’, JBoss binds as ‘java:myDatasource’. So if one want to deploy the application on Jboss application servers then can use the simplest way is here. The steps for adding and using jndi Datasource to JBOSS 4.x is as under-
- Copy the jdbc driver to JBOSS_HOME/server/default/lib.
- Create the jndi xml file for datasource – example ds.xml Read more…
November 24th, 2009
Vinay
1. Intercepting Filter:
Problem : Preprocessing and post-processing of a client Web request and response are required.When a request enters a Web application, it often must pass several entrance tests prior to the main processing stage. For example,
Has the client been authenticated?
Does the client have a valid session?
Is the client’s IP address from a trusted network?
Does the request path violate any constraints?
What encoding does the client use to send the data?
Do we support the browser type of the client? Read more…
Visual VM in JDK 1.6 is one of the best tools for monitoring the performance of your java/j2ee application. I am not sure why Sun has not marketed it well and kep it secret but this is a very good options for developers who always wanted to see how their applications behaves and if there are bottlenecks.
Imagine a developer did some change in application (added a new feature) and would like to know how his changes impact the application. Visual VM is very helpful in these situation. You can use it with standalone java application and can also integrate with your server.
Some of the helpful links on Visual VM are
Visual VM – All in one trouble shooting tool
JDK best kept secret – Visual VM
loitering objects make web company lose money
When studying UML , one of the most important questions which comes to mid of a programmer is , What is the difference between Aggregation and Composition ?
Composition and Aggregation are types of associations. They are very closely related and in terms of programming there does not appear much difference. I will try to explain the difference between these two by java code examples
Aggregation: the object exists outside the other, is created outside, so it is passed as an argument (for example) to the construtor. Ex: People – car. The car is create in a different context and than becomes a person property.
Composition: the object only exists, or only makes sense inside the other, as a part of the other. Ex: People – heart. You don’t create a heart and than passes it to a person.
Code example for aggregation:
// WebServer is aggregated of a HttpListener and a RequestProcessor
public class WebServer {
private HttpListener listener;
private RequestProcessor processor;
public WebServer(HttpListener listener, RequestProcessor processor) {
this.listener = listener;
this.processor = processor;
}
}
Code example for composition
// WebServer is an composition of HttpListener and RequestProcessor and controls their lifecycle
public class WebServer {
private HttpListener listener;
private RequestProcessor processor;
public WebServer() {
this.listener = new HttpListener(80);
this.processor = new RequestProcessor(“/www/root”);
}
}
In composition, whole has responsibility of preventing garbage collection of part.