Tuesday, June 23, 2009

Stream has already been closed; nested exception is java.sql.SQLException

Stream has already been closed; nested exception is java.sql.SQLException in Oracle.
Java - Oracle connectivity some times this exception will happen.
One of the reason of this exception is , the table contains a long(datatype) field.
eg: 'users' table contains a field 'age' long datatype.
To solve this problem , replace the 'long' field to 'number' datatype.

Tuesday, June 16, 2009

Check and Uncheck checkboxes using javascript

inside script tag

//this will mark all the checkboxes inside a form are checked.

//form1 is the form name
function checkAll() {

for(var i=0;i

if(document.forms['form1'].elements[i].type=='checkbox') {

document.forms['form1'].elements[i].checked=true; } } }
//this will mark all the checkboxes inside a form are unchecked.

//form1 is the form name

function uncheckAll() {

for(var i=0;i

if(document.forms['form1'].elements[i].type=='checkbox') {

document.forms['form1'].elements[i].checked=false; } } }
//form1 is the form name

//this will mark the specified checkboxes inside a form are checked

//form1 -- formname

//checkboxname-- checkbox name

function selectAllFields()


var chk = document.form1.checkboxname;

for (i = 0; i < checked =" true">

var chk = document.form1.checkboxname;

for (i = 0; i


Monday, June 15, 2009

Drag and drop using using Javascript

You can drag and drop for an html component using Yahoo Ui -javascript library.
More details check the following link,


Saturday, June 13, 2009

Deploy axis webservice in Jboss server

Download the axis.war from
Put the axis.war in jboss\server\default\deploy folder.
Then deploy the webservice in the axis.war and deploy the webservice using the command,
java org.apache.axis.client.AdminClient ..\src\com\jijo\stubs\deploy.wsdd
then copy the server-config.wsdd file from axis.war/WEB-INF folder and put the file in your WEB-INF folder.

In short first deploy in axis.war and copy the server-config.wsdd file and put into your project/WEB-INF folder.

WebService using Apache axis

Download the following jar

Create one project eg: CalcTest and set classpath to theses jars.

Download the axis.war file from http://ws.apache.org/axis/java/install.html and put into your tomcat(webapps) or jboss(deploy) folder.

Create one interface

package com.jijo;
* @author jijo
public interface Calculator {
public int add(int x,int y);
public int subtract(int x, int y);

Create one class and implemet the Calculator interface
package com.jijo;
public class CalculatorImpl implements Calculator {
public int add(int x, int y) {
return x+y;
public int subtract(int x, int y) {
return x-y;
Compile the classes, and in command prompt:
java org.apache.axis.wsdl.Java2WSDL -o calculator.wsdl -n urn:com.jijo.Calculator -l http://localhost:8080/axis/services/calcservice com.jijo.Calculator
[This is for creating the WSDL(Java to WSDL)].

After this a wsdl file is created in you folder.
Then Create the Stubs based on this WSDL(WSDL to Java)
java org.apache.axis.wsdl.WSDL2Java -o ..\src -p com.jijo.stubs -s calculator.wsdl
Then the stubs is created .

Replace the
CalcserviceSoapBindingImpl.java to the following

/** * CalcserviceSoapBindingImpl.java * * This file was auto-generated from WSDL * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. */
package com.jijo.stubs;
import com.jijo.CalculatorImpl;

public class CalcserviceSoapBindingImpl implements com.jijo.stubs.Calculator{ com.jijo.Calculator calculator = new CalculatorImpl(); public int add(int in0, int in1) throws java.rmi.RemoteException { return calculator.add(in0, in1); }
public int subtract(int in0, int in1) throws java.rmi.RemoteException { return calculator.subtract(in0, in1); }

create a jar eg: cal.jar based on the classes and put into axis.war/WEB-INF/lib folder
start the tomcat/jboss server.Then
Deploy into axis.war using ,
java org.apache.axis.client.AdminClient ..\src\com\jijo\stubs\deploy.wsdd

One server-config.wsdd file is created in the axis.war folder.
Then restart the server.
Check the wsdl file getting using,in browser

Create a client class

import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
import com.jijo.stubs.CalculatorService;
import com.jijo.stubs.CalculatorServiceLocator;

public class CalcClient {
public static void main(String[] args) {
CalculatorService service = new CalculatorServiceLocator();
try {
int result = service.getcalcservice().add(10, 20);
System.out.println("Result :"+result);
result = service.getcalcservice().subtract(10, 20);
} catch (RemoteException e) {
} catch (ServiceException e) {