Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[jetty-dev] Re: jetty-dev Digest, Vol 11, Issue 5

Hi, Jan,
   Very much thanks for your help.
  
    I try with your suggestion to access the object like "ic.lookup("jdbc/mydatasource")", it works within one webapp, also works out of one webapp.
    Now I can continue my integration.
    Thanks again:)     

Regards,
Andy

On Tue, Jan 19, 2010 at 1:00 AM, <jetty-dev-request@xxxxxxxxxxx> wrote:
Send jetty-dev mailing list submissions to
       jetty-dev@xxxxxxxxxxx

To subscribe or unsubscribe via the World Wide Web, visit
       https://dev.eclipse.org/mailman/listinfo/jetty-dev
or, via email, send a message with subject or body 'help' to
       jetty-dev-request@xxxxxxxxxxx

You can reach the person managing the list at
       jetty-dev-owner@xxxxxxxxxxx

When replying, please edit your Subject line so it is more specific
than "Re: Contents of jetty-dev digest..."


Today's Topics:

  1. Re: How to access jndi out of webapp? (Jan Bartel)
  2. Re: How to access jndi out of webapp? (Hugues Malphettes)


----------------------------------------------------------------------

Message: 1
Date: Mon, 18 Jan 2010 11:00:35 +1100
From: Jan Bartel <janb@xxxxxxxxxxx>
Subject: Re: [jetty-dev] How to access jndi out of webapp?
To: "Jetty @ Eclipse developer discussion list"
       <jetty-dev@xxxxxxxxxxx>
Message-ID: <4B53A4A3.5040305@xxxxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

Andy,

I'm not quite sure what you're trying to do.  Assuming you have
something like this in jetty.xml:

 <New id="mydatasource" class="org.eclipse.jetty.plus.jndi.Resource">
   <Arg></Arg>
   <Arg>jdbc/mydatasource</Arg>
   <Arg>......</Arg>
  </New>


Then you access that in your webapp as:
InitialContext ic = new InitialContext();
ic.lookup("java:comp/env/jdbc/mydatasource");


Outside of that, you can look it up as:
InitialContext ic = new InitialContext();
ic.lookup("jdbc/mydatasource");

Note that only works for jvm-scoped objects. You could look up
objects with other scopes, such as Server too, if you absolutely
needed to. Let me know if you want to do something like that and
I can show you how.

regards
Jan

Michael Zhu wrote:
> 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
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> jetty-dev mailing list
> jetty-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-dev

--
Jan Bartel, Webtide LLC | janb@xxxxxxxxxxx | http://www.webtide.com


------------------------------

Message: 2
Date: Sun, 17 Jan 2010 22:13:01 -0800
From: Hugues Malphettes <hmalphettes@xxxxxxxxxxx>
Subject: Re: [jetty-dev] How to access jndi out of webapp?
To: "Jetty @ Eclipse developer discussion list"
       <jetty-dev@xxxxxxxxxxx>
Message-ID:
       <4ca090fe1001172213g70a1911al64a48d647fbfd435@xxxxxxxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1

Hi Andy,

I understand you are using the jetty-osgi integration, you use jetty
to declare the jndi object and in an OSGi bundle that is not related
to a web-application you are looking for the same object in jndi.

We have not tested this particular situation yet.
Let's chat and come up with a test-case so we can reproduce the issue
and fix it.

Best,
Hugues


On Fri, Jan 15, 2010 at 8:12 PM, Michael Zhu <zhu@xxxxxxxxxxx> wrote:
> 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
> _______________________________________________
> jetty-dev mailing list
> jetty-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/jetty-dev
>
>


------------------------------

_______________________________________________
jetty-dev mailing list
jetty-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-dev


End of jetty-dev Digest, Vol 11, Issue 5
****************************************


Back to the top