Saturday, September 6, 2008

WASCE 2.1  Configuration Issue in Eclipse 3.3

This is the issue which I faced while configuring WASCE2.1 in eclipse europa. Just want to share what's the issue I faced.

WASCE2.1 causes NullpointerException during deployement. 
I installed Websphere community Edition 2.1 (WASCE2.1) and tried to deploy a small dynamic web project using eclipse. First I tried thro' the eclipse latest version GENEYMEDE. But I couldn't deploy successfully. After that I came to know that WASCE Eclipse plug-in doesn't supports Eclipse Ganymede platform.
So I tried to deploy thro' Eclipse Europa. Still I couldn't deploy successfully.The server starts up fine. But am getting NullpointerException while publishing.

Solution
Community Edition uses a Geronimo specific deployment plan(geronimo-web.xml) But the installed plugin didn´t generate the geronimo-web.xml file when defining a Dynamic Web Project with WASCE as its runtime.
so, I tried to place geronimo deployment descriptor file in /WebContent/web-Inf/ folder. Still it doesn't work. 

Below is the error which I got while publishing the WASCE server.
!ENTRY org.eclipse.wst.server.core 4 0 2008-09-05 23:01:50.285
!MESSAGE Could not publish to the server.
!STACK 0
java.lang.NullPointerException
at org.apache.geronimo.st.core.internal.DependencyHelper.getEnvironment(DependencyHelper.java:353)
at org.apache.geronimo.st.core.internal.DependencyHelper.reorderModules(DependencyHelper.java:97)
at org.apache.geronimo.st.core.GeronimoServerBehaviourDelegate.publishModules(GeronimoServerBehaviourDelegate.java:216)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:669)
at org.eclipse.wst.server.core.internal.Server.doPublish(Server.java:887)
at org.eclipse.wst.server.core.internal.Server.publish(Server.java:874)
at org.eclipse.wst.server.core.internal.PublishServerJob.run(PublishServerJob.java:72)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

what was happened is my eclipse is configured to Java.version=1.6.0_07. Under this configuration eclipse is not generating the geronimo deployment descriptor. After configuring eclipse to Java version 1.5, eclipse generated the geronimo-web.xml and the deployment went successfully.

 


Friday, July 11, 2008

Jconsole

Jconsole is a JMX complaint Graphical User Interface(GUI) tool for monitoring Java Virtual Machine (JVM). This tool is bundled with JDK starting from JavaSE5(TIGER).

How to start JConsole
The jconsole executable can be found in JDK_HOME/bin.Just double click it. or you can start from console.
Note : JDK_HOME - is the directory where you installed JDK.
You can monitor JVM which is running locally or remotely.

This fig shows 3 tabs.

Advanced Tab enables you to connect to other JMX agents by specifying their JMX URL
Remote tab enables you to monitor remote JVM by specifying Host name, Port Number,UserName and password
Local tab enable you to monitor local JVM

Tuesday, June 10, 2008

Snow Leopard - Latest Mac OS

Apple's next major version of advanced MAC OS X is SNOW LEOPARD. The release date is not yet revealed. But this major release support Microsoft Exchange 2007, Mulicore, open compute library & 64 bit.

Snow Leopard extends the 64-bit technology in Mac OS X to support breakthrough amounts of RAM — up to a theoretical 16TB, or 500 times more than what is possible today. More RAM makes applications run faster, because more of their data can be kept in the very fast physical RAM instead of on the much slower hard disk.

Saturday, January 5, 2008

Intel SpeedStep Technology

Intel SpeedStep Technology allows you to customize the clock frequency on your notebook.When the notebook is plugged into the AC power the processor will run in Maximum Performance mode. When you unplugged your notebook from the power outlet & running on batteries, the processors would switch to a low frequency or low performance mode.So, the notebook will run in Battery Optimized performance mode.
The low frequency use less electrical power and the battery life could be increased.
If you wish you can change the settings in BIOS or in Power options under control panel.

Enhanced SpeedStep Technology
SpeedStep Technology was introduced by Intel for the bigger concern of battery life in notebook computers.Later Intel came up with Enhanced SpeedStep Technology.
Enhanced SpeedStep Technology switch between a low frequency to high frequency state as needed by the application.

Windows XP Power Schema
In Windows XP, you can access the power profiles by going to Control Panel -> Power Options -> Power Schemes. There are different power shemas available. Based on your need you can select the right one. Even you can have your own power schema and save it.You can find the Windows XP built in shemas in the below table.


















Built In SchemasBehavior
Home/Office Desk Plugged Behavior Highest Performance State.
Unplugged Behavior Switch Performance State based on need.
Portable/Laptop Plugged Behavior Switch Performance State based on need.
Unplugged Behavior Switch Performance State based on need.
Presentation Plugged Behavior Switch Performance State based on need.
Unplugged Behavior Lowest Performance State.
Always On Plugged Behavior Highest Performance State.
Unplugged Behavior Highest Performance State.
Minimal Power Management Plugged Behavior Switch Performance State based on need.
Unplugged Behavior Switch Performance State based on need.
Max Battery Plugged Behavior Switch Performance State based on need.
Unplugged Behavior Lowest Performance State.

Try to check the frequency switch in your laptop with & w/o power. Don't run any application so that you can see the difference. Start - My computer - Properties -( processor frequency which is in MHZ)

Tuesday, January 1, 2008

Sri Appandainathar/Parswanathar Temple @ Thirunarankondrai Village

Sri Appandainathar Jain temple is located in a village called Thirunarankondrai near Ulundurpet (Tamil Nadu, India). At the top of the hill inside a cave you can see Lord Appandainathar in standing position. Sri Parswanathar is 23 Thirthankarar of Jain Thirthankarars.In this place everyone call Lord Parswanathar as Appandainathar.

