Jetty Plus and JNDI

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Jetty Plus and JNDI

Philip A. Chapman
Everyone,

I have an app that uses hibernate and expects to get the DataSource from
JNDI.  Based on the documentation on Jetty Plus, it apears that I can
only configure simple data types for binding into JNDI, such as Strings
and Integers through web.xml.  Therefore, I wrote code called by my
servlet when it instantiates that will read info, such as the driver
class and jdbc URL and build a DataSource.  Then, I try to put that
DataSource into JNDI using context.rebind.  I get an error saying that
JNDI is immutable.

I can see in the code where it checks for the key
"org.mortbay.jndi.immutable" in order to determine if the context is
mutable.  For the life of me, I cannot find where this key is being set
and (more imporatantly) how to configure jetty so that it is not set.

Am I going about this the wrong way?  Is there a better way?  Is there a
way to make the context mutable?

Thanks,
--
Philip A. Chapman

signature.asc (259 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Jetty Plus and JNDI

jan_bartel
Hi Philip,


Have you had a look at the datasource configuration documentation:

http://jetty.mortbay.org/jetty/plus/datasources.html
http://jetty.mortbay.org/jetty/plus/xadatasources.html

You should be able to configure the datasource in the jetty xml
file and look it up in JNDI in your webapp.

BTW: the java:comp/env namespace is immutable once the webapp has
been started because the servlet spec/j2ee spec requires this.

regards
Jan

Philip A. Chapman wrote:

> Everyone,
>
> I have an app that uses hibernate and expects to get the DataSource from
> JNDI.  Based on the documentation on Jetty Plus, it apears that I can
> only configure simple data types for binding into JNDI, such as Strings
> and Integers through web.xml.  Therefore, I wrote code called by my
> servlet when it instantiates that will read info, such as the driver
> class and jdbc URL and build a DataSource.  Then, I try to put that
> DataSource into JNDI using context.rebind.  I get an error saying that
> JNDI is immutable.
>
> I can see in the code where it checks for the key
> "org.mortbay.jndi.immutable" in order to determine if the context is
> mutable.  For the life of me, I cannot find where this key is being set
> and (more imporatantly) how to configure jetty so that it is not set.
>
> Am I going about this the wrong way?  Is there a better way?  Is there a
> way to make the context mutable?
>
> Thanks,



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Jetty-support mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jetty-support
Reply | Threaded
Open this post in threaded view
|

Re: Re: Jetty Plus and JNDI

Philip A. Chapman
Thank you for the response, Jan.

Jan Bartel wrote:

> Hi Philip,
>
>
> Have you had a look at the datasource configuration documentation:
>
> http://jetty.mortbay.org/jetty/plus/datasources.html
> http://jetty.mortbay.org/jetty/plus/xadatasources.html
>
> You should be able to configure the datasource in the jetty xml
> file and look it up in JNDI in your webapp.
>
> BTW: the java:comp/env namespace is immutable once the webapp has
> been started because the servlet spec/j2ee spec requires this.
>
> regards
> Jan
>
> Philip A. Chapman wrote:
>
>> Everyone,
>>
>> I have an app that uses hibernate and expects to get the DataSource from
>> JNDI.  Based on the documentation on Jetty Plus, it apears that I can
>> only configure simple data types for binding into JNDI, such as Strings
>> and Integers through web.xml.  Therefore, I wrote code called by my
>> servlet when it instantiates that will read info, such as the driver
>> class and jdbc URL and build a DataSource.  Then, I try to put that
>> DataSource into JNDI using context.rebind.  I get an error saying that
>> JNDI is immutable.
>>
>> I can see in the code where it checks for the key
>> "org.mortbay.jndi.immutable" in order to determine if the context is
>> mutable.  For the life of me, I cannot find where this key is being set
>> and (more imporatantly) how to configure jetty so that it is not set.
>>
>> Am I going about this the wrong way?  Is there a better way?  Is there a
>> way to make the context mutable?
>>
>> Thanks,
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc. Do you grep through log
> files
> for problems?  Stop!  Download the new AJAX search engine that makes
> searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
> http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
> _______________________________________________
> Jetty-support mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jetty-support

--
Philip A. Chapman

Application Development:
Java, Visual Basic (MCP), PostgreSQL, MySQL, MSSQL
Linux, Windows 9x, Windows NT, Windows 2000, Windows XP

signature.asc (259 bytes) Download Attachment