Skip to main content

Posts

Showing posts from January, 2012

Developing Message-Driven Beans

An message-driven EJB is used to receive and process asynchronous messages using JMS. Message-driven EJBs are never directly invoked by other EJBs. However, they in turn can invoke methods of session and entity beans and send JMS messages to be processed by other message-driven EJBs. The topics listed below discuss development of message-driven beans. What are Message-Driven Beans? Message-driven beans are server-side objects used only to process JMS messages. These beans are stateless, in that each method invocation is independent from the next. Unlike session and entity beans, message-driven beans are not invoked by other beans or client applications. Instead a message-driven bean responds to a JMS message. Because message-driven beans are not invoked by other EJBs or clients, these beans do not have interfaces. For each message-driven bean a single method, onMessage , is defined to process a JMS message. Although message-driven beans cannot be invoked by other EJBs, the

When To Avoid Implementation of SOA?

SOA offers a change in perspective, a paradigm shift from object oriented to service oriented.As for almost a decade, most of the development is done using Object oriented technologies and that led to tight coupling many a times with vendor specific technologies like CORBA,DCOM or RMI.SOA offers to a new thinking of services rather visualizing in terms of objects which makes it independent of underlying technology. If SOA implementation in an organization is not well thought of,planned and micro-detailed then it may lead to disaster, waste of valuable resources of time and money.SOA may not be a good idea for enterprises which are not too big and complex in their business process and do not depend upon business processes of its suppliers and business partners. For instance, if an organisation which has distributed applications across the differ net geographies then it will be a good idea to implement SOA to integrate various applications to provide one cost effective,scalable an

How SOA Makes Things Better or Even Worse?

With all the hype that SOA has brought to organizations, they have to brainstorm whether this will do any good to their business anyway.The organizations first have to understand that SOA can not be implemented by introduction of certain software products or services but it is an architectural approach which has to analyze existing systems,IT resources,ever changing business processes and requirements and comes up with a set of business aligned services which can cost effectively fit very well for a consistent business functioning for years to come. As discussed in my previous blog , SOA projects can easily be put into red zone if all its constituents are not well planned,managed and executed.A change is like oxygen for an organization and SOA has to help businesses adapt with changing times and technology too changes rapidly beyond our imagination and in these times keeping an IT plan for next ten years for an organization is a daunting task.No matter how smart we think SOA can ta

How To Avoid Risks In SOA Implementation?

It is very important to know your customer's requirements,expectations and improved business processes in advance before starting any analysis and design exercise. A continuous communication with your client is must so that you can understand their business processes very well and should be able to identify problem areas with some concrete solutions in mind. If you have a suggestions related to business processes improvement then get an approval from your client on business requirements as they keep changing all the time.So scope of work is clearly defined to you and your customer with extensive project planning. If a customer does not see any qualitative improvement in complex business processes simplification/replacement with new improved business processes,he is going to make a lot of hue and cry about introducing new technological architecture. An organisation is always interested in synchronisation and improvement of its business process with its customers,suppliers and

What Is JNDI?

What is a naming service? Naming services map objects with names. It maps a reference to an object by a user friendly name. For example a machine maps its ip address. The association of an object with a name is called 'binding'. Examples : Domain Naming Service, File systems. What is a directory service? Searching for files and directories done by providing Directory services. A directory service is a set of names. The user and resource information and machine addresses are summarized by directory service. For example, for a given user name, the service returns the attributes of the user such as telephone no, email address etc. A directory service use the databases that specialized and hierarchical in design.

Need Answers To These Java Tricky Questions

Need Answers To These Java Tricky Questions. Please provide in comments section If Runnable interface is better than Thread class, than why we are using Thread class? What is the need for Thread class?  Why we are calling System.gc() method to garbage collection of unused object, if garbage collection is automatically done in Java by daemon thread in background process with regular interval?  What is the significance of Marker interface? Why are we using, even though it has no method?  Why we are always doing rs.next() in first line of while loop in retrieving data from database through result set?  Please give me the details of synchronization? And which are the methods and elements used in it and why only that methods and variables?  Why we are not using Java in real time based application, but instead we are using C or C++? Detail difference between 4 types of driver and their use in different different applications?  Is Java code with native methods platform-independent? 

What Is The Difference Between An Applet & An Application?

