A local interface can be used when clients address the bean with in a single JVM.
Remote Interfaces generally used for remote client view especially in distributed environment.

Let’s take the previous example i.e. Employee Detail. What we are doing is , we are creating EmployeeDetailService project and deploying it in Jboss. If you can remember that we are creating one remote interface EmployeeDetails like this

packagecom.bullraider.services.business;
importjavax.ejb.Remote;
@Remote
publicinterfaceEmployeeDetails {
    publicEmployee getDetail(intemployeeId);
}


Let’s remove the @Remote and write the @Local and once again deploy it. After running it will throw exception like this
javax.naming.NameNotFoundException: remote not bound

packagecom.bullraider.services.business;
importjava.io.Serializable;
publicclassEmployee implementsSerializable{
    privateString name;
    privateintid;
    privateintsal;
    publicString getName() {
        returnname;
    }
    publicvoidsetName(String name) {
        this.name = name;
    }
    publicintgetId() {
        returnid;
    }
    publicvoidsetId(intid) {
        this.id = id;
    }
    publicintgetSal() {
        returnsal;
    }
    publicvoidsetSal(intsal) {
        this.sal = sal;
}
}


Remove that Serializable interface. Once again save it and deploy it. You can observe exception will come like this
Caused by: org.jboss.remoting.InvocationFailureException: Unable to perform invocation; nested exception is:
    java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: com.bullraider.services.business.Employee

That means we are passing object, one virtual machine to other.  For that reason we should implement Serialized interface.

So we have already given example of Remote interface. In next example we will discuss about @Local Interface.