Java Enterprise in a Nutshell By David Flanagan, Jim Farley, William Crawford & Kris Magnusson The unconfirmed error reports are from readers. They have not yet been approved or disproved by the author or editor and represent solely the opinion of the reader. This page was updated October 30, 2002. Here's a key to the markup: [page-number]: serious technical mistake {page-number}: minor technical mistake : important language/formatting problem (page-number): language change or minor formatting problem ?page-number?: reader question or request for clarification UNCONFIRMED errors and comments from readers: [6] top of page: It says "The extension package also supports scrollable result sets, batch updates, and the storage of Java objects in databases." Unless I am mistaken, the java.sql package already provides scrollable result sets and batch updates. (24) top of page, 1st full paragraph: callinggetObject() - is missing a space between "calling" and "getObject()". (29) 4th paragraph; In discussion of DatabaseMetaData methods, the paragraph states that the class "provides an overwelming number of methods .... The full list is given in Chapter 17, The java.rmi.server Package." Should read: "The full list is given in Chapter 18, The java.sql Package." ?38? Table 2-2: Table 2-2 states the absolute scrolling function can take a negative value as its argument. Is this true? What might it mean to tell the DB to go to record number -5? {52} 1; class constructor is partly missing only the comment and the closing bracket are present. See source code for AccountImpl. [56] last paragraph, 5th line from bottom: Note that these three methods (bind(), rebind() and unbind()) can be called only by clients running on the same host as the registry. If a remote client attempts to call these methods, the client receives a java.rmi.AccessException. On Java Remote Method Invocation Specification-Java 2 SDK, v1.3.0, December 1999, Section 4.3, The Naming Class says: The java.rmi.Naming Class provides methods for storing and obtaining references to remote objects in the REMOTE object registry. in the next paragraph: where HOST is the host (remote or local) where the registry is located Have I missed something? {112} Example 4-11; to make a dynamic call to the doThis method: Missing: dynamic discovery of parameters & return types CORBA Interface Repository API's provide self-describing system based on metadata stored for dynamic search & review. I'm no expert, but Orfali, Harkey & Edwards in "Instant CORBA" c.1997 chapter 5, page 62 suggest the following steps to dynamically invoke a remote method on an object reference. They also note the use of the Trader service for additional info. (The following copied/paraphrased from above - WARNING: untested - I don't normally use this). 1) Obtain the interface name - in your example, call objRef._get_Interface_def(); to get org.omg.CORBA.Object which is an InterfaceDef object in an Interface Repository. 2) Obtain the method description from the Interface Repository - call lookup_name to find method to invoke, then call describe to get method's full IDL definition or call describe_interface to get a full description ... 3) Create argument list - this is where your example continues. {112} line 7 in Example 4-11: The variable singleORB is never used. [113] lines 6 and 7: There are two places referring to Java 1.2 in the book, but in the sample codes on the web site, it refers to Java 2. When I tried Java 2 (1.3), it returned a NOT_IMPLEMENTED exception. Is the book wrong? {119} bottom of page: SerlvetRequest -> ServletRequest (146) second sentence: extra space within the word "String"; line currently reads ..."object and use it to store some St ring values. The keys..." (147) middle of page: missing space between "InititalContext" and "object"; line currently reads "naming system, you must first create an InitialContextobject. The InitialContext..." {147} near bottom of page: com.sun.jndi.fscontext.RefFSContxtFactory -> com.sun.jndi.fscontext.RefFSContextFactory {152} last part of the NamingShell example: In main() the creation of the Shell is missing: NamingShell shell = new NamingShell(); [159] 1st paragraph: I believe you meant to say NameClassPair rather than NameValuePair in a couple of areas. According to the JSDK 1.3 API, NameValuePair is part of CORBA and not part of JNDI. [161] middle of page: java.io.File newfile = java.io.File("c:\temp\newfile"); tempContext.bind("newfile", newfile); There are *three* errors: 1. The right hand side after "=" is missing "new". 2. There are unescaped backslashes in the quoted string. 3. This doesn't work! java.io.File does not implement Referenceable and so the bind() throws an exception at runtime. {168} near middle of page: andREPLACE_ATTRIBUTES -> and REPLACE_ATTRIBUTES (178) last code example: Due to Java's single inheritance rule, one cannot extend multiple classes. Therefore, the example should read: public interface Person extends EJBObject { This is also true because EJBObject already extends java.rmi.Remote! (178) comment on above erratum: The truth is: "Interfaces are different from classes in one very important way, however. An interface can extend more than one interface at a time." So, the syntax of the original code was correct (as well). Although it isn't necessary to extend the Remote interface explicitly, it may be easier to understand that way. {195} near bottom of page: afterBegins() -> afterBegin() [198] 3rd paragraph: "The first finder method returns a single Profile object..." In Example 7-8 immediately following, the return type defined in the home interface reiterates this: "public Profile findByPrimaryKey(...". However, the next paragraph says "If a findXXX() method finds an appropriate bean...a single primary key...(is) returned to the client. This is consistent with Example 7-9: "public ProfilePK ejbFindByPrimaryKey(...". I believe 7-8 should read as follows: "public ProfilePK findByPrimaryKey(...", and that paragraph 3 should also be changed. (199) 3rd paragraph, 2nd sentence: The implementation must also provide additional findXXX() methods to match any other ejbfindXXX() methods on the home interface. should read: The implementation must also provide additional ejbfindXXX() methods to match any other findXXX() methods on the home interface. [203] 5th method; The function ejbFindByPrimaryKey calls the loadFromDB function to verify the existence of a certain primary key. However, the loadFromDB function actually reads in the values from the database, and stores them in the instance variable mEntries. As I understand it, the ejbFindByPrimaryKey function is only supposed to verify the existence of the specified primary key in the database, and throw FinderException if it does not exist. The ejbFindByPrimaryKey function is not supposed to actually change the values in the particular bean instance, is it? All other examples I can find seem to contradict this particular example. If I am misunderstanding this method, I would love to know. (273) The second paragraph begins with a superfluous ">". (274) top of page (two times): an paragraph -> a paragraph {363} class javax.ejb.EJBException: EJBException extends RuntimeException class is an unchecked exception, not a checked exception. Not sure if description is still valid. The javadoc for the class says, "The EJBException exception is thrown by an enterprise Bean instance to its container to report that the invoked business method or callback method could not be completed because of an unexpected error (e.g. the instance failed to open a database connection)". Did not find any information on what the container code should do when it catches this exception from a EJB business method.