5 Replies Latest reply on Oct 30, 2003 1:41 AM by raphead

    Using uuidKeyGeneratorFactory in JSP failes

    raphead

      Hi, I'm new to Jboss and I try to read/search as much as I can but I can't move around the following problem:

      I do the following in a JSP:

      InitialContext ic = new InitialContext();

      UUIDKeyGeneratorFactory uuidKeyGeneratorFactory = (UUIDKeyGeneratorFactory)ic.lookup("UUIDKeyGeneratorFactory");

      UUIDKeyGenerator = uuidKeyGeneratorFactory.getKeyGenerator();

      Everything works except the last line. where 'UUIDKeyGenerator' cannot be resolved.
      Well, I found out that the factory returns a
      'KeyGenerator' Object but from which package?!

      All I want to have is a uuid-generator, maybe there is a better way or how to fix my code is my question.

      Thx

        • 1. Re: Using uuidKeyGeneratorFactory in JSP failes
          raphead

          Nobody a clue?!

          • 2. Re: Using uuidKeyGeneratorFactory in JSP failes
            jonlee

            org.jboss.ejb.plugins.keygenerator.KeyGenerator

            org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGenerator
            public class UUIDKeyGenerator
            implements KeyGenerator

            It is part of the server branch of the source. The full implmentation is packed in jboss.jar. The KeyGenerator interface and factory can be found the the JBoss clients. Since we are not really sure what your intent is, you will either need to provide more information or look at the source areas we have provided and go from there.

            Hope it helps.

            • 3. Re: Using uuidKeyGeneratorFactory in JSP failes
              raphead

              Hi and thanks for the reply!

              That helped because now I know which KeyGenerator is generated here. I only had uuid-key-generator.sar as a reference of packages and so on.

              Straight forward I imported 'org.jboss.ejb.plugins.keygenerator.*' additionally but I keep getting:

              -------------------------------------------------------------------------
              [javac] Compiling 1 source file
              [javac] C:\JAVA_APPS\jboss\server\default\work\MainEngine\localhost\myweb\index_jsp.java:297: cannot resolve symbol
              [javac] symbol : variable KeyGenerator
              [javac] location: class org.apache.jsp.index_jsp
              [javac] KeyGenerator = uuidKeyGeneratorFactory.getKeyGenerator();
              [javac] ^
              [javac] 1 error
              ---------------------------------------------------------------------------

              So does it mean all libs in .../server/default/lib
              Are not visible by the application?


              However, I only need a UUID keygenerator and as JBOSS includes one, why should I bring in another one.
              Maybe my way of trying to do this is not the appropriate one?!

              Thx

              • 4. Re: Using uuidKeyGeneratorFactory in JSP failes
                jonlee

                You need to declare an instance of the object I think.
                KeyGenerator myKeyGenerator = uuidKeyGeneratorFactory.getKeyGenerator();

                • 5. Re: Using uuidKeyGeneratorFactory in JSP failes
                  raphead

                  Hi Jon,

                  You were 100% right... incompetent user error :)
                  I'm not yet really used to Java

                  Many Thanks