1 Reply Latest reply on Dec 9, 2004 7:55 PM by beonice

    Using UUIDKeyGenerator with Oracle

    beonice Newbie


      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 =

      // get generator instance
      UUIDKeyGenerator idGenerator =
      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:


      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?


        • 1. Re: Using UUIDKeyGenerator with Oracle
          beonice Newbie

          Duh. Colour me stupid.

          I was thinking about it some more and had an amazing insight.

          I was developing and testing on Sun Java Studio Creator with the Sun One Application Server, and I was happily updating the standardjbosscmp-jdbc.xml file in the JBoss environment.

          Obviously, the Sun One App Server had no clue about the UUIDKeyGenerator at all.

          I exported a war file to JBoss and tested it there ... it works beautifully. :)

          Thanks for checking this post, guys. Sorry to waste your time. :)