A Java application is made up of a main() method declared as public static void that accepts a string array argument, along with any other classes that main() calls. It lives in the environment that the host OS provides. A Java applet is made up of at least one public class that has to be subclassed from java.awt.Applet. The applet is confined to living in the user's Web browser, and the browser's security rules, (or Sun's appletviewer, which has fewer restrictions). The differences between an applet and an application are as follows: 1. Applets can be embedded in HTML pages and downloaded over the Internet whereas Applications have no special support in HTML for embedding or downloading. 2. Applets can only be executed inside a java compatible container, such as a browser or appletviewer whereas Applications are executed at command line by java.exe or jview.exe.

Java says "write once, run anywhere". What are some ways this isn't quite true?

As long as all implementations of java are certified by sun as 100% pure java this promise of "Write once, Run everywhere" will hold true. But as soon as various java core implementations start digressing from each other, this won't be true anymore. A recent example of a questionable business tactic is the surreptitious behavior and interface modification of some of Java's core classes in their own implementation of Java.  Programmers who do not recognize these undocumented changes can build their applications expecting them to run anywhere that Java can be found, only to discover that their code works only on Microsoft's own Virtual Machine, which is only available on Microsoft's own operating systems.

What are the differences between Java & C++ Languages?

Everything is an object in Java( Single root hierarchy as everything gets derived from java.lang.Object). Java does not have all the complicated aspects of C++ ( For ex: Pointers, templates, unions, operator overloading, structures etc..). The Java language promoters initially said "No pointers!", but when many programmers questioned how you can work without pointers, the promoters began saying "Restricted pointers." You can make up your mind whether it's really a pointer or not. In any event, there's no pointer arithmetic.  There are no destructors in Java. (automatic garbage collection), Java does not support conditional compile (#ifdef/#ifndef type).  Thread support is built into java but not in C++. Java does not support default arguments.  There's no scope resolution operator :: in Java. Java uses the dot for everything, but can get away with it since you can define elements only within a class. Even the method definitions must always occur w

What is Singleton Pattern?

The singleton pattern is a design pattern that is used to restrict instantiation of a class to one object Singletons (being often a bad choice) are classes that can have only one instance throughout the whole program. For example a SingletonConfigFile might look like this. It is for reading one file only. It would make sense for this to be a config file. If your class can be instantiated more than once, for different files, it is not singleton. Don't use this code - it doesn't take into account concurrency problems which are a whole different area of discussion.    public SingletonConfigFile {    private static String filename = "config.xml";    private File file;    private static SingletonConfigFile instance;

Explain about " Static " keyword in Java?

Static Variables   It is a variable which belongs to the class and not to object(instance) Static variables are initialized only once , at the start of the execution . These variables will be initialized first, before the initialization of any instance variables. A single copy to be shared by all instances of the class. A static variable can be accessed directly by the class name and doesn’t need any object   Syntax : <class-name>.<variable-name> Static Methods It is a method which belongs to the class and not to the object(instance). A static method can access only static data. It cannot access non-static data (instance variables). A static method can  call only  other static methods and cannot call a non-static method from it.   A static method  can be accessed directly by the class name and doesn’t need any object.   Syntax : <class-name>.<method-name> A static method cannot refer to "this" or "super"  keywords in anywa

JSP and JDBC Interview Questions & Answers

What is the query used to display all tables names in SQL Server (Query analyzer)? select * from information_schema.tables How many types of JDBC Drivers are present and what are they? - There are 4 types of JDBC Drivers JDBC-ODBC Bridge Driver Native API Partly Java Driver Network protocol Driver JDBC Net pure Java Driver Can we implement an interface in a JSP? - No What is the difference between ServletContext and PageContext? - ServletContext: Gives the information about the container. PageContext: Gives the information about the Request.

What Is The Advantage of OOP?

You will get varying answers to this question depending on whom you ask. Major advantages of OOP are: Simplicity: software objects model real world objects, so the complexity is reduced and the program structure is very clear; Modularity: each object forms a separate entity whose internal workings are decoupled from other parts of the system; Modifiability: it is easy to make minor changes in the data representation or the procedures in an OO program. Changes inside a class do not affect any other part of a program, since the only public interface that the external world has to a class is through the use of methods; Extensibility: adding new features or responding to changing operating environments can be solved by introducing a few new objects and modifying some existing ones; Maintainability: objects can be maintained separately, making locating and fixing problems easier; Re-usability: objects can be reused in diffe

How To Create String Object in Java?

In Java, you can create a String object as below : String str = "abc"; & String str = new String("abc"); Why cant a button object be created as : Button bt = "abc" Why is it compulsory to create a button object as: Button bt = new Button("abc"); Why this is not compulsory in String's case? Button bt1= "abc"; It is because "abc" is a literal string (something slightly different than a String object, by-the-way) and bt1 is a Button object. That simple. The only object in Java that can be assigned a literal String is java.lang.String. Important to not that you are NOT calling a java.lang.String constructor when you type 

What happens when an object is created in Java?

Everyone knows Java is an object oriented programming la nguage. Ev ery object in java is a reference to a real entity. So whenever you create an object of class ma ny things will happened in JVM. Memory is allocated from heap to hold all instance variables and implementation-specific data of the object and its super classes. Implementation-specific data includes pointers to class and method data. The instance variables of the objects are initialized to their default values.   The constructor for the most derived class is invoked. The first thing the constructor does is call the constructor for its uppercase. This process continues until the constructor for java.lang.Object is called, as java.lang.Object is the base class for all objects in java. Before the body of the constructor is executed, all instance variables will be initialize d and initialization blocks are executed. Then the body of the constructor is executed. Thus, the constructor for the base class completes firs