Re: javax.naming.NameNotFoundException: Name java: is not bound in this Context

2004-12-15 Thread QM

: javax.naming.NameNotFoundException: Name java: is not bound in this Context
: at this place: Context envContext  = 
(Context)initial.lookup(java:/comp/env);

Should that be /comp/env or comp/env?

If not, help us help you -- you only posted excerpts of your server.xml
and context.xml, which makes it tougher to find problems (especially
since you encountered this problem after adding a new host def).

It also helps to know which version of Tomcat 5 you run.


All I can say right now is to check for the basics: Where's the resource
declared?  is it global?  Is it meant to be?   Are you certain Tomcat is
loading the context from 

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: javax.naming.NameNotFoundException: Name java: is not bound in this Context

2003-01-16 Thread Roberts, Eric
Yes, but the resource name is jdbc/esljsp - java:comp/env/jdbc/esljsp would be used in 
a servlet using JNDI such as:

 ctx = new InitialContext();
 Context envCtx = (Context) ctx.lookup(java:/comp/env/);
 DataSource ds = (DataSource) envCtx.lookup(/jdbc/esljsp);

Regards

Eric

-Original Message-
From: Veniamin Fichin [mailto:[EMAIL PROTECTED]]
Sent: Donnerstag, 16. Jänner 2003 11:53
To: Tomcat Users List
Subject: Re: javax.naming.NameNotFoundException: Name java: is not bound
in this Context


Thanks for your reply!
See below...

Roberts, Eric wrote:

 Hi,
 
 Try this:
 
 First define your DataSource resource e.g.
 Resource name=jdbc/esljsp auth=Container scope=Shareable 
type=javax.sql.DataSource/
 
 and add the necessary ResourceParams name=jdbc/esljsp
 and the parameters.
 then define your Realm using:
 
 dataSourceName=jdbc/esljsp

I already have these lines in config.xml:

--= [ server.xml ] =--
  Resource name=jdbc/esljsp
type=javax.sql.DataSource
auth=Container
scope=Shareable
description=Database resource for esljsp project /
  ResourceParams name=jdbc/esljsp
!-- various parameters not shown here --
  /ResourceParams
  Realm className=org.apache.catalina.realm.DataSourceRealm
 dataSourceName=java:/comp/env/jdbc/esljsp
 debug=5
 userTable=T_USERS
 userNameCol=NAME
 userCredCol=PASSWORD
 userRolesTable=T_USERROLES
 roleNameCol=ROLENAME /
--= [ / server.xml ] =--

If I haven't them there, I wouldn't be able to connect to database 
in my servlets, getting DataSource through JNDI. But servlets work just 
fine.
And exception is thrown while Tomcat starts up, telling me that 
java: name is not found, so this must not be configuration problem.

 HTH
 
 Eric
 
 -Original Message-

--= [ cut ] =--


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: javax.naming.NameNotFoundException: Name java: is not bound in this Context

2003-01-16 Thread Roberts, Eric
Sorry - missed it earlier - in the Realm definition, I think it should be just 
resourceName=jdbc/esljsp - not dataSourceName=jdbc/esljsp



-Original Message-
From: Veniamin Fichin [mailto:[EMAIL PROTECTED]]
Sent: Donnerstag, 16. Jänner 2003 12:26
To: Tomcat Users List
Subject: Re: javax.naming.NameNotFoundException: Name java: is not bound
in this Context


Roberts, Eric wrote:

 Yes, but the resource name is jdbc/esljsp - java:comp/env/jdbc/esljsp would be used 
in a servlet using JNDI such as:
 
  ctx = new InitialContext();
  Context envCtx = (Context) ctx.lookup(java:/comp/env/);
  DataSource ds = (DataSource) envCtx.lookup(/jdbc/esljsp);

Servlet snippet:

--= [ cut ] =--
try {
 javax.naming.InitialContext initCtx=new InitialContext();
 javax.naming.Context envCtx=
   (Context)initCtx.lookup(java:/comp/env);
 javax.sql.DataSource ds=(DataSource)envCtx.lookup(jdbc/esljsp);
}
catch (NamingException ne) {
 out.println(ne);
}
--= [ / cut ] =--

And it works. But dataSourceName attribute from DataSourceRealm is not.

 Regards
 
 Eric
 
 -Original Message-

--= [ cut ] =--


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: javax.naming.NameNotFoundException: Name java: is not bound in this Context

2003-01-16 Thread Roberts, Eric
All I know is that if you read the server.xml which comes with TC, that is what is 
there!!

-Original Message-
From: Veniamin Fichin [mailto:[EMAIL PROTECTED]]
Sent: Donnerstag, 16. Jänner 2003 13:33
To: Tomcat Users List
Subject: Re: javax.naming.NameNotFoundException: Name java: is not bound
in this Context


Roberts, Eric wrote:

 Sorry - missed it earlier - in the Realm definition, I think it should be just 
resourceName=jdbc/esljsp - not dataSourceName=jdbc/esljsp

That's odd. There is no resourceName attribute in DataSourceRealm 
documentation. I looked at the source of it and saw 
(set|get)DataSourceName only.
And I see that tomcat docs is wrong in DataSourceRealm description, 
because attribute list there is not reflect real things in code.
Now I'm trying to look into the sources, but I'm not so hacky...

 -Original Message-
 From: Veniamin Fichin [mailto:[EMAIL PROTECTED]]
 Sent: Donnerstag, 16. Jänner 2003 12:26
 To: Tomcat Users List
 Subject: Re: javax.naming.NameNotFoundException: Name java: is not bound
 in this Context
 
 Roberts, Eric wrote:
 
