***** IBM WebSphere Studio Application Developer 5.1.2 (WSAD) Notes ***** 1. Use META-INF/MANIFEST.MF entires to get access to library jar files required by a WAR. You should carefully structure the jar files as to have appropriate dependencies (i.e. NO CIRCULAR DEPENDENCIES). 2. Need to Connect to a DB Server and "Import to Folder..." to the EJB META-INF/backends/ORACLE_V9_1 before mapping CMP EJB fields (from the Data Perspective). Note: it is not possible to overwrite an existing folder (if previously imported). The alternatives are export to a new folder and remap the fields or manually update the table definition (via editing the appropriate *.tblxmi files). ==> As a result, you MUST REMAP all EJB CMPs if a new table is added to the schema. An alternative is to create a new EJB project for any new tables. 3. Need to Generate "EJB to RDB Mapping" for an EJB project before mapping CMP EJB fields. Use an existing or a new "backend" folder as appropriate. For a new mapping, you can decide from "top down" or "meet in the middle" approaches (Not yet tried!). 4. Edit the "Map.mapxmi" file to perform CMP EJB to Table mappings. Apparently the "Create Mapping" action seems to do the same as the "Match by Name" and "Match by Type" actions. 5. When specifying an EJB CMP field as part of a the bean key, the corresponding database table column must be specified as part of the primary key. (Note: do this manually if it was not configured correctly at the database level). 6. Apparently you can only have one key per bean so it is not possible to find an CMP EJB bean using more way. So you have to decide if you will find a bean by a unique ID or a unique CODE since you can not do both. Instead you need to add a finder method to the home class and use EJB-QL (some limitations may apply - e.g. order by for certain versions of J2EE?). 7. A good approach for separating source code and generated code in EJB is to specify an alternate "Source Folder" (e.g. JavaSource) and keep the "ejbModule" folder for the generated source. This allows for easy deletion of generated code and provide a faster way to access the source code. 8. WebSphere Test Environment class path should be pretty much empty if you properly structure the dependencies between the projects in the various tiers. You will however will still need to provide the path to the JDBC driver (e.g. oracle-jdbc-1.2.zip) in either the ws.ext.dirs or the standard classpath. Note: you will get some WebSphere internal class not found exceptions related to the JDBC driver if it cannot be found in the classpath. 9. To use EJB CMP you will have to configure a data source and perform various vendor specific steps. For WSAD 5.1 you will need to perform the following: - Create JAAS Authentication Entry with required database name/password. - Create a data source with JNDI name "jdbc/xxxDataSource". and indicate that the data source will be used in CMP (a check box). - Create J2C Connection Factory with name "XXX Data Source_CF" and map to JNDI name "eis/jdbc/xxxDataSource_CMP". Next edit the EJB ejbModule/META-INF/ejb-jar.xml file and specify the following: - JNDI - CMP Connection Factory Binding to use JNDI name "jdbc/xxxDataSource". 10. To access EJBs/DataSource from an EJB/WAR you will need to do the following: For EJBs edit the ejbModule/META-INF/ejb-jar.xml file. For WARs edit the WEB-INF/web.xml file. To access a data source from an EJB/WAR: - Create a data source with JNDI name "jdbc/xxxDataSource". - For each EJB/WAR, create a ResourceEnvRef with logical name of "jdbc/xxx" and map to JNDI name "jdbc/xxxDataSource". Use "java:comp/env/jdbc/xxx" as the lookup key for JNDI. To access an EJB from an EJB/WAR: - Bind the EJB with JNDI name of "ejb/full/class/name". - For each EJB/WAR, create a EjbLocalRef or EJB Reference (as appropriate) with logical name of "ejb/" and map to JNDI name "ejb/full/class/name" (i.e. use a slash '/' instead of periods). Then use "java:comp/env/ejb/" (ENC syntax) to access to the EJB using JNDI. Note: You can access an EJB w/o using ENC syntax but this does not allow the JNDI name to be changed at deployment time. However, in that case you will not have to create references. 11. To make use of JSP tag libraries, you must defined various TLD files and specify them in the WEB-INF/web.xml. You will also need to define the prefix to use in all JSP files using the "taglib" directive. e.g. in web.xml file for the WAR /WEB-INF/struts-bean.tld /WEB-INF/struts-bean.tld e.g. in "include/taglibs.jspf", included by all JSP files: <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> Then you access the various tags as ... Message Driven Beans Notes: -------------------------- 1. To configure a MDB, you will need to configure the 'Listener Port' Name. This configuration is vendor specific and IBM WAS file is ibm-ejb-jar-bnd.xmi file. In addition, the EJB Container must be configure to specify the Connection Factory JNDI name as well as the Destination JNDI name (i.e. Queue name) for each 'Listener Port'. For WSAD, additional software must be installed to support the 'MQ Simulator for Java Developers' JMS Provider (Could not get the 'Embedded Messaging' option to work). Under the 'JMS' tab of the WSAD Test Environment, the Queue Name must be specified. The JMS Connection Factories and JMS Destinations must also be configured as appropriate. Q: Is it possible to configure the MDB to only process messages between certain time periods. If a message is sent outside of the time periods, it will be queued until the appropriate time.