E 3 I 3 Errata to the EJBTM 1.1 Final Release E 3
The ejb-client JAR file is specified in the deployment descriptor of the ejb-jar file using the optional ejb-client-jar element. The Deployer should ....With:
The ejb-client JAR file is specified in the deployment descriptor of the ejb-jar file using the optional ejb-client-jar element. The value of the ejb-client-jar element is the path name specifying the location of the ejb-client JAR file in the containing J2EE Enterprise Application Archive (.ear) file. The path name is relative to the location of the referencing ejb-jar file. The Deployer should ...
The container must implement the SessionContext.getEJBObject() method such that the bean instance can use the Java language cast to convert the returned value to the session bean's remote interface type. Specifically, the bean instance does not have to use the PortableRemoteObject.narrow(...) method for the type conversion.
The container must implement the EntityContext.getEJBObject() method such that the bean instance can use the Java language cast to convert the returned value to the entity bean's remote interface type. Specifically, the bean instance does not have to use the PortableRemoteObject.narrow(...) method for the type conversion.
Each resource-ref element describes a single resource manager connection factory reference. The resource-ref element consists of the description element; and the mandatory res-ref-name, res-type, and res-auth elements. The res-ref-name element contains the name of the environment entry used in the enterprise bean's code.With:
Each resource-ref element describes a single resource manager connection factory reference. The resource-ref element consists of the description element; and the mandatory res-ref-name, res-type, and res-auth elements. The res-ref-name element contains the name of the environment entry used in the enterprise bean's code. The name of the environment entry is relative to the java:comp/env context (e.g, the name should be jdbc/EmployeeAppDB rather than java:comp/env/jdbc/EmployeeAppDB).
Example:With:<resource-ref> <res-ref-name>EmployeeAppDB</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>
Example:<resource-ref> <res-ref-name>jdbc/EmployeeAppDB</res-ref-name> <res-type>javax.sql.DataSource</res-type> <res-auth>Container</res-auth> </resource-ref>
An application exception must not be defined as a subclass of the java.lang.RuntimeException, or of the java.rmi.RemoteException. These are reserved for system exceptions (See next subsection).With:
An application exception class must be a subclass (direct or indirect) of java.lang.Exception. An application exception class must not be defined as a subclass of the java.lang.RuntimeException, or of the java.rmi.RemoteException. These are reserved for system exceptions (See next subsection).
Clients are not allowed to make concurrent calls to a session object. If a client-invoked business method is in progress on an instance when another client-invoked call, from the same or different client, arrives at the same instance, the container must throw the java.rmi.RemoteException to the second client. One implication of this rule is that it is illegal to make a "loopback" call to a session bean instance. An example of a loopback call is when a client calls instance A, instance A calls instance B, and B calls A. The loopback call attempt from B to A would result in the container throwing the java.rmi.RemoteException to B.With:
Clients are not allowed to make concurrent calls to a stateful session object. If a client-invoked business method is in progress on an instance when another client-invoked call, from the same or different client, arrives at the same instance of a stateful session bean class, the container must throw the java.rmi.RemoteException to the second client. One implication of this rule is that it is illegal to make a "loopback" call to a session bean instance. An example of a loopback call is when a client calls instance A, instance A calls instance B, and B calls A. The loopback call attempt from B to A would result in the container throwing the java.rmi.RemoteException to B. This restriction does not apply to a stateless session bean because the container routes each request to a different instance of the session bean class.
A client program must use the PortableRemoteObject.narrow(...) method to convert the objects contained in the collections returned by the finder method to the entity bean's remote interface type.
public class EmployeeServiceBean implements SessionBean {
...
public void setTaxInfo(int numberOfExemptions, ...)
throws InvalidNumberOfExemptionsException {
...
// Obtain the enterprise bean's environment naming context.
Context initCtx = new InitialContext();
Context myEnv = (Context)initCtx.lookup("java:comp/env");
// Obtain the maximum number of tax exemptions
// configured by the Deployer.
Integer max = (Integer)myEnv.lookup("maxExemptions");
// Obtain the minimum number of tax exemptions
// configured by the Deployer.
Integer min = (Integer)myEnv.lookup("minExemptions");
// Use the environment entries to customize business logic.
if (numberOfExeptions > maxExemptions ||
numberOfExemptions < minExemptions)
throw new InvalidNumberOfExemptionsException();
// Get some more environment entries. These environment
// entries are stored in subcontexts.
String val1 = (String)myEnv.lookup("foo/name1");
Boolean val2 = (Boolean)myEnv.lookup("foo/bar/name2");
// The enterprise bean can also lookup using full pathnames.
Integer val3 = (Integer)
initCtx.lookup("java:comp/env/name3");
Integer val4 = (Integer)
initCtx.lookup("java:comp/env/foo/name4");
...
}
}
With:
public class EmployeeServiceBean implements SessionBean {
...
public void setTaxInfo(int numberOfExemptions, ...)
throws InvalidNumberOfExemptionsException {
...
// Obtain the enterprise bean's environment naming context.
Context initCtx = new InitialContext();
Context myEnv = (Context)initCtx.lookup("java:comp/env");
// Obtain the maximum number of tax exemptions
// configured by the Deployer.
Integer max = (Integer)myEnv.lookup("maxExemptions");
// Obtain the minimum number of tax exemptions
// configured by the Deployer.
Integer min = (Integer)myEnv.lookup("minExemptions");
// Use the environment entries to customize business logic.
if (numberOfExeptions > Integer.intValue(max) ||
numberOfExemptions < Integer.intValue(min))
throw new InvalidNumberOfExemptionsException();
// Get some more environment entries. These environment
// entries are stored in subcontexts.
String val1 = (String)myEnv.lookup("foo/name1");
Boolean val2 = (Boolean)myEnv.lookup("foo/bar/name2");
// The enterprise bean can also lookup using full pathnames.
Integer val3 = (Integer)
initCtx.lookup("java:comp/env/name3");
Integer val4 = (Integer)
initCtx.lookup("java:comp/env/foo/name4");
...
}
}
ds1 = (javax.sql.DataSource)
initCtx.lookup("java:comp/env/jdbcDatabase1");
With:
ds1 = (javax.sql.DataSource)
initCtx.lookup("java:comp/env/jdbc/Database1");
ds2 = (javax.sql.DataSource)
initCtx.lookup("java:comp/env/jdbcDatabase2");
With:
ds2 = (javax.sql.DataSource)
initCtx.lookup("java:comp/env/jdbc/Database2");
ds1 = (javax.sql.DataSource)
initCtx.lookup("java:comp/env/jdbcDatabase1");
With:
ds1 = (javax.sql.DataSource)
initCtx.lookup("java:comp/env/jdbc/Database1");
ds2 = (javax.sql.DataSource)
initCtx.lookup("java:comp/env/jdbcDatabase2");
With:
ds2 = (javax.sql.DataSource)
initCtx.lookup("java:comp/env/jdbc/Database2");
ds = (javax.sql.DataSource)
initCtx.lookup("java:comp/env/jdbcDatabase");
With:
ds = (javax.sql.DataSource)
initCtx.lookup("java:comp/env/jdbc/Database");