Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-dev] How to access jndi out of webapp?

Hi, all,
    I am working on BPMS integration stuff with jetty server, now I get one problem to access jndi. The problem is we want to  access the jndi out of webapp.
  
    More details for the case:
    1): Define the naming resource in jetty.xml with jvm scope or server scope.
    2): Access the jndi with below simple code
    --------------------------------------------------------
        System.getProperties().setProperty("java.naming.factory.url.pkgs", "org.eclipse.jetty.jndi");
        System.getProperties().setProperty("java.naming.factory.initial", "org.eclipse.jetty.jndi.InitialContextFactory");   

        InitialContext ic = new InitialContext();
        Object object = ic.lookup(jndiName); // the jndiName is already defined in jetty.xml
--------------------------------------------------------
    The above code will be ok if in one webapp(web context configured), but it will be failed if not within one webapp.

    Is it any way to access the jndi out of the webapp?
   
    Lots of thanks if anyone can help!

Regards,
Andy

Back to the top