Java Reference
In-Depth Information
Because there's an EJB 2.x remote stateless session bean for calculating postage, you only have to
access it in your front desk subsystem. To talk to the remote service, you interface in terms of the EJBHome
and the EJB Remote ( PostageServiceRemote ) interface. It is against these interfaces that a client-side
proxy will be created. You are given the following remote interface and home interface for this EJB
component:
package com.apress.springenterpriserecipes.post;
import java.rmi.RemoteException;
import javax.ejb.EJBObject;
public interface PostageServiceRemote extends EJBObject {
public double calculatePostage(String country, double weight)
throws RemoteException;
}
package com.apress.springenterpriserecipes.post;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
public interface PostageServiceHome extends EJBHome {
public PostageServiceRemote create() throws RemoteException, CreateException;
}
Suppose this EJB component has already been deployed in an EJB container (e.g., an OpenEJB
container started up on localhost). The JNDI name of this EJB component is PostageServiceRemoteHome .
Note To access an EJB component deployed in an EJB container, you have to include the EJB container's
client library in your classpath. For OpenEJB 3.1.1, it is openejb-client-3.1.1.jar (located in the lib directory
of the OpenEJB installation).
Accessing EJB 2.x Components
With Spring's support, accessing an EJB component can be significantly simplified. You can access
an EJB component by its business interface. A business interface differs from an EJB remote interface
in that it doesn't extend EJBObject , and its method declarations don't throw RemoteException , which
Search WWH ::




Custom Search