Using WorkManager in JBoss

Friday, 27 April 2007, 23:00 | Category : J2EE, Java, Technology
Tags :

You can schedule any work (thread that needs to be run) in Jboss using WorkManager API (JCA). Below is a sample code that can be called from any ejb/servlet/mdb or any server side application running in jboss container.

Class Loading in Java

Friday, 27 April 2007, 14:09 | Category : Java
Tags :

Class loaders are hierarchical. Classes are introduced into the JVM as they are referenced by name in a class that is already running in the JVM. So how is the very first class loaded? The very first class is specially loaded with the help of static main() method declared in your class. All the subsequently […]

Reading Mails from secure exchange server in Java

Thursday, 26 April 2007, 16:46 | Category : Internet, J2EE, Java, Technology
Tags : , ,

1. Export the certificate for the exchange server from Internet explorer Certificate export wizard e.g. after opening https://webmail.hostname.com, (View certificate >Details > Copy to File). Say the exported file name is certificate.cer 2. Create keystore from the certificate using java keytool (which will create keystore file in current directory). It will ask for a password, […]

Export File name in servlet/jsp

Thursday, 26 April 2007, 13:49 | Category : Internet, J2EE, Java, Technology
Tags :

While giving a link for export as a file, you may also want to give it a name that should come in save-as dialog or browser. To do so, you have to just set Content-Disposition header and content type of response e.g. for saving as an excel file, following can be used:

Debugging problems related to the JDBC API

Thursday, 26 April 2007, 0:57 | Category : Database, J2EE, Java, Technology
Tags :

A good way to find out what JDBC calls are doing is to enable JDBC tracing. The JDBC trace contains a detailed listing of the activity occurring in the system that is related to JDBC operations. If you use the DriverManager facility to establish your database connection, you use the DriverManager.setLogWriter method to enable tracing […]

Which jar

Monday, 23 April 2007, 23:22 | Category : Java, Technology
Tags :

How to know from which jar file a class has been loaded?

Number of processors on a machine

Monday, 23 April 2007, 23:20 | Category : Java, Technology
Tags : ,

How to get Number of processors on a machine in java

Sample java code to read mails from your gmail account

Monday, 23 April 2007, 23:13 | Category : Internet, J2EE, Java, Technology
Tags : ,

Sample java code to read mails from your gmail account

Covariant return types

Friday, 20 April 2007, 12:44 | Category : Java, Technology
Tags :

You cannot have two methods in the same class with signatures that only differ by return type. Until the J2SE 5.0 release, it was also true that a class could not override the return type of the methods it inherits from a superclass. In this tip you will learn about a new feature in J2SE […]

Java Interview questions

Friday, 20 April 2007, 12:41 | Category : Interview questions, Java, Technology
Tags :

Q. How to create Immutable class? Immutable objects are simply objects whose state (the object’s data) does not change after construction. Always construct an object completely, instead of using a no-argument constructor combined with subsequent calls to setXXX methods. Do not provide any methods which can change the state of the object in any way […]