Yes, but the resource name is jdbc/esljsp - java:comp/env/jdbc/esljsp would be used 
in a servlet using JNDI such as:

 ctx = new InitialContext();
 Context envCtx = (Context) ctx.lookup(java:/comp/env/);
 DataSource ds = (DataSource) envCtx.lookup(/jdbc/esljsp);
 
 
 Servlet snippet:
 
 --= [ cut ] =--
 try {
  javax.naming.InitialContext initCtx=new InitialContext();
  javax.naming.Context envCtx=
(Context)initCtx.lookup(java:/comp/env);
  javax.sql.DataSource ds=(DataSource)envCtx.lookup(jdbc/esljsp);
 }
 catch (NamingException ne) {
  out.println(ne);
 }
 --= [ / cut ] =--
 
 And it works. But dataSourceName attribute from DataSourceRealm is not.
 
Regards

Eric

-Original Message-
 
 --= [ cut ] =--

-- 
Veniamin Fichin  [EMAIL PROTECTED]
Programmer athttp://www.rbcsoft.ru/


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: javax.naming.NameNotFoundException: Name java: is not bound in this Context

2003-01-16 Thread Roberts, Eric
Just some other things which may help:

I define my Realm datasource in the GlobalNamingResource element of server.xml and 
this is where the parameters are also defined.
Any Context requiring authentication is defined with privileged=true.
My Realm is defined within the Engine element - as the last item.

-Original Message-
From: Veniamin Fichin [mailto:[EMAIL PROTECTED]]
Sent: Donnerstag, 16. Jänner 2003 13:33
To: Tomcat Users List
Subject: Re: javax.naming.NameNotFoundException: Name java: is not bound
in this Context


Roberts, Eric wrote:

 Sorry - missed it earlier - in the Realm definition, I think it should be just 
resourceName=jdbc/esljsp - not dataSourceName=jdbc/esljsp

That's odd. There is no resourceName attribute in DataSourceRealm 
documentation. I looked at the source of it and saw 
(set|get)DataSourceName only.
And I see that tomcat docs is wrong in DataSourceRealm description, 
because attribute list there is not reflect real things in code.
Now I'm trying to look into the sources, but I'm not so hacky...

 -Original Message-
 From: Veniamin Fichin [mailto:[EMAIL PROTECTED]]
 Sent: Donnerstag, 16. Jänner 2003 12:26
 To: Tomcat Users List
 Subject: Re: javax.naming.NameNotFoundException: Name java: is not bound
 in this Context
 
 Roberts, Eric wrote:
 
Yes, but the resource name is jdbc/esljsp - java:comp/env/jdbc/esljsp would be used 
in a servlet using JNDI such as:

 ctx = new InitialContext();
 Context envCtx = (Context) ctx.lookup(java:/comp/env/);
 DataSource ds = (DataSource) envCtx.lookup(/jdbc/esljsp);
 
 
 Servlet snippet:
 
 --= [ cut ] =--
 try {
  javax.naming.InitialContext initCtx=new InitialContext();
  javax.naming.Context envCtx=
(Context)initCtx.lookup(java:/comp/env);
  javax.sql.DataSource ds=(DataSource)envCtx.lookup(jdbc/esljsp);
 }
 catch (NamingException ne) {
  out.println(ne);
 }
 --= [ / cut ] =--
 
 And it works. But dataSourceName attribute from DataSourceRealm is not.
 
Regards

Eric

-Original Message-
 
 --= [ cut ] =--

-- 
Veniamin Fichin  [EMAIL PROTECTED]
Programmer athttp://www.rbcsoft.ru/


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: javax.naming.NameNotFoundException: Name java: is not bound in this Context

2003-01-16 Thread Roberts, Eric
I am using 4.1.18 also - but upgraded from 4.1.12

-Original Message-
From: Veniamin Fichin [mailto:[EMAIL PROTECTED]]
Sent: Donnerstag, 16. Jänner 2003 14:03
To: Tomcat Users List
Subject: Re: javax.naming.NameNotFoundException: Name java: is not bound
in this Context


Roberts, Eric wrote:

 All I know is that if you read the server.xml which comes with TC, that is what is 
there!!

You may saw this attribute in UserDatabaseRealm definition in 
server.xml:

   Realm className=org.apache.catalina.realm.UserDatabaseRealm
  debug=0 resourceName=UserDatabase/

But we are talking about DataSourceRealm...

Anyway thank you for your effort! May be I should try writing in 
tomcat-dev , as this feature is relatively new (if I'm not wrong, it 
first appeared in 4.1.18), and there may be truly a bug.

 -Original Message-
 From: Veniamin Fichin [mailto:[EMAIL PROTECTED]]
 Sent: Donnerstag, 16. Jänner 2003 13:33
 To: Tomcat Users List
 Subject: Re: javax.naming.NameNotFoundException: Name java: is not bound
 in this Context
 
 Roberts, Eric wrote:
 
Sorry - missed it earlier - in the Realm definition, I think it should be just 
resourceName=jdbc/esljsp - not dataSourceName=jdbc/esljsp
 
 That's odd. There is no resourceName attribute in DataSourceRealm 
 documentation. I looked at the source of it and saw 
 (set|get)DataSourceName only.
 And I see that tomcat docs is wrong in DataSourceRealm description, 
 because attribute list there is not reflect real things in code.
 Now I'm trying to look into the sources, but I'm not so hacky...

--= [ cut ] =--


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]


--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]