You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Emmanuel Dupont <em...@jwaretechnologies.com> on 2003/05/21 14:02:20 UTC
Ojb and LDAP/JNDI
All,
I didn't' find the solution in the Archive. Here is my trouble.
I want to externalise in a LDAP/JNDI all my databases connections. I know
that I can do that with the DataSources objects. I put the
"jndi-datasource-name > in the repository-database.xml.
But what I don't know is how to use it. Can someone send to me some piece of
code.
I have tried with the classic code .
And I have this error :
[org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl] ERROR:
Naming Exception while looking up DataSource (java:comp/env/jdbc/ds1)
Need to specify class name in environment or system property, or as an
applet parameter, or in an application resource file:
java.naming.factory.initial
javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource file: java.naming.factory.initial
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
What does that mean?
Thanx !
Re: Ojb and LDAP/JNDI
Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi,
seems that OJB could not get JNDI-Context.
> javax.naming.NoInitialContextException: Need to specify class name in
> environment or system property, or as an applet parameter, or in an
> application resource file: java.naming.factory.initial
I'm not an expert (means, I don't really know), but
maybe you have to set implementation specific JNDI-properties.
To do so use OJB class
NamingLocator.setContext(Properties properties)
method before lookup connections (e.g. at startup).
In the docs of your JNDI-provider you should
found the needed specifications
properties = new Properties();
prop.put("java.naming.factory.initial", fac);
prop.put("java.naming.provider.url", url);
prop.put("java.naming.factory.url.pkgs", pkgs);
... some more
HTH
regards,
Armin
----- Original Message -----
From: "Emmanuel Dupont" <em...@jwaretechnologies.com>
To: "OJB Users List" <oj...@db.apache.org>
Sent: Wednesday, May 21, 2003 2:02 PM
Subject: Ojb and LDAP/JNDI
All,
I didn't' find the solution in the Archive. Here is my trouble.
I want to externalise in a LDAP/JNDI all my databases connections. I
know
that I can do that with the DataSources objects. I put the
"jndi-datasource-name > in the repository-database.xml.
But what I don't know is how to use it. Can someone send to me some
piece of
code.
I have tried with the classic code .
And I have this error :
[org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl] ERROR:
Naming Exception while looking up DataSource (java:comp/env/jdbc/ds1)
Need to specify class name in environment or system property, or as an
applet parameter, or in an application resource file:
java.naming.factory.initial
javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource file: java.naming.factory.initial
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:2
80)
What does that mean?
Thanx !
RE: Ojb and LDAP/JNDI
Posted by Matthias Roth <ma...@impart.ch>.
Hi,
if you use java:comp/env.... then you have to setup your local
context. If you know where the datasource is located in the Jndi
, normal under jdbc/ds1, then use this name direct.
If you are in an web container then you must define a reference in
The web.xml file as follow:
<resource-ref id="ResourceRef_1053550116384">
<res-ref-name>jdbc/ds1</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>CONTAINER</res-auth>
</resource-ref>
If you deploy the application to your application server, then you must
Enter the real position of ds1 in your jndi service.
Regards
Matthias
-----Original Message-----
From: Emmanuel Dupont [mailto:emmanuel.dupont@jwaretechnologies.com]
Sent: Mittwoch, 21. Mai 2003 14:02
To: OJB Users List
Subject: Ojb and LDAP/JNDI
All,
I didn't' find the solution in the Archive. Here is my trouble.
I want to externalise in a LDAP/JNDI all my databases connections. I
know
that I can do that with the DataSources objects. I put the
"jndi-datasource-name > in the repository-database.xml.
But what I don't know is how to use it. Can someone send to me some
piece of
code.
I have tried with the classic code .
And I have this error :
[org.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl] ERROR:
Naming Exception while looking up DataSource (java:comp/env/jdbc/ds1)
Need to specify class name in environment or system property, or as an
applet parameter, or in an application resource file:
java.naming.factory.initial
javax.naming.NoInitialContextException: Need to specify class name in
environment or system property, or as an applet parameter, or in an
application resource file: java.naming.factory.initial
at
javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
at
javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at
javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:2
80)
What does that mean?
Thanx !