Skip to main content

Posts

Showing posts from May, 2011

Core Points To Remenber in Core Java

an empty source file will compile without error if a .java file does not contain a public class or interface it can have any name a single-type import will take precedence over an import-on-demand import-on-demand types do not increase the size of the compiled code ie only the types actually used are added to the code while import-on-demand adds no overhead to the compiled code, they can slow down the speed of the compile a constructor body can include a return statement providing no value is returned any method can throw a Runtime or Error exception without declaring it in the throws clause

How to correct Java Compile Problems?

If you're having problems compiling check the following: ·          you do NOT have CLASSPATH set in your AUTOEXEC.BAT file (JDK 1.3 does not require the DOS environment variable). ·          If the variable is set because of other programs, make sure it begins with a '.\' to ensure the current directory is always included. ·          you are issuing the compile command from within the directory containing the .java source file ·          if you are using the javac switch -classpath DO NOT include an ending '\'

"AccessControlException" or Java 2 Security Resolutions

In our current project we are working on RAD migration from 6.x.x RAD 7.5.4. As part of migration we have to enable security settings in Websphere application server for the deployed application. We have enabled it and given proper credentials and configured other required settings and properties in the WAS. We started the server, but we have found the error in sustemOut.log the following error. Exception: FFDC closed incident stream file C:\Program Files\IBM\SDP\runtimes\base_v61\profiles\AppSrv05\logs\ffdc\server1_00000015_11.05.09_15.46.32_0.txt [9-5-11 15:46:32:501 CEST] 00000015 SecurityManag W   SECJ0314W: Current Java 2 Security policy reported a potential violation of Java 2 Security Permission. Please refer to InfoCenter for further information. Permission: \C:\workspaces\GRILL_Migration\ GRILL _Clients\struts.jar : Access denied (java.io.FilePermission \C:\workspaces\ GRILL _Migration\AIL_Clients\struts.jar read) Code:     org.apache.struts.action.ActionServlet  in  {file

How To Resolve Build Errors While Running Ant Script?

As part of our project we have to deliver the EARs to the client. Usually we use Ant script to run the build.xml file. But this when we are running build.xml using ant script, we have faced the following error. The RAD / Eclipse console is show the following message stating that ·          “build\build.xml:251: Problem: failed to create task or type projectBuild” ,“Cause: The name is undefined” ·          Action: Check the spelling ·          Action: Check that any custom tasks/types have been declared. ·          Action: Check that any <presetdef>/<macrodef> declarations have taken place. See the exact error that displayed on RAD/Eclipse console

How Messaging and Queuing works?

·          Programs communicate by putting messages on queues.  Here, program A puts a message on Queue1, which is read by program B. Note: A and B need not be on the same machine!            ·          Communication can be one-way or two-way.  Here, A sends to B on Queue1, and B responds to A on Queue2

Advantages & Disadvantages of Synchronous / Asynchronous Communications?

  Asynchronous Communication Advantages: Requests need not be targeted to specific server. Service need not be available when request is made. No blocking, so resources could be freed.  Could use connectionless protocol Disadvantages: Response times are unpredictable. Error handling usually more complex.  Usually requires connection-oriented protocol.  Harder to design apps Synchronous Communication Advantages: Easy to program Outcome is known immediately  Error recovery easier (usually)  Better real-time response (usually) Disadvantages: Service must be up and ready. Requestor blocks, held resources are “tied up”.  Usually requires connection-oriented protocol

What is the Need of Message Queuing?

The composition of a organization’s network is fluid and unpredictable. The organization may acquire or merge with other organizations that have diverse data processing networks. Also the data held on different database systems has to be synchronized. In implementing this challenge the following difficulties must be overcome. ·          Mixed environments ·          Complex programming ·          Limited design choice ·          Difficult coordination of data

What is Messaging and Queueing?

n   Messaging - programs communicate by sending data in messages rather than by calling each other directly. n   Queuing - messages are put on queues in storage, eliminating the need for programs to be logically connected. n   A messaging and queuing framework is inherently ASYNCHRONOUS ! n   Programs communicate by writing and retrieving application-specific data (messages) to/from queues, without having a private, dedicated, logical connection to link them.   ::DISCLAIMER:: ----------------------------------------------------------------------------------------------------------------------- The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only. It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates. Any form of reproduction, disseminatio

What Are Restrictions for Enchanced For Loop?

You can not use "Enhanced For Loop" to remove elements from a collect or an array. Also, you can not modify the current slot in a collect or an array. It is not usable for loops where you need to replace elements in a list or array as you traverse it. For example, class Program { public static void main(String[] args) { Collection<String> c = new ArrayList<String>(); c.add("A"); c.add("B"); c.add("C"); for(String name : c) { name = "CHANGED"; } for(String name : c){ System.out.print(name); } } } You will see that the ouput still "ABC". All you have done is modified the local reference variable name.

What Is Lazy Loading?

Lazy loading means not creating an object until the first time it is accessed. Lazy loading typically looks like this: public class Example { private Vector data = null; public Vector getData() { if (this.data == null) { this.data = new Vector(); // Load data into vector … } return this.data; } } This technique is most useful when you have large hierarchies of objects (such as a product catalog). You can lazy-load subordinate objects as you navigate down the hierarchy, and thereby only create objects when you need them.