Hello.
I'm developing a simple (read: JSP, JDBC-based, but not using EJBs, JMS, JTA or anything fancy) application. I want to use the UUIDKeyGenerator that is bundled with JBoss, but I am stumped at how to declare and use the UUID Key Generator.
I've got the uuidkeygenerator.sar in the deploy directory. I've set up the code:
 try {
 InitialContext ic = new InitialContext();
 String idFactoryName = "UUIDKeyGeneratorFactory";
 // get generator factory from JNDI
 try {
 UUIDKeyGeneratorFactory keyGeneratorFactory =
 (UUIDKeyGeneratorFactory)ic.lookup(idFactoryName);
 // get generator instance
 UUIDKeyGenerator idGenerator =
 (UUIDKeyGenerator)keyGeneratorFactory.getKeyGenerator();
 String generatedId = (String)idGenerator.generateKey();
 log("Id is: " + generatedId);
 } catch (Exception ex) {
 log("Threw an exception: " + ex.getMessage());
 }
 } catch (NamingException nex) {
 log("Threw a naming exception: " + nex.getExplanation());
 }
I double-checked that standardjbosscmp-jdbc has the following declaration:
 <unknown-pk>
 <key-generator-factory>UUIDKeyGeneratorFactory</key-generator-factory>
 <unknown-pk-class>java.lang.String</unknown-pk-class>
 <jdbc-type>VARCHAR</jdbc-type>
 <sql-type>VARCHAR(32)</sql-type>
 </unknown-pk>
But when I run the program, here's the exception I get:
WebModule[/db_test]Threw an exception: UUIDKeyGeneratorFactory not found|#]
I'm obviously missing something quite fundamental. Can anyone help me out here?
Thanks,
Maya