Narkatchi Celebration

Every year in the month of Feb Jains celebrate Narkatchi Vizha in Thirunarankondrai temple. Almost all over from Tamil Nadu, people gather to this Thirunarankodrai temple for Narkatchi Vizha.

7 days Thiruvizha in Thirunarankondrai Village
Every year in the month of May, there is a 7 days Thiruvizha celebration takes place in Thirunarankondrai Temple. Every day there is special pooja and Uurvalam.
It's best time to visit the temple.

My Personal Experience
It's a such a peaceful place I can't find anywhere. Something we can't explain. It should be felt. So, feel it by visiting the temple.

Monday, December 31, 2007

Mustang(Java6) - Loading JDBC Driver

Mustang introduced service loader to load JDBC drivers by including a jar file in your classpath.
Before Mustang,
To get a JDBC connection using JDBC-ODBC driver you need to load the JDBC driver classes like below
class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
but this is not required from Mustang release.
This was changed in Java6 with java.util.ServiceLoader. As JDBC driver being packaged as a service, we just need to include the appropriate jar file in the class path.

Let's say if you want to use the Derby database. All you need to do is include the derby.jar file in your classpath, and the driver will automatically be available to us. There is no more need to use Class.forName(). Mustang ensures backward compatibility.So your older code still works.
The ServiceLoader mechanism can be used for any services, not just for your JDBC driver.


Friday, December 28, 2007

Castor - Java Data Binding Framework

Castor is opens source data binding framework for Java. Castor provides Java to XML binding & Castor can map relational database into JDO( Java Data Object).
Using Castor,
You can convert the XML schema into Java Objects.
You can convert XML into Java Objects & Vice versa.
You can perform Java to RDBMS marshalling & unmarshalling.

Downloads
You need to download castor.jar,castor-commons.jar, castor-codegen.jar & other dependencies jar based on your requirements.
castor-codegen.jar is basically required for generating Java classes from XML Schema.

Java Object to XML by using Marshalling
First we will build a simple java class.
package com.myproject.commons;
import java.util.ArrayList;
import java.io.Serializable;

public class EmployeeData {
private String employeeID;
private String employeeName;
private String dept;
private String designation;
private ArrayList SME = null;

/**
* @return Returns the dept.
*/
public String getDept() {
return dept;
}
/**
* @param dept The dept to set.
*/
public void setDept(String dept) {
this.dept = dept;
}
/**
* @return Returns the designation.
*/
public String getDesignation() {
return designation;
}
/**
* @param designation The designation to set.
*/
public void setDesignation(String designation) {
this.designation = designation;
}
/**
* @return Returns the employeeID.
*/
public String getEmployeeID() {
return employeeID;
}
/**
* @param employeeID The employeeID to set.
*/
public void setEmployeeID(String employeeID) {
this.employeeID = employeeID;
}
/**
* @return Returns the employeeName.
*/
public String getEmployeeName() {
return employeeName;
}
/**
* @param employeeName The employeeName to set.
*/
public void setEmployeeName(String employeeName) {
this.employeeName = employeeName;
}
public void addSME(String sme)
{
if(SME==null) {
SME = new ArrayList();
}
SME.add(sme);
}
/**
* @return Returns the list.
*/
public ArrayList getSME() {
return SME;
}
/**
* @param list The list to set.
*/
public void setSME(ArrayList list) {
this.SME = list;
}
}

Now you need a class to handle marshalling

package com.myproject.commons;
import java.io.FileWriter;
import org.exolab.castor.xml.Marshaller;
import com.myproject.commons.EmployeeData;

public class TestMarshaller {
public TestMarshaller() {
super();
}
public static void main(String[] args) {
try{
EmployeeData emp = new EmployeeData();
emp.setEmployeeID("E0123");
emp.setEmployeeName("xyz");
emp.setDept("Technology");
emp.setDesignation("Senior Analyst");
emp.addSME("J2EE");
emp.addSME("XML");
FileWriter file = new FileWriter("employee-data.xml");
Marshaller.marshal(emp,file);
System.out.println("XML Generated");
}
catch(Exception e) {
System.out.println("Exception occured:"+e.getMessage());
}}}

Locate the generated xml file ie employee-data.xml.It should look like this
<?xml version="1.0" encoding="UTF-8"?>
<employee-data>
<employee-iD>E0123</employee-iD>
<employee-name>xyz</employee-name>
<dept>Technology</dept>
<designation>Senior Analyst</designation>
<SME>J2EE</SME>
<SME>XML</SME>
</employee-data>

XML to Java Object using Unmarshalling
We will build a simple class to unmarshall the xml to Java object
package com.myproject.commons;
import java.io.FileReader;
import org.exolab.castor.xml.Unmarshaller;
public class TestUnmarshaller {

public TestUnmarshaller() {
super();
}
public static void main(String[] args) {
try{
FileReader reader = new FileReader("employee-data.xml");
EmployeeData emp = (EmployeeData)Unmarshaller.unmarshal(EmployeeData.class,reader);

System.out.println("Employee Id:"+emp.getEmployeeID());
System.out.println("Employee Name:"+emp.getEmployeeName());
}catch(Exception e){
System.out.println("Exception occurred:"+e.getMessage());
}}}

The Output looks like below
Employee Id:E0123
Employee Name:xyz

XML Schema to Java object
Castor's Source Code Generator creates a set of Java classes which represent an object model for an XML Schema.
Here is the simple command to generate the Java objects from XML schema.
C:\Castor>java org.exolab.castor.builder.SourceGeneratorMain -i schema name - package name