Shouldn't JNDIRegister lookup work as JDBCWorkflowStore? correction

Hernani Mourão <[email protected]> Mon, 1 Mar 2004 05:35:37 -0000
Newsgroups gmane.comp.java.open-symphony.devel
Message-ID <[email protected]>
Hi,

Of course there was an error in my previous post. The JNDIRegister should
be:

Regards,
Hernâni

        try {
            try {
                r = (Register) new InitialContext().lookup(location); <--
line nok
            } catch (NamingException e) {
                log.info("location = " + location);

                //ok, couldn't find it, look in env
                r = (Register) new InitialContext().lookup("java:comp/env/"
+ location); <--  line nok
            }
        } catch (NamingException e) {
            String message = "Could not look up JNDI register at: " +
location;
            throw new WorkflowException(message, e);
        }


-----Original Message-----
From: Hernani Mourão [mailto:[email protected]]
Sent: segunda-feira, 1 de Março de 2004 2:05
To: [email protected]
Subject: Shouldn't JNDIRegister lookup work as JDBCWorkflowStore?


Hi all,

I was stuck to get the resource ref to a Register under Tomcat 5. When I
compared with JDBCWorkflowStore I realized that the lookup that worked was
the second one:
            try {
                return context.lookup(location);
            } catch (NamingException e) {
                //ok, couldn't find it, look in env
                return context.lookup("java:comp/env/" + location); ->> this
was working
            }


When I look into Tomcat 5 Documentation it seems that: "All configured
entries and resources will be placed in the java:comp/env portion of the
JNDI namespace"
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources-howto.html


So I only got JNDIRegister working when I changed the code as
JDBCWorkflowStore:
        try {

            try {
                return new InitialContext().lookup(location);
            } catch (NamingException e) {
                //ok, couldn't find it, look in env
                return new InitialContext().lookup("java:comp/env/" +
location);
            }
        } catch (NamingException e) {
            String message = "Could not look up JNDI register at: " +
location;
            throw new WorkflowException(message, e);
        }

Should that be a permanent change?
regards,
Hernâni



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click