RE: JNDI question

2004-05-27 Thread Mike Curwen
closing a connection that you obtained through a pooled DataSource will
merely return it to the pool, and not actually close it.


> -Original Message-
> From: Randy [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, May 27, 2004 3:55 PM
> To: 'Tomcat Users List'
> Subject: RE:JNDI question
> 
> 
> Hello,
> 
> I have an easy question about using JNDI in tomcat 5
> 
> I am using the example @ 
> http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources
> -howto.html
> 
> Below is my server.xml entry
> 
> Here is what I do not quite understand.
> 
> In this little bit of code do I have to do anything to use the pooling
> 
> When I do a conn.close, does that actually close the db 
> connection, or does it just release it to the pool
> 
> Thanks
> 
> Sorry if this is an obvious question
> 
> Randy
> 
> 
> Context initCtx = new InitialContext();
> DataSource ds = 
> (DataSource)envCtx.lookup("java:comp/env/jdbc/UnitNet");
> 
> Connection conn = ds.getConnection();
> ... use this connection to access the database ... conn.close();
> 


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



RE: JNDI Question

2004-06-21 Thread Benson Margulies
Have a look at http://issues.apache.org/bugzilla/show_bug.cgi?id=29584.

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



RE: JNDI question

2004-08-09 Thread Shapira, Yoav

Hi,
Yes, there are ways.  Two general approaches:
- Using JMX (not very convenient at the moment, but doable if you're
willing to write some code)
- By casting the DataSource you get from the JNDI lookup to the
implementation type, e.g. org.apache.commons.dbcp.BasicDataSource or
whatever, and then calling the specific methods provides by the
implementation class.  You'll find that DBCP and other connection
pooling providers give you all these methods you're asking for.

Yoav Shapira
Millennium Research Informatics


>-Original Message-
>From: Randy Paries [mailto:[EMAIL PROTECTED]
>Sent: Monday, August 09, 2004 2:37 PM
>To: 'Tomcat Users List'
>Subject: JNDI question
>
>Hello
>
>I am using Tomcat 5 with JNDI(mysql)
>
>Are there ways to get usages info from the POOL
>
>Like active connections, max connections (basically the state of the DB
>Pool)
>
>Thanks for any help
>
>
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



Re: jndi question

2005-08-22 Thread Dirk Weigenand
Hi Sean,

> --- Ursprüngliche Nachricht ---
> Von: Sean Rowe <[EMAIL PROTECTED]>
> An: tomcat-user@jakarta.apache.org
> Betreff: jndi question
> Datum: Mon, 22 Aug 2005 01:26:49 -0500
> 
> I have tried for several hours now to get connection pooling for my 
> MySql database to work, but have been unable to do so.  I keep getting 
> this error:
> 
> javax.naming.NoInitialContextException: Cannot instantiate class:
> org.apache.commons.dbcp.BasicDataSourceFactory
> 
> 
 
> It's bombing out on this code:
> 
> Properties p=new Properties();
>  
>
p.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.commons.dbcp.BasicDataSourceFactory");
>  p.put(Context.PROVIDER_URL,"jdbc:mysql://localhost:3306");
>  Context initCtx = new InitialContext(p); // here's where it dies
> 

You're mixing up some concepts here. Context.INITIAL_CONTEXT_FACTORY is
meant to provide the name of a factory producing JNDI contexts, not a
factory for producing JDBC DataSources. The same goes for the next line of
code. Context.PROVIDER_URL is not used for providing information about a
database connection.

There is extensive documentation on the tomcat web site regarding JNDI
ressource configuration. Have a look at the following URL:

http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html

> Can someone please help me, or at least point me in the direction of 
> some documentation that I've missed?  I've searched google and every 
> other search engine I can think of.  Thanks in advance.
> 
> Sean Rowe
> 

Regards
Dirk

-- 
GMX DSL = Maximale Leistung zum minimalen Preis!
2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl

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



Re: jndi question

2005-08-22 Thread Sean Rowe
Thanks for responding Dirk.  I've practically memorized the 
documentation on the link you sent:


// Obtain our environment naming context
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");

// Look up our data source
DataSource ds = (DataSource)
 envCtx.lookup("jdbc/EmployeeDB");

// Allocate and use a connection from the pool
Connection conn = ds.getConnection();
... use this connection to access the database ...
conn.close();

Whenever I try this, here's what I get (which led me to trying it the way I 
posted):

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

Any ideas?  Thanks again.
Sean



Dirk Weigenand wrote:


Hi Sean,

 


--- Ursprüngliche Nachricht ---
Von: Sean Rowe <[EMAIL PROTECTED]>
An: tomcat-user@jakarta.apache.org
Betreff: jndi question
Datum: Mon, 22 Aug 2005 01:26:49 -0500

I have tried for several hours now to get connection pooling for my 
MySql database to work, but have been unable to do so.  I keep getting 
this error:


javax.naming.NoInitialContextException: Cannot instantiate class:
org.apache.commons.dbcp.BasicDataSourceFactory


   



 


It's bombing out on this code:

   Properties p=new Properties();


   


p.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.commons.dbcp.BasicDataSourceFactory");
 


p.put(Context.PROVIDER_URL,"jdbc:mysql://localhost:3306");
Context initCtx = new InitialContext(p); // here's where it dies

   



You're mixing up some concepts here. Context.INITIAL_CONTEXT_FACTORY is
meant to provide the name of a factory producing JNDI contexts, not a
factory for producing JDBC DataSources. The same goes for the next line of
code. Context.PROVIDER_URL is not used for providing information about a
database connection.

There is extensive documentation on the tomcat web site regarding JNDI
ressource configuration. Have a look at the following URL:

http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html

 

Can someone please help me, or at least point me in the direction of 
some documentation that I've missed?  I've searched google and every 
other search engine I can think of.  Thanks in advance.


Sean Rowe

   



Regards
   Dirk

 



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



Re: jndi question

2005-08-22 Thread Dirk Weigenand
Sean,

> --- Ursprüngliche Nachricht ---
> Von: Sean Rowe <[EMAIL PROTECTED]>
> An: Tomcat Users List 
> Betreff: Re: jndi question
> Datum: Mon, 22 Aug 2005 09:24:10 -0500
> 
> Thanks for responding Dirk.  I've practically memorized the 
> documentation on the link you sent:
> 
> // Obtain our environment naming context
> Context initCtx = new InitialContext();
> Context envCtx = (Context) initCtx.lookup("java:comp/env");
> 
> // Look up our data source
> DataSource ds = (DataSource)
>   envCtx.lookup("jdbc/EmployeeDB");
> 
> // Allocate and use a connection from the pool
> Connection conn = ds.getConnection();
> ... use this connection to access the database ...
> conn.close();
> 
> Whenever I try this, here's what I get (which led me to trying it the way
> I posted):
> 
> javax.naming.NameNotFoundException: Name java:comp is not bound in this
> Context
> 

No. Did you look at
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html?

I recommend putting the context definition in its own content.xml. On
redeploying my application tomcat wouldn't find the driver class anymore.

Mind you not the class itself but the definition of what class to load.

This problem was solved by putting the context into context.xml.

regards
   Dirk

-- 
GMX DSL = Maximale Leistung zum minimalen Preis!
2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl

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



Re: jndi question

2005-08-22 Thread Sean Rowe

Hi Dirk,

Thanks again for responding.  I have tried putting this into it's own 
context file.  For my latest attempt, I have created the data source 
using the admin module, and it rewrote my server.xml file for me, so I'm 
assuming it's in there correctly.  No matter how I do it ( and i really 
have followed the directions in the link you gave me), I can't seem to 
get it to work.  I must be missing something, but I can't seem to find it.


Dirk Weigenand wrote:


Sean,

 


--- Ursprüngliche Nachricht ---
Von: Sean Rowe <[EMAIL PROTECTED]>
An: Tomcat Users List 
Betreff: Re: jndi question
Datum: Mon, 22 Aug 2005 09:24:10 -0500

Thanks for responding Dirk.  I've practically memorized the 
documentation on the link you sent:


// Obtain our environment naming context
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");

// Look up our data source
DataSource ds = (DataSource)
 envCtx.lookup("jdbc/EmployeeDB");

// Allocate and use a connection from the pool
Connection conn = ds.getConnection();
... use this connection to access the database ...
conn.close();

Whenever I try this, here's what I get (which led me to trying it the way
I posted):

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

   



No. Did you look at
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html?

I recommend putting the context definition in its own content.xml. On
redeploying my application tomcat wouldn't find the driver class anymore.

Mind you not the class itself but the definition of what class to load.

This problem was solved by putting the context into context.xml.

regards
  Dirk

 



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



Re: jndi question

2005-08-22 Thread Sean Rowe
Dirk, I'm sorry I didn't see the difference on the page you sent me to.  
However, if there is a way I can do this without having to use jstl, I 
would really like to know.  I was hoping to put the code in a class 
somewhere that my servlets could use.


thanks,
sean

Dirk Weigenand wrote:


Sean,

 


--- Ursprüngliche Nachricht ---
Von: Sean Rowe <[EMAIL PROTECTED]>
An: Tomcat Users List 
Betreff: Re: jndi question
Datum: Mon, 22 Aug 2005 09:24:10 -0500

Thanks for responding Dirk.  I've practically memorized the 
documentation on the link you sent:


// Obtain our environment naming context
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");

// Look up our data source
DataSource ds = (DataSource)
 envCtx.lookup("jdbc/EmployeeDB");

// Allocate and use a connection from the pool
Connection conn = ds.getConnection();
... use this connection to access the database ...
conn.close();

Whenever I try this, here's what I get (which led me to trying it the way
I posted):

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

   



No. Did you look at
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html?

I recommend putting the context definition in its own content.xml. On
redeploying my application tomcat wouldn't find the driver class anymore.

Mind you not the class itself but the definition of what class to load.

This problem was solved by putting the context into context.xml.

regards
  Dirk

 



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



Re: jndi question

2005-08-23 Thread Brian Cook


Yes you can use JNDI with out using JSTL.  But the only way to configure 
it is to define the JNDI resources in the web.xml and context.xml files. 
   Technically you should be able to use the globally defined JNDI 
resources in server.xml, and I have seen configuration set ups doing it 
when googling.  But could never get them to work.


This highlights another area of seemingly unneeded complication in 
Java/Unix development.  Using JNDI for data sources which was supposed 
to help you save time requires that you redundantly define the JNDI 
resource in at lest 2 if not 3 places.


The admin tool which was also supposed to help save time defines the 
JNDI resources in server.xml which does not really seem to be all that 
helpful.  I am sure there is likely a reason for this but I am ignorant 
of it.  The admin tool is also supposed to let you define JNDI resources 
 per context but it errors out when ever I have tried it.


My experience with the Tomcat Admin and Manager tools is that they are 
worthless.  Of the few steps they try to help with more often that not 
they just return errors when you need to use it.  I removed them both 
and have gone back to doing set ups manually and there has not been much 
of a time difference doing it this way.


Any way for JNDI to work you will have to add the definition for it in 
both web.xml and context.xml in the <Folder>>/conf/Catalina/localhost/ folder.  This seems counter productive 
since it makes your app less portable having the data base configuration 
details inside the context and by extent the WAR file but it is what you 
have to do to get it to work right now.


I feel your pain I know it is frustrating spending hours debugging just 
the DB connection but todate that is the reality of Java web app 
development.  It is why I fear we will all be .Net developers some day.



Example :
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html



Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)
  envCtx.lookup("jdbc/EmployeeDB");

Connection conn = ds.getConnection();
... use this connection to access the database ...
conn.close();










  
Resource reference to a factory for java.sql.Connection
instances that may be used for talking to a particular
database that is configured in the server.xml file.
  
  
jdbc/EmployeeDB
  
  
javax.sql.DataSource
  
  
Container
  











  










Sean Rowe wrote:
Dirk, I'm sorry I didn't see the difference on the page you sent me to.  
However, if there is a way I can do this without having to use jstl, I 
would really like to know.  I was hoping to put the code in a class 
somewhere that my servlets could use.


thanks,
sean

Dirk Weigenand wrote:


Sean,

 


--- Ursprüngliche Nachricht ---
Von: Sean Rowe <[EMAIL PROTECTED]>
An: Tomcat Users List 
Betreff: Re: jndi question
Datum: Mon, 22 Aug 2005 09:24:10 -0500

Thanks for responding Dirk.  I've practically memorized the 
documentation on the link you sent:


// Obtain our environment naming context
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");

// Look up our data source
DataSource ds = (DataSource)
 envCtx.lookup("jdbc/EmployeeDB");

// Allocate and use a connection from the pool
Connection conn = ds.getConnection();
... use this connection to access the database ...
conn.close();

Whenever I try this, here's what I get (which led me to trying it the 
way

I posted):

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

  



No. Did you look at
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html? 



I recommend putting the context definition in its own content.xml. On
redeploying my application tomcat wouldn't find the driver class anymore.

Mind you not the class itself but the definition of what class to load.

This problem was solved by putting the context into context.xml.

regards
  Dirk

 



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





--
Brian Cook
Digital Services Analyst
Print Time Inc.
[EMAIL PROTECTED]
913.345.8900

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

Re: jndi question

2005-08-23 Thread Sean Rowe
Brian, thank you for replying.  I was afraid my topic was dead.  If you 
could look at my first post, I listed all the files that you have 
suggested I take a look at.  I have done everything you have suggested, 
but am still getting errors.  The error I am getting now is


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


I can't find anything on the net or in any books I've looked at that 
explains this.  As far as I can tell, java:comp should just be there.  
Any ideas?  Thanks again.


Sean

Brian Cook wrote:



Yes you can use JNDI with out using JSTL.  But the only way to 
configure it is to define the JNDI resources in the web.xml and 
context.xml files.Technically you should be able to use the 
globally defined JNDI resources in server.xml, and I have seen 
configuration set ups doing it when googling.  But could never get 
them to work.


This highlights another area of seemingly unneeded complication in 
Java/Unix development.  Using JNDI for data sources which was supposed 
to help you save time requires that you redundantly define the JNDI 
resource in at lest 2 if not 3 places.


The admin tool which was also supposed to help save time defines the 
JNDI resources in server.xml which does not really seem to be all that 
helpful.  I am sure there is likely a reason for this but I am 
ignorant of it.  The admin tool is also supposed to let you define 
JNDI resources  per context but it errors out when ever I have tried it.


My experience with the Tomcat Admin and Manager tools is that they are 
worthless.  Of the few steps they try to help with more often that not 
they just return errors when you need to use it.  I removed them both 
and have gone back to doing set ups manually and there has not been 
much of a time difference doing it this way.


Any way for JNDI to work you will have to add the definition for it in 
both web.xml and context.xml in the <Folder>>/conf/Catalina/localhost/ folder.  This seems counter 
productive since it makes your app less portable having the data base 
configuration details inside the context and by extent the WAR file 
but it is what you have to do to get it to work right now.


I feel your pain I know it is frustrating spending hours debugging 
just the DB connection but todate that is the reality of Java web app 
development.  It is why I fear we will all be .Net developers some day.



Example :
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html



Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)
  envCtx.lookup("jdbc/EmployeeDB");

Connection conn = ds.getConnection();
... use this connection to access the database ...
conn.close();










  
Resource reference to a factory for java.sql.Connection
instances that may be used for talking to a particular
database that is configured in the server.xml file.
  
  
jdbc/EmployeeDB
  
  
javax.sql.DataSource
  
  
Container
  











  driverClassName="org.hsql.jdbcDriver"
url="jdbc:HypersonicSQL:database"

maxActive="8"
maxIdle="4"/>










Sean Rowe wrote:

Dirk, I'm sorry I didn't see the difference on the page you sent me 
to.  However, if there is a way I can do this without having to use 
jstl, I would really like to know.  I was hoping to put the code in a 
class somewhere that my servlets could use.


thanks,
sean

Dirk Weigenand wrote:


Sean,

 


--- Ursprüngliche Nachricht ---
Von: Sean Rowe <[EMAIL PROTECTED]>
An: Tomcat Users List 
Betreff: Re: jndi question
Datum: Mon, 22 Aug 2005 09:24:10 -0500

Thanks for responding Dirk.  I've practically memorized the 
documentation on the link you sent:


// Obtain our environment naming context
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");

// Look up our data source
DataSource ds = (DataSource)
 envCtx.lookup("jdbc/EmployeeDB");

// Allocate and use a connection from the pool
Connection conn = ds.getConnection();
... use this connection to access the database ...
conn.close();

Whenever I try this, here's what I get (which led me to trying it 
the way

I posted):

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

Context

  




No. Did you look at
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html? 



I recommend putting the context definition in its own content.xml. On
redeploying my application tomcat wouldn't find the driver class 
anymore.


Mind you not the class itself but the definition of what class to load.

This problem was solved by putting the context into context.xml.

regards
  Dirk

 




RE: jndi question

2005-08-23 Thread Allistair Crossley
Hi,

The documentation says;

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)
  envCtx.lookup("jdbc/EmployeeDB");

However, we use;

try {
  Context ctx = new InitialContext();
  dataSource = (DataSource) ctx.lookup("java:comp/env/jdbc/yourdb");
} catch (NamingException nE) {
  // log somewhere
} catch (NullPointerException npE) {
  // log somewhere
}

Does that work for you? Allistair

> -Original Message-
> From: Sean Rowe [mailto:[EMAIL PROTECTED]
> Sent: 23 August 2005 16:29
> To: Tomcat Users List
> Subject: Re: jndi question
> 
> 
> Brian, thank you for replying.  I was afraid my topic was 
> dead.  If you 
> could look at my first post, I listed all the files that you have 
> suggested I take a look at.  I have done everything you have 
> suggested, 
> but am still getting errors.  The error I am getting now is
> 
> javax.naming.NameNotFoundException: Name java:comp is not 
> bound in this 
> Context
> 
> I can't find anything on the net or in any books I've looked at that 
> explains this.  As far as I can tell, java:comp should just 
> be there.  
> Any ideas?  Thanks again.
> 
> Sean
> 
> Brian Cook wrote:
> 
> >
> > Yes you can use JNDI with out using JSTL.  But the only way to 
> > configure it is to define the JNDI resources in the web.xml and 
> > context.xml files.Technically you should be able to use the 
> > globally defined JNDI resources in server.xml, and I have seen 
> > configuration set ups doing it when googling.  But could never get 
> > them to work.
> >
> > This highlights another area of seemingly unneeded complication in 
> > Java/Unix development.  Using JNDI for data sources which 
> was supposed 
> > to help you save time requires that you redundantly define the JNDI 
> > resource in at lest 2 if not 3 places.
> >
> > The admin tool which was also supposed to help save time 
> defines the 
> > JNDI resources in server.xml which does not really seem to 
> be all that 
> > helpful.  I am sure there is likely a reason for this but I am 
> > ignorant of it.  The admin tool is also supposed to let you define 
> > JNDI resources  per context but it errors out when ever I 
> have tried it.
> >
> > My experience with the Tomcat Admin and Manager tools is 
> that they are 
> > worthless.  Of the few steps they try to help with more 
> often that not 
> > they just return errors when you need to use it.  I removed 
> them both 
> > and have gone back to doing set ups manually and there has not been 
> > much of a time difference doing it this way.
> >
> > Any way for JNDI to work you will have to add the 
> definition for it in 
> > both web.xml and context.xml in the < > Folder>>/conf/Catalina/localhost/ folder.  This seems counter 
> > productive since it makes your app less portable having the 
> data base 
> > configuration details inside the context and by extent the WAR file 
> > but it is what you have to do to get it to work right now.
> >
> > I feel your pain I know it is frustrating spending hours debugging 
> > just the DB connection but todate that is the reality of 
> Java web app 
> > development.  It is why I fear we will all be .Net 
> developers some day.
> >
> >
> > Example :
> > 
> http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources
> -howto.html
> >
> > 
> >
> > Context initCtx = new InitialContext();
> > Context envCtx = (Context) initCtx.lookup("java:comp/env");
> > DataSource ds = (DataSource)
> >   envCtx.lookup("jdbc/EmployeeDB");
> >
> > Connection conn = ds.getConnection();
> > ... use this connection to access the database ...
> > conn.close();
> >
> > 
> >
> >
> >
> >
> >
> > 
> >
> > 
> >   
> > Resource reference to a factory for java.sql.Connection
> > instances that may be used for talking to a particular
> > database that is configured in the server.xml file.
> >   
> >   
> > jdbc/EmployeeDB
> >   
> >   
> > javax.sql.DataSource
> >   
> >   
> > Container
> >   
> > 
> >
> > 
> >
> >
> >
> >
> > 
> >
> > 
> >
> >> auth="Container"
> > type="javax.sql.DataSource"
> > username="dbusername"
> > password="dbpassword"
> >

Re: jndi question

2005-08-23 Thread Sean Rowe

no, that didn't help.  thanks though.

could this maybe be a class problem?  am i using the wrong jar files?  i 
can list the files i'm using if anyone thinks it might be the problem


Allistair Crossley wrote:


Hi,

The documentation says;

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)
 envCtx.lookup("jdbc/EmployeeDB");

However, we use;

try {
 Context ctx = new InitialContext();
 dataSource = (DataSource) ctx.lookup("java:comp/env/jdbc/yourdb");
} catch (NamingException nE) {
 // log somewhere
} catch (NullPointerException npE) {
 // log somewhere
}

Does that work for you? Allistair

 


-Original Message-
From: Sean Rowe [mailto:[EMAIL PROTECTED]
Sent: 23 August 2005 16:29
To: Tomcat Users List
Subject: Re: jndi question


Brian, thank you for replying.  I was afraid my topic was 
dead.  If you 
could look at my first post, I listed all the files that you have 
suggested I take a look at.  I have done everything you have 
suggested, 
but am still getting errors.  The error I am getting now is


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


I can't find anything on the net or in any books I've looked at that 
explains this.  As far as I can tell, java:comp should just 
be there.  
Any ideas?  Thanks again.


Sean

Brian Cook wrote:

   

Yes you can use JNDI with out using JSTL.  But the only way to 
configure it is to define the JNDI resources in the web.xml and 
context.xml files.Technically you should be able to use the 
globally defined JNDI resources in server.xml, and I have seen 
configuration set ups doing it when googling.  But could never get 
them to work.


This highlights another area of seemingly unneeded complication in 
Java/Unix development.  Using JNDI for data sources which 
 

was supposed 
   

to help you save time requires that you redundantly define the JNDI 
resource in at lest 2 if not 3 places.


The admin tool which was also supposed to help save time 
 

defines the 
   

JNDI resources in server.xml which does not really seem to 
 

be all that 
   

helpful.  I am sure there is likely a reason for this but I am 
ignorant of it.  The admin tool is also supposed to let you define 
JNDI resources  per context but it errors out when ever I 
 


have tried it.
   

My experience with the Tomcat Admin and Manager tools is 
 

that they are 
   

worthless.  Of the few steps they try to help with more 
 

often that not 
   

they just return errors when you need to use it.  I removed 
 

them both 
   

and have gone back to doing set ups manually and there has not been 
much of a time difference doing it this way.


Any way for JNDI to work you will have to add the 
 

definition for it in 
   

both web.xml and context.xml in the <Folder>>/conf/Catalina/localhost/ folder.  This seems counter 
productive since it makes your app less portable having the 
 

data base 
   

configuration details inside the context and by extent the WAR file 
but it is what you have to do to get it to work right now.


I feel your pain I know it is frustrating spending hours debugging 
just the DB connection but todate that is the reality of 
 

Java web app 
   

development.  It is why I fear we will all be .Net 
 


developers some day.
   


Example :

 


http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources
-howto.html
   




Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)
 envCtx.lookup("jdbc/EmployeeDB");

Connection conn = ds.getConnection();
... use this connection to access the database ...
conn.close();










 
   Resource reference to a factory for java.sql.Connection
   instances that may be used for talking to a particular
   database that is configured in the server.xml file.
 
 
   jdbc/EmployeeDB
 
 
   javax.sql.DataSource
 
 
   Container
 











driverClassName="org.hsql.jdbcDriver"
   url="jdbc:HypersonicSQL:database"

   maxActive="8"
   maxIdle="4"/>










Sean Rowe wrote:

 

Dirk, I'm sorry I didn't see the difference on the page 
   

you sent me 
   

to.  However, if there is a way I can do this without 
   

having to use 
   

jstl, I would really like to know.  I was hoping to put 
   

the code in a 
   


class somewhere that my servlets could use.

thanks,
sean

Dirk Weigenand wrote:

   


Sean,



 


--- Ursprüngliche Nachricht ---
Von: Sean Rowe <[EMAIL PROTECTED]>
An: Tomcat Users List 
Betreff: Re: jndi question
Datum: Mon, 22 Aug 2005 09:24:10 -0500

Thanks for responding Dirk.  I've practically memorized the 
documentation on the link you sent:


// Obtain our environment

RE: jndi question

2005-08-23 Thread Allistair Crossley
If you could please send

1. server.xml
2. web.xml
3. context.xml or yourwebapp.xml
4. list of files in common/lib
5. list of files in yourwebapp/WEB-INF/lib

I'd be happy to see if I can spot anything.

> -Original Message-
> From: Sean Rowe [mailto:[EMAIL PROTECTED]
> Sent: 23 August 2005 16:41
> To: Tomcat Users List
> Subject: Re: jndi question
> 
> 
> no, that didn't help.  thanks though.
> 
> could this maybe be a class problem?  am i using the wrong 
> jar files?  i 
> can list the files i'm using if anyone thinks it might be the problem
> 
> Allistair Crossley wrote:
> 
> >Hi,
> >
> >The documentation says;
> >
> >Context initCtx = new InitialContext();
> >Context envCtx = (Context) initCtx.lookup("java:comp/env");
> >DataSource ds = (DataSource)
> >  envCtx.lookup("jdbc/EmployeeDB");
> >
> >However, we use;
> >
> >try {
> >  Context ctx = new InitialContext();
> >  dataSource = (DataSource) ctx.lookup("java:comp/env/jdbc/yourdb");
> >} catch (NamingException nE) {
> >  // log somewhere
> >} catch (NullPointerException npE) {
> >  // log somewhere
> >}
> >
> >Does that work for you? Allistair
> >
> >  
> >
> >>-Original Message-
> >>From: Sean Rowe [mailto:[EMAIL PROTECTED]
> >>Sent: 23 August 2005 16:29
> >>To: Tomcat Users List
> >>Subject: Re: jndi question
> >>
> >>
> >>Brian, thank you for replying.  I was afraid my topic was 
> >>dead.  If you 
> >>could look at my first post, I listed all the files that you have 
> >>suggested I take a look at.  I have done everything you have 
> >>suggested, 
> >>but am still getting errors.  The error I am getting now is
> >>
> >>javax.naming.NameNotFoundException: Name java:comp is not 
> >>bound in this 
> >>Context
> >>
> >>I can't find anything on the net or in any books I've 
> looked at that 
> >>explains this.  As far as I can tell, java:comp should just 
> >>be there.  
> >>Any ideas?  Thanks again.
> >>
> >>Sean
> >>
> >>Brian Cook wrote:
> >>
> >>
> >>
> >>>Yes you can use JNDI with out using JSTL.  But the only way to 
> >>>configure it is to define the JNDI resources in the web.xml and 
> >>>context.xml files.Technically you should be able to use the 
> >>>globally defined JNDI resources in server.xml, and I have seen 
> >>>configuration set ups doing it when googling.  But could never get 
> >>>them to work.
> >>>
> >>>This highlights another area of seemingly unneeded complication in 
> >>>Java/Unix development.  Using JNDI for data sources which 
> >>>  
> >>>
> >>was supposed 
> >>
> >>
> >>>to help you save time requires that you redundantly define 
> the JNDI 
> >>>resource in at lest 2 if not 3 places.
> >>>
> >>>The admin tool which was also supposed to help save time 
> >>>  
> >>>
> >>defines the 
> >>
> >>
> >>>JNDI resources in server.xml which does not really seem to 
> >>>  
> >>>
> >>be all that 
> >>
> >>
> >>>helpful.  I am sure there is likely a reason for this but I am 
> >>>ignorant of it.  The admin tool is also supposed to let you define 
> >>>JNDI resources  per context but it errors out when ever I 
> >>>  
> >>>
> >>have tried it.
> >>
> >>
> >>>My experience with the Tomcat Admin and Manager tools is 
> >>>  
> >>>
> >>that they are 
> >>
> >>
> >>>worthless.  Of the few steps they try to help with more 
> >>>  
> >>>
> >>often that not 
> >>
> >>
> >>>they just return errors when you need to use it.  I removed 
> >>>  
> >>>
> >>them both 
> >>
> >>
> >>>and have gone back to doing set ups manually and there has 
> not been 
> >>>much of a time difference doing it this way.
> >>>
> >>>Any way for JNDI to work you will have to add the 
> >>>  
> >>>
> >>definition for it in 
> >>
> >>
> >>>both web.xml and context.xml in

Re: jndi question

2005-08-23 Thread Sean Rowe

thank you, i will

Allistair Crossley wrote:


If you could please send

1. server.xml
2. web.xml
3. context.xml or yourwebapp.xml
4. list of files in common/lib
5. list of files in yourwebapp/WEB-INF/lib

I'd be happy to see if I can spot anything.

 


-Original Message-
From: Sean Rowe [mailto:[EMAIL PROTECTED]
Sent: 23 August 2005 16:41
To: Tomcat Users List
Subject: Re: jndi question


no, that didn't help.  thanks though.

could this maybe be a class problem?  am i using the wrong 
jar files?  i 
can list the files i'm using if anyone thinks it might be the problem


Allistair Crossley wrote:

   


Hi,

The documentation says;

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)
envCtx.lookup("jdbc/EmployeeDB");

However, we use;

try {
Context ctx = new InitialContext();
dataSource = (DataSource) ctx.lookup("java:comp/env/jdbc/yourdb");
} catch (NamingException nE) {
// log somewhere
} catch (NullPointerException npE) {
// log somewhere
}

Does that work for you? Allistair



 


-Original Message-
From: Sean Rowe [mailto:[EMAIL PROTECTED]
Sent: 23 August 2005 16:29
To: Tomcat Users List
Subject: Re: jndi question


Brian, thank you for replying.  I was afraid my topic was 
dead.  If you 
could look at my first post, I listed all the files that you have 
suggested I take a look at.  I have done everything you have 
suggested, 
but am still getting errors.  The error I am getting now is


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


I can't find anything on the net or in any books I've 
   

looked at that 
   

explains this.  As far as I can tell, java:comp should just 
be there.  
Any ideas?  Thanks again.


Sean

Brian Cook wrote:

  

   

Yes you can use JNDI with out using JSTL.  But the only way to 
configure it is to define the JNDI resources in the web.xml and 
context.xml files.Technically you should be able to use the 
globally defined JNDI resources in server.xml, and I have seen 
configuration set ups doing it when googling.  But could never get 
them to work.


This highlights another area of seemingly unneeded complication in 
Java/Unix development.  Using JNDI for data sources which 


 

was supposed 
  

   

to help you save time requires that you redundantly define 
 

the JNDI 
   


resource in at lest 2 if not 3 places.

The admin tool which was also supposed to help save time 


 

defines the 
  

   

JNDI resources in server.xml which does not really seem to 


 

be all that 
  

   

helpful.  I am sure there is likely a reason for this but I am 
ignorant of it.  The admin tool is also supposed to let you define 
JNDI resources  per context but it errors out when ever I 


 


have tried it.
  

   

My experience with the Tomcat Admin and Manager tools is 


 

that they are 
  

   

worthless.  Of the few steps they try to help with more 


 

often that not 
  

   

they just return errors when you need to use it.  I removed 


 

them both 
  

   

and have gone back to doing set ups manually and there has 
 

not been 
   


much of a time difference doing it this way.

Any way for JNDI to work you will have to add the 


 

definition for it in 
  

   

both web.xml and context.xml in the <Folder>>/conf/Catalina/localhost/ folder.  This seems counter 
productive since it makes your app less portable having the 


 

data base 
  

   

configuration details inside the context and by extent the 
 

WAR file 
   


but it is what you have to do to get it to work right now.

I feel your pain I know it is frustrating spending hours debugging 
just the DB connection but todate that is the reality of 


 

Java web app 
  

   

development.  It is why I fear we will all be .Net 


 


developers some day.
  

   


Example :



 


http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources
-howto.html
  

   




Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)
envCtx.lookup("jdbc/EmployeeDB");

Connection conn = ds.getConnection();
... use this connection to access the database ...
conn.close();











  Resource reference to a factory for java.sql.Connection
  instances that may be used for talking to a particular
  database that is configured in the server.xml file.


  jdbc/EmployeeDB


  javax.sql.DataSource


  Container












  driverClassName="org.hsql.jdbcDriver"
  url="jdbc:HypersonicSQL:database"

  maxActive="8"
  maxIdle="4"/>








Re: jndi question

2005-08-23 Thread Brian Cook


Actually the files I listed are NOT in the first post.  It shows the 
server.xml and the code calling it but does not show web.xml or context.xml.


The error you are getting just means that that the JNDI resource being 
called in the code is not defined in both web.xml and context.xml.


In looking at the code snip it in the first post I am not following what 
you are trying to do.  The post is for a JNDI question but in the code 
it looks like you are calling the DB URL directly.  The whole point of 
JDNI being to get specific URL, and configuration info outside of the 
code base.  I am not following what it is you are trying to do here.




Sean Rowe wrote:
Brian, thank you for replying.  I was afraid my topic was dead.  If you 
could look at my first post, I listed all the files that you have 
suggested I take a look at.  I have done everything you have suggested, 
but am still getting errors.  The error I am getting now is


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


I can't find anything on the net or in any books I've looked at that 
explains this.  As far as I can tell, java:comp should just be there.  
Any ideas?  Thanks again.


Sean

Brian Cook wrote:



Yes you can use JNDI with out using JSTL.  But the only way to 
configure it is to define the JNDI resources in the web.xml and 
context.xml files.Technically you should be able to use the 
globally defined JNDI resources in server.xml, and I have seen 
configuration set ups doing it when googling.  But could never get 
them to work.


This highlights another area of seemingly unneeded complication in 
Java/Unix development.  Using JNDI for data sources which was supposed 
to help you save time requires that you redundantly define the JNDI 
resource in at lest 2 if not 3 places.


The admin tool which was also supposed to help save time defines the 
JNDI resources in server.xml which does not really seem to be all that 
helpful.  I am sure there is likely a reason for this but I am 
ignorant of it.  The admin tool is also supposed to let you define 
JNDI resources  per context but it errors out when ever I have tried it.


My experience with the Tomcat Admin and Manager tools is that they are 
worthless.  Of the few steps they try to help with more often that not 
they just return errors when you need to use it.  I removed them both 
and have gone back to doing set ups manually and there has not been 
much of a time difference doing it this way.


Any way for JNDI to work you will have to add the definition for it in 
both web.xml and context.xml in the <Folder>>/conf/Catalina/localhost/ folder.  This seems counter 
productive since it makes your app less portable having the data base 
configuration details inside the context and by extent the WAR file 
but it is what you have to do to get it to work right now.


I feel your pain I know it is frustrating spending hours debugging 
just the DB connection but todate that is the reality of Java web app 
development.  It is why I fear we will all be .Net developers some day.



Example :
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html



Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)
  envCtx.lookup("jdbc/EmployeeDB");

Connection conn = ds.getConnection();
... use this connection to access the database ...
conn.close();










  
Resource reference to a factory for java.sql.Connection
instances that may be used for talking to a particular
database that is configured in the server.xml file.
  
  
jdbc/EmployeeDB
  
  
javax.sql.DataSource
  
  
Container
  











  driverClassName="org.hsql.jdbcDriver"
url="jdbc:HypersonicSQL:database"

maxActive="8"
maxIdle="4"/>










Sean Rowe wrote:

Dirk, I'm sorry I didn't see the difference on the page you sent me 
to.  However, if there is a way I can do this without having to use 
jstl, I would really like to know.  I was hoping to put the code in a 
class somewhere that my servlets could use.


thanks,
sean

Dirk Weigenand wrote:


Sean,

 


--- Ursprüngliche Nachricht ---
Von: Sean Rowe <[EMAIL PROTECTED]>
An: Tomcat Users List 
Betreff: Re: jndi question
Datum: Mon, 22 Aug 2005 09:24:10 -0500

Thanks for responding Dirk.  I've practically memorized the 
documentation on the link you sent:


// Obtain our environment naming context
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");

// Look up our data source
DataSource ds = (DataSource)
 envCtx.lookup("jdbc/EmployeeDB");

// Allocate and use a connection from the pool
Connection conn = ds.getConnection();
... use this connection to access the database ...
conn.close();

Whenever I try this, here'

RE: jndi question

2005-08-23 Thread Allistair Crossley
Hi Sean,

It looks from a quick glance that your JNDI configuration is done globally, 
rather than in the Context configuration, and you do not link to it using a 
ResourceLink.

Try adding 



Into the Context block, and remove the Resource block you have in there. The 
other thing to try would be to move the JNDI datasource Resource configuration 
block into the Context block.

See how you get on, Allistair.

> -Original Message-
> From: Sean Rowe [mailto:[EMAIL PROTECTED]
> Sent: 23 August 2005 16:45
> To: Tomcat Users List
> Subject: Re: jndi question
> 
> 
> thank you, i will
> 
> Allistair Crossley wrote:
> 
> >If you could please send
> >
> >1. server.xml
> >2. web.xml
> >3. context.xml or yourwebapp.xml
> >4. list of files in common/lib
> >5. list of files in yourwebapp/WEB-INF/lib
> >
> >I'd be happy to see if I can spot anything.
> >
> >  
> >
> >>-Original Message-----
> >>From: Sean Rowe [mailto:[EMAIL PROTECTED]
> >>Sent: 23 August 2005 16:41
> >>To: Tomcat Users List
> >>Subject: Re: jndi question
> >>
> >>
> >>no, that didn't help.  thanks though.
> >>
> >>could this maybe be a class problem?  am i using the wrong 
> >>jar files?  i 
> >>can list the files i'm using if anyone thinks it might be 
> the problem
> >>
> >>Allistair Crossley wrote:
> >>
> >>
> >>
> >>>Hi,
> >>>
> >>>The documentation says;
> >>>
> >>>Context initCtx = new InitialContext();
> >>>Context envCtx = (Context) initCtx.lookup("java:comp/env");
> >>>DataSource ds = (DataSource)
> >>> envCtx.lookup("jdbc/EmployeeDB");
> >>>
> >>>However, we use;
> >>>
> >>>try {
> >>> Context ctx = new InitialContext();
> >>> dataSource = (DataSource) ctx.lookup("java:comp/env/jdbc/yourdb");
> >>>} catch (NamingException nE) {
> >>> // log somewhere
> >>>} catch (NullPointerException npE) {
> >>> // log somewhere
> >>>}
> >>>
> >>>Does that work for you? Allistair
> >>>
> >>> 
> >>>
> >>>  
> >>>
> >>>>-Original Message-
> >>>>From: Sean Rowe [mailto:[EMAIL PROTECTED]
> >>>>Sent: 23 August 2005 16:29
> >>>>To: Tomcat Users List
> >>>>Subject: Re: jndi question
> >>>>
> >>>>
> >>>>Brian, thank you for replying.  I was afraid my topic was 
> >>>>dead.  If you 
> >>>>could look at my first post, I listed all the files that you have 
> >>>>suggested I take a look at.  I have done everything you have 
> >>>>suggested, 
> >>>>but am still getting errors.  The error I am getting now is
> >>>>
> >>>>javax.naming.NameNotFoundException: Name java:comp is not 
> >>>>bound in this 
> >>>>Context
> >>>>
> >>>>I can't find anything on the net or in any books I've 
> >>>>
> >>>>
> >>looked at that 
> >>
> >>
> >>>>explains this.  As far as I can tell, java:comp should just 
> >>>>be there.  
> >>>>Any ideas?  Thanks again.
> >>>>
> >>>>Sean
> >>>>
> >>>>Brian Cook wrote:
> >>>>
> >>>>   
> >>>>
> >>>>
> >>>>
> >>>>>Yes you can use JNDI with out using JSTL.  But the only way to 
> >>>>>configure it is to define the JNDI resources in the web.xml and 
> >>>>>context.xml files.Technically you should be able to use the 
> >>>>>globally defined JNDI resources in server.xml, and I have seen 
> >>>>>configuration set ups doing it when googling.  But could 
> never get 
> >>>>>them to work.
> >>>>>
> >>>>>This highlights another area of seemingly unneeded 
> complication in 
> >>>>>Java/Unix development.  Using JNDI for data sources which 
> >>>>> 
> >>>>>
> >>>>>  
> >>>>>
> >>>>was supposed 
> >>>>   
> >>>>
> >>>>
> >>>>
> >>>>>t

Re: jndi question

2005-08-23 Thread Sean Rowe
ode in 
a class somewhere that my servlets could use.


thanks,
sean

Dirk Weigenand wrote:


Sean,

 


--- Ursprüngliche Nachricht ---
Von: Sean Rowe <[EMAIL PROTECTED]>
An: Tomcat Users List 
Betreff: Re: jndi question
Datum: Mon, 22 Aug 2005 09:24:10 -0500

Thanks for responding Dirk.  I've practically memorized the 
documentation on the link you sent:


// Obtain our environment naming context
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");

// Look up our data source
DataSource ds = (DataSource)
 envCtx.lookup("jdbc/EmployeeDB");

// Allocate and use a connection from the pool
Connection conn = ds.getConnection();
... use this connection to access the database ...
conn.close();

Whenever I try this, here's what I get (which led me to trying it 
the way

I posted):

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

Context

  






No. Did you look at
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html? 



I recommend putting the context definition in its own content.xml. On
redeploying my application tomcat wouldn't find the driver class 
anymore.


Mind you not the class itself but the definition of what class to 
load.


This problem was solved by putting the context into context.xml.

regards
  Dirk

 



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





 



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



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







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



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



Re: jndi question

2005-08-23 Thread Sean Rowe

i will try that.  thanks allistair, i really do appreciate this

Allistair Crossley wrote:


Hi Sean,

It looks from a quick glance that your JNDI configuration is done globally, 
rather than in the Context configuration, and you do not link to it using a 
ResourceLink.

Try adding 




Into the Context block, and remove the Resource block you have in there. The 
other thing to try would be to move the JNDI datasource Resource configuration 
block into the Context block.

See how you get on, Allistair.

 


-Original Message-
From: Sean Rowe [mailto:[EMAIL PROTECTED]
Sent: 23 August 2005 16:45
To: Tomcat Users List
Subject: Re: jndi question


thank you, i will

Allistair Crossley wrote:

   


If you could please send

1. server.xml
2. web.xml
3. context.xml or yourwebapp.xml
4. list of files in common/lib
5. list of files in yourwebapp/WEB-INF/lib

I'd be happy to see if I can spot anything.



 


-Original Message-
From: Sean Rowe [mailto:[EMAIL PROTECTED]
Sent: 23 August 2005 16:41
To: Tomcat Users List
Subject: Re: jndi question


no, that didn't help.  thanks though.

could this maybe be a class problem?  am i using the wrong 
jar files?  i 
can list the files i'm using if anyone thinks it might be 
   


the problem
   


Allistair Crossley wrote:

  

   


Hi,

The documentation says;

Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");
DataSource ds = (DataSource)
envCtx.lookup("jdbc/EmployeeDB");

However, we use;

try {
Context ctx = new InitialContext();
dataSource = (DataSource) ctx.lookup("java:comp/env/jdbc/yourdb");
} catch (NamingException nE) {
// log somewhere
} catch (NullPointerException npE) {
// log somewhere
}

Does that work for you? Allistair





 


-Original Message-
From: Sean Rowe [mailto:[EMAIL PROTECTED]
Sent: 23 August 2005 16:29
To: Tomcat Users List
Subject: Re: jndi question


Brian, thank you for replying.  I was afraid my topic was 
dead.  If you 
could look at my first post, I listed all the files that you have 
suggested I take a look at.  I have done everything you have 
suggested, 
but am still getting errors.  The error I am getting now is


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


I can't find anything on the net or in any books I've 
  

   

looked at that 
  

   

explains this.  As far as I can tell, java:comp should just 
be there.  
Any ideas?  Thanks again.


Sean

Brian Cook wrote:

 

  

   

Yes you can use JNDI with out using JSTL.  But the only way to 
configure it is to define the JNDI resources in the web.xml and 
context.xml files.Technically you should be able to use the 
globally defined JNDI resources in server.xml, and I have seen 
configuration set ups doing it when googling.  But could 
 

never get 
   


them to work.

This highlights another area of seemingly unneeded 
 

complication in 
   

Java/Unix development.  Using JNDI for data sources which 
   



 

was supposed 
 

  

   

to help you save time requires that you redundantly define 


 

the JNDI 
  

   


resource in at lest 2 if not 3 places.

The admin tool which was also supposed to help save time 
   



 

defines the 
 

  

   

JNDI resources in server.xml which does not really seem to 
   



 

be all that 
 

  

   

helpful.  I am sure there is likely a reason for this but I am 
ignorant of it.  The admin tool is also supposed to let 
 

you define 
   

JNDI resources  per context but it errors out when ever I 
   



 


have tried it.
 

  

   

My experience with the Tomcat Admin and Manager tools is 
   



 

that they are 
 

  

   

worthless.  Of the few steps they try to help with more 
   



 

often that not 
 

  

   

they just return errors when you need to use it.  I removed 
   



 

them both 
 

  

   

and have gone back to doing set ups manually and there has 


 

not been 
  

   


much of a time difference doing it this way.

Any way for JNDI to work you will have to add the 
   



 

definition for it in 
 

  

   

both web.xml and context.xml in the <Folder>>/conf/Catalina/localhost/ folder.  This seems counter 
productive since it makes your app less portable having the 
   



 

data base 
 

  

   

configuration details inside the context and by extent the 


 

WAR file 
  

   


but it is what you have to do to get it to work right now.

I feel your pain I know it is frustrating spending 

Re: jndi question

2005-08-23 Thread Brian Cook
ess the database ...
conn.close();










  
Resource reference to a factory for java.sql.Connection
instances that may be used for talking to a particular
database that is configured in the server.xml file.
  
  
jdbc/EmployeeDB
  
  
javax.sql.DataSource
  
  
Container
  











  driverClassName="org.hsql.jdbcDriver"
url="jdbc:HypersonicSQL:database"

maxActive="8"
maxIdle="4"/>










Sean Rowe wrote:

Dirk, I'm sorry I didn't see the difference on the page you sent me 
to.  However, if there is a way I can do this without having to use 
jstl, I would really like to know.  I was hoping to put the code in 
a class somewhere that my servlets could use.


thanks,
sean

Dirk Weigenand wrote:


Sean,

 


--- Ursprüngliche Nachricht ---
Von: Sean Rowe <[EMAIL PROTECTED]>
An: Tomcat Users List 
Betreff: Re: jndi question
Datum: Mon, 22 Aug 2005 09:24:10 -0500

Thanks for responding Dirk.  I've practically memorized the 
documentation on the link you sent:


// Obtain our environment naming context
Context initCtx = new InitialContext();
Context envCtx = (Context) initCtx.lookup("java:comp/env");

// Look up our data source
DataSource ds = (DataSource)
 envCtx.lookup("jdbc/EmployeeDB");

// Allocate and use a connection from the pool
Connection conn = ds.getConnection();
... use this connection to access the database ...
conn.close();

Whenever I try this, here's what I get (which led me to trying it 
the way

I posted):

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

Context

  







No. Did you look at
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html? 



I recommend putting the context definition in its own content.xml. On
redeploying my application tomcat wouldn't find the driver class 
anymore.


Mind you not the class itself but the definition of what class to 
load.


This problem was solved by putting the context into context.xml.

regards
  Dirk

 



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





 



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



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







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



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





--
Brian Cook
Digital Services Analyst
Print Time Inc.
[EMAIL PROTECTED]
913.345.8900

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

RE: jndi question

2005-08-23 Thread Allistair Crossley
Hi,

He isn't using that method of configuration, that's just 1 option of 3. He is 
nesting his Context definition within the server.xml Host element. Although 
this is now scorned, it's still valid. The 2 other methods are contextname.xml 
as you say, and also META-INF/context.xml within the webapp itself. 
Allistair.

> -Original Message-
> From: Brian Cook [mailto:[EMAIL PROTECTED]
> Sent: 23 August 2005 17:23
> To: Tomcat Users List
> Subject: Re: jndi question
> 
> 
> 
> Ok but do you have the resource defined in context.xml?  If you go to 
> <>/conf/Cataliana/localhost/ do you see a file 
> with the name 
> of the module ending with .xml?  If so is the resource 
> defined in that 
> file?  If not you need to add it.
> 
>  From the description it sounds like nothing in this set up has been 
> done as was show on the example page.
> 
> http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources
> -howto.html
> 
> If you use the code block that is shown, define that resource 
> in web.xml 
> and context.xml it will work.  But multiple postings latter it still 
> sounds like the JNDI resource is not defined in context.xml 
> and the code 
> calling the JNDI resource differs greatly from the example provided.
> 
> 
> Sean Rowe wrote:
> > The first post on this included the server.xml, and further 
> down in the 
> > page is the relevant part of web.xml ( i just double 
> checked that ).  as 
> > for context.xml, i have listed it in my webapp.xml file, as well as 
> > server.xml as all other examples have suggested.  i then 
> tried it in the 
> > admin module, where it then put it in server.xml for me.  
> i'm willing to 
> > try anything at this point, though, if you have any suggestions.
> > 
> > as for my post not being jndi specific, i applogize if 
> that's the case.  
> > i'm not really familiar with jndibut when I did a search for 
> > 'connection pooling', jndi seemed to be what everyone 
> suggested i use.  
> > what i want to do, if it's not clear, is to create a 
> connection pool to 
> > my MySql database.
> > thanks,
> > sean
> > 
> > Brian Cook wrote:
> > 
> >>
> >> Actually the files I listed are NOT in the first post.  It 
> shows the 
> >> server.xml and the code calling it but does not show web.xml or 
> >> context.xml.
> >>
> >> The error you are getting just means that that the JNDI 
> resource being 
> >> called in the code is not defined in both web.xml and context.xml.
> >>
> >> In looking at the code snip it in the first post I am not 
> following 
> >> what you are trying to do.  The post is for a JNDI 
> question but in the 
> >> code it looks like you are calling the DB URL directly.  The whole 
> >> point of JDNI being to get specific URL, and configuration info 
> >> outside of the code base.  I am not following what it is you are 
> >> trying to do here.
> >>
> >>
> >>
> >> Sean Rowe wrote:
> >>
> >>> Brian, thank you for replying.  I was afraid my topic was 
> dead.  If 
> >>> you could look at my first post, I listed all the files 
> that you have 
> >>> suggested I take a look at.  I have done everything you have 
> >>> suggested, but am still getting errors.  The error I am 
> getting now is
> >>>
> >>> javax.naming.NameNotFoundException: Name java:comp is not 
> bound in 
> >>> this Context
> >>>
> >>> I can't find anything on the net or in any books I've 
> looked at that 
> >>> explains this.  As far as I can tell, java:comp should just be 
> >>> there.  Any ideas?  Thanks again.
> >>>
> >>> Sean
> >>>
> >>> Brian Cook wrote:
> >>>
> >>>>
> >>>> Yes you can use JNDI with out using JSTL.  But the only way to 
> >>>> configure it is to define the JNDI resources in the web.xml and 
> >>>> context.xml files.Technically you should be able to use the 
> >>>> globally defined JNDI resources in server.xml, and I have seen 
> >>>> configuration set ups doing it when googling.  But could 
> never get 
> >>>> them to work.
> >>>>
> >>>> This highlights another area of seemingly unneeded 
> complication in 
> >>>> Java/Unix development.  Using JNDI for data sources which was 
> >>>> supposed to help you save time requires that you 
> r

Re: jndi question

2005-08-23 Thread Sean Rowe
I will try all 3 once again, and provide screen shots of the errors I 
see.  I have tried these methods before, but I will try them again for a 
sanity check. 


sean

Allistair Crossley wrote:


Hi,

He isn't using that method of configuration, that's just 1 option of 3. He is nesting his Context definition within the server.xml Host element. Although this is now scorned, it's still valid. The 2 other methods are contextname.xml as you say, and also META-INF/context.xml within the webapp itself. 
Allistair.


 


-Original Message-
From: Brian Cook [mailto:[EMAIL PROTECTED]
Sent: 23 August 2005 17:23
To: Tomcat Users List
Subject: Re: jndi question



Ok but do you have the resource defined in context.xml?  If you go to 
<>/conf/Cataliana/localhost/ do you see a file 
with the name 
of the module ending with .xml?  If so is the resource 
defined in that 
file?  If not you need to add it.


From the description it sounds like nothing in this set up has been 
done as was show on the example page.


http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources
-howto.html

If you use the code block that is shown, define that resource 
in web.xml 
and context.xml it will work.  But multiple postings latter it still 
sounds like the JNDI resource is not defined in context.xml 
and the code 
calling the JNDI resource differs greatly from the example provided.



Sean Rowe wrote:
   

The first post on this included the server.xml, and further 
 

down in the 
   

page is the relevant part of web.xml ( i just double 
 

checked that ).  as 
   

for context.xml, i have listed it in my webapp.xml file, as well as 
server.xml as all other examples have suggested.  i then 
 

tried it in the 
   

admin module, where it then put it in server.xml for me.  
 

i'm willing to 
   


try anything at this point, though, if you have any suggestions.

as for my post not being jndi specific, i applogize if 
 

that's the case.  
   

i'm not really familiar with jndibut when I did a search for 
'connection pooling', jndi seemed to be what everyone 
 

suggested i use.  
   

what i want to do, if it's not clear, is to create a 
 

connection pool to 
   


my MySql database.
thanks,
sean

Brian Cook wrote:

 

Actually the files I listed are NOT in the first post.  It 
   

shows the 
   

server.xml and the code calling it but does not show web.xml or 
context.xml.


The error you are getting just means that that the JNDI 
   

resource being 
   


called in the code is not defined in both web.xml and context.xml.

In looking at the code snip it in the first post I am not 
   

following 
   

what you are trying to do.  The post is for a JNDI 
   

question but in the 
   

code it looks like you are calling the DB URL directly.  The whole 
point of JDNI being to get specific URL, and configuration info 
outside of the code base.  I am not following what it is you are 
trying to do here.




Sean Rowe wrote:

   

Brian, thank you for replying.  I was afraid my topic was 
 

dead.  If 
   

you could look at my first post, I listed all the files 
 

that you have 
   

suggested I take a look at.  I have done everything you have 
suggested, but am still getting errors.  The error I am 
 


getting now is
   

javax.naming.NameNotFoundException: Name java:comp is not 
 

bound in 
   


this Context

I can't find anything on the net or in any books I've 
 

looked at that 
   

explains this.  As far as I can tell, java:comp should just be 
there.  Any ideas?  Thanks again.


Sean

Brian Cook wrote:

 

Yes you can use JNDI with out using JSTL.  But the only way to 
configure it is to define the JNDI resources in the web.xml and 
context.xml files.Technically you should be able to use the 
globally defined JNDI resources in server.xml, and I have seen 
configuration set ups doing it when googling.  But could 
   

never get 
   


them to work.

This highlights another area of seemingly unneeded 
   

complication in 
   

Java/Unix development.  Using JNDI for data sources which was 
supposed to help you save time requires that you 
   

redundantly define 
   


the JNDI resource in at lest 2 if not 3 places.

The admin tool which was also supposed to help save time 
   

defines the 
   

JNDI resources in server.xml which does not really seem 
   

to be all 
   

that helpful.  I am sure there is likely a reason for 
   

this but I am 
   

ignorant of it.  The admin tool is also supposed to let 
   

you define 
   

JNDI resources  per context but it errors out when ever 
   

I have tried 
   


it.

My experience with the Tomcat Admin and Manager tools is 
   

that they 
   

are worthless.  Of the few steps they try to help with 
   

more ofte

Re: jndi question

2005-08-23 Thread Brian Cook


Do not need the screen shots.  Just copy and paste the stack trace error 
of the exception(All the gobblay gook that shows up on screen or in 
catalina.out when an exception is thrown.), the details of which ever 
combination of config files you are using, the code actually calling the 
JNDI resource.


Just as a future reference including all of those things in your posts 
will help get a solution to your problem faster and will increase the 
number of people that will respond to your posts.


You may find these posting guild lines helpful too.

http://jakarta.apache.org/site/mail.html


Sean Rowe wrote:
I will try all 3 once again, and provide screen shots of the errors I 
see.  I have tried these methods before, but I will try them again for a 
sanity check.

sean

Allistair Crossley wrote:


Hi,

He isn't using that method of configuration, that's just 1 option of 
3. He is nesting his Context definition within the server.xml Host 
element. Although this is now scorned, it's still valid. The 2 other 
methods are contextname.xml as you say, and also META-INF/context.xml 
within the webapp itself. Allistair.


 


-Original Message-
From: Brian Cook [mailto:[EMAIL PROTECTED]
Sent: 23 August 2005 17:23
To: Tomcat Users List
Subject: Re: jndi question



Ok but do you have the resource defined in context.xml?  If you go to 
<>/conf/Cataliana/localhost/ do you see a file with the 
name of the module ending with .xml?  If so is the resource defined 
in that file?  If not you need to add it.


From the description it sounds like nothing in this set up has been 
done as was show on the example page.


http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources
-howto.html

If you use the code block that is shown, define that resource in 
web.xml and context.xml it will work.  But multiple postings latter 
it still sounds like the JNDI resource is not defined in context.xml 
and the code calling the JNDI resource differs greatly from the 
example provided.



Sean Rowe wrote:
  

The first post on this included the server.xml, and further 


down in the   

page is the relevant part of web.xml ( i just double 


checked that ).  as   

for context.xml, i have listed it in my webapp.xml file, as well as 
server.xml as all other examples have suggested.  i then 


tried it in the   

admin module, where it then put it in server.xml for me.  


i'm willing to   


try anything at this point, though, if you have any suggestions.

as for my post not being jndi specific, i applogize if 


that's the case.

i'm not really familiar with jndibut when I did a search for 
'connection pooling', jndi seemed to be what everyone 


suggested i use.

what i want to do, if it's not clear, is to create a 


connection pool to   


my MySql database.
thanks,
sean

Brian Cook wrote:



Actually the files I listed are NOT in the first post.  It   


shows the   

server.xml and the code calling it but does not show web.xml or 
context.xml.


The error you are getting just means that that the JNDI   


resource being   


called in the code is not defined in both web.xml and context.xml.

In looking at the code snip it in the first post I am not   


following   

what you are trying to do.  The post is for a JNDI   


question but in the   

code it looks like you are calling the DB URL directly.  The whole 
point of JDNI being to get specific URL, and configuration info 
outside of the code base.  I am not following what it is you are 
trying to do here.




Sean Rowe wrote:

  

Brian, thank you for replying.  I was afraid my topic was 


dead.  If   

you could look at my first post, I listed all the files 


that you have   

suggested I take a look at.  I have done everything you have 
suggested, but am still getting errors.  The error I am 


getting now is
  

javax.naming.NameNotFoundException: Name java:comp is not 


bound in   


this Context

I can't find anything on the net or in any books I've 


looked at that   

explains this.  As far as I can tell, java:comp should just be 
there.  Any ideas?  Thanks again.


Sean

Brian Cook wrote:



Yes you can use JNDI with out using JSTL.  But the only way to 
configure it is to define the JNDI resources in the web.xml and 
context.xml files.Technically you should be able to use the 
globally defined JNDI resources in server.xml, and I have seen 
configuration set ups doing it when googling.  But could   


never get   


them to work.

This highlights another area of seemingly unneeded   


complication in   

Java/Unix development.  Using JNDI for data sources which was 
supposed to help you save time requires that you   


redundantly define   


the JNDI resource in at lest 2 if not 3 places.

The admin tool which was also supposed to help save time   

Re: jndi question

2005-08-24 Thread Sean Rowe
I have tried again using the method described in the url brian gave.  
Here is the stack exception I'm receiving:


*type* Exception report

*message*

*description* _The server encountered an internal error () that 
prevented it from fulfilling this request._


*exception*

javax.servlet.ServletException: Name java:comp is not bound in this Context

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)

org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:69)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

*root cause*

javax.naming.NameNotFoundException: Name java:comp is not bound in this Context
org.apache.naming.NamingContext.lookup(NamingContext.java:769)
org.apache.naming.NamingContext.lookup(NamingContext.java:152)
javax.naming.InitialContext.lookup(InitialContext.java:351)
com.transcriptionportal.utils.DBManager.init(DBManager.java:25)
org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:53)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


I have enclosed my server.xml, web.xml, context.xml (that i placed in my 
web/META-INF folder), and the class I'm using to make the connection.  
Thanks again to everyone who has helped me so far.


sean

Allistair Crossley wrote:


Hi,

He isn't using that method of configuration, that's just 1 option of 3. He is nesting his Context definition within the server.xml Host element. Although this is now scorned, it's still valid. The 2 other methods are contextname.xml as you say, and also META-INF/context.xml within the webapp itself. 
Allistair.


 


-Original Message-
From: Brian Cook [mailto:[EMAIL PROTECTED]
Sent: 23 August 2005 17:23
To: Tomcat Users List
Subject: Re: jndi question



Ok but do you have the resource defined in context.xml?  If you go to 
<>/conf/Cataliana/localhost/ do you see a file 
with the name 
of the module ending with .xml?  If so is the resource 
defined in that 
file?  If not you need to add it.


From the description it sounds like nothing in this set up has been 
done as was show on the example page.


http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources
-howto.html

If you use the code block that is shown, define that resource 
in web.xml 
and context.xml it will work.  But multiple postings latter it still 
sounds like the JNDI resource is not defined in context.xml 
and the code 
calling the JNDI resource differs greatly from the example provided.



Sean Rowe wrote:
   

The first post on this included the server.xml, and further 
 

down in the 
   

page is the relevant part of web.xml ( i just double 
 

checked that ).  as 
   

for context.xml, i have listed it in my webapp.xml file, as well as 
server.xml as all other examples have suggested.  i then 
 

tried it in the 
   

admin module, where it then put it in server.xml for me.  
 

i'm willing to 
   


try anything at this point, though, if you have any suggestions.

as for my post not being jndi specific, i applogize if 
 

that's the case.  
   

i'm not really familiar with jndibut when I did a search for 
'connection pooling', jndi seemed to be what everyone 
 

suggested i use.  
   

what i want to do, if it's not clear, is to create a 
 

connection pool to 
   


my MySql database.
thanks,
sean

Brian Cook wrote:

 

Actually the files I listed are NOT in the first post.  It 
   

shows the 
   

server.xml and the code calling it but does not show web.xml or 
context.xml.


The error you are getting just means that that the JNDI 
   

resource being 
   


called in the code is not defined in both web.xml and context.xml.

In looking at the code snip it in the first post I am not 
   

following 
   

what you are trying to do.  The post is for a JNDI 
   

question but in the 
   

code it looks like you are calling the DB URL directly.  The whole 
point of JDNI being to get specific URL, and configuration info 
outside of 

Re: jndi question

2005-08-25 Thread Brian Cook

Sean,

One thing that stands out in your message is that the conext.xml file 
was placed in the META-INF folder.  Is it also in <Folder>>/conf/Catalina/localhost/ as the module name?  i.e. If the 
context path name of your webapp is "/seansApp" the context.xml file 
should appear in this folder as seansApp.xml.



The context.xml file is stored in META-INF during development but needs 
to be placed in <>/conf/Catalina/localhost/ folder for 
deployment with the file name of the context path.





Sean Rowe wrote:
I have tried again using the method described in the url brian gave.  
Here is the stack exception I'm receiving:


*type* Exception report

*message*

*description* _The server encountered an internal error () that 
prevented it from fulfilling this request._


*exception*

javax.servlet.ServletException: Name java:comp is not bound in this Context
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848) 

org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781) 


org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:69)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) 

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) 


org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

*root cause*

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

org.apache.naming.NamingContext.lookup(NamingContext.java:769)
org.apache.naming.NamingContext.lookup(NamingContext.java:152)
javax.naming.InitialContext.lookup(InitialContext.java:351)
com.transcriptionportal.utils.DBManager.init(DBManager.java:25)
org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:53)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) 

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) 


org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


I have enclosed my server.xml, web.xml, context.xml (that i placed in my 
web/META-INF folder), and the class I'm using to make the connection.  
Thanks again to everyone who has helped me so far.


sean

Allistair Crossley wrote:


Hi,

He isn't using that method of configuration, that's just 1 option of 
3. He is nesting his Context definition within the server.xml Host 
element. Although this is now scorned, it's still valid. The 2 other 
methods are contextname.xml as you say, and also META-INF/context.xml 
within the webapp itself. Allistair.


 


-Original Message-
From: Brian Cook [mailto:[EMAIL PROTECTED]
Sent: 23 August 2005 17:23
To: Tomcat Users List
Subject: Re: jndi question



Ok but do you have the resource defined in context.xml?  If you go to 
<>/conf/Cataliana/localhost/ do you see a file with the 
name of the module ending with .xml?  If so is the resource defined 
in that file?  If not you need to add it.


From the description it sounds like nothing in this set up has been 
done as was show on the example page.


http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources
-howto.html

If you use the code block that is shown, define that resource in 
web.xml and context.xml it will work.  But multiple postings latter 
it still sounds like the JNDI resource is not defined in context.xml 
and the code calling the JNDI resource differs greatly from the 
example provided.



Sean Rowe wrote:
  

The first post on this included the server.xml, and further 


down in the   

page is the relevant part of web.xml ( i just double 


checked that ).  as   

for context.xml, i have listed it in my webapp.xml file, as well as 
server.xml as all other examples have suggested.  i then 


tried it in the   

admin module, where it then put it in server.xml for me.  


i'm willing to   


try anything at this point, though, if you have any suggestions.

as for my post not being jndi specific, i applogize if 


that's the case.

i'm not really familiar with jndibut when I did a search for 
'connection pooling', jndi seemed to be what everyone 


suggested i use.

what i want to do, if it's not clear, is to create a 


connection pool to   


my MySql database.
thanks,
sean

Brian Cook wrote:



Actually the files I listed are NOT in the first post.  It   


shows the   

server.xml and the code calling it but does not show web.xml or 
context.xml.


The error you are ge

RE: jndi question

2005-08-25 Thread Allistair Crossley
Hi,

> The context.xml file is stored in META-INF during development 
> but needs 
> to be placed in <>/conf/Catalina/localhost/ folder for 
> deployment with the file name of the context path.

I don't think that's quite true. META-INF is a permanent valid location for 
context.xml, and does not affect deployment if /conf/Catalina/localhost/ does 
not have a file for the web application. We always keep context.xml only in 
META-INF.

However, if 2 are present this may cause issues as you say,

Allistair.

> -Original Message-
> From: Brian Cook [mailto:[EMAIL PROTECTED]
> Sent: 25 August 2005 14:39
> To: Tomcat Users List
> Subject: Re: jndi question
> 
> 
> Sean,
> 
> One thing that stands out in your message is that the conext.xml file 
> was placed in the META-INF folder.  Is it also in < Folder>>/conf/Catalina/localhost/ as the module name?  i.e. If the 
> context path name of your webapp is "/seansApp" the context.xml file 
> should appear in this folder as seansApp.xml.
> 
> 
> The context.xml file is stored in META-INF during development 
> but needs 
> to be placed in <>/conf/Catalina/localhost/ folder for 
> deployment with the file name of the context path.
> 
> 
> 
> 
> Sean Rowe wrote:
> > I have tried again using the method described in the url 
> brian gave.  
> > Here is the stack exception I'm receiving:
> > 
> > *type* Exception report
> > 
> > *message*
> > 
> > *description* _The server encountered an internal error () that 
> > prevented it from fulfilling this request._
> > 
> > *exception*
> > 
> > javax.servlet.ServletException: Name java:comp is not bound 
> in this Context
> > 
> org.apache.jasper.runtime.PageContextImpl.doHandlePageExceptio
> n(PageContextImpl.java:848) 
> > 
> > 
> org.apache.jasper.runtime.PageContextImpl.handlePageException(
> PageContextImpl.java:781) 
> > 
> > org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:69)
> > 
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> > 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServlet
> Wrapper.java:322) 
> > 
> > 
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet
> .java:291) 
> > 
> > 
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> > 
> > *root cause*
> > 
> > javax.naming.NameNotFoundException: Name java:comp is not 
> bound in this 
> > Context
> > org.apache.naming.NamingContext.lookup(NamingContext.java:769)
> > org.apache.naming.NamingContext.lookup(NamingContext.java:152)
> > javax.naming.InitialContext.lookup(InitialContext.java:351)
> > com.transcriptionportal.utils.DBManager.init(DBManager.java:25)
> > org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:53)
> > 
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> > 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServlet
> Wrapper.java:322) 
> > 
> > 
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet
> .java:291) 
> > 
> > 
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
> > javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
> > 
> > 
> > I have enclosed my server.xml, web.xml, context.xml (that i 
> placed in my 
> > web/META-INF folder), and the class I'm using to make the 
> connection.  
> > Thanks again to everyone who has helped me so far.
> > 
> > sean
> > 
> > Allistair Crossley wrote:
> > 
> >> Hi,
> >>
> >> He isn't using that method of configuration, that's just 1 
> option of 
> >> 3. He is nesting his Context definition within the server.xml Host 
> >> element. Although this is now scorned, it's still valid. 
> The 2 other 
> >> methods are contextname.xml as you say, and also 
> META-INF/context.xml 
> >> within the webapp itself. Allistair.
> >>
> >>  
> >>
> >>> -Original Message-
> >>> From: Brian Cook [mailto:[EMAIL PROTECTED]
> >>> Sent: 23 August 2005 17:23
> >>> To: Tomcat Users List
> >>> Subject: Re: jndi question
> >>>
> >>>
> >>>
> >>> Ok but do you have the

Re: jndi question

2005-08-25 Thread haim

Hi

I had the same problem and I managed to make this work when following 
this post

http://forums.devshed.com/archive/t-120081

The only problem is that it works when a deploy a war file.
When I try using this out of Eclipse (I am running tomcat using sysdeo 
plug-in) it makes problems.


Let me know how do you use tomcat.

Regards
Haim




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



Re: jndi question

2005-08-25 Thread Sean Rowe

yes, there is a file in the /conf/Catalina/localhost directory for my app

Brian Cook wrote:


Sean,

One thing that stands out in your message is that the conext.xml file 
was placed in the META-INF folder.  Is it also in <Folder>>/conf/Catalina/localhost/ as the module name?  i.e. If the 
context path name of your webapp is "/seansApp" the context.xml file 
should appear in this folder as seansApp.xml.



The context.xml file is stored in META-INF during development but 
needs to be placed in <>/conf/Catalina/localhost/ 
folder for deployment with the file name of the context path.





Sean Rowe wrote:

I have tried again using the method described in the url brian gave.  
Here is the stack exception I'm receiving:


*type* Exception report

*message*

*description* _The server encountered an internal error () that 
prevented it from fulfilling this request._


*exception*

javax.servlet.ServletException: Name java:comp is not bound in this 
Context

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848) 


org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781) 


org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:69)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) 


org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

*root cause*

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

org.apache.naming.NamingContext.lookup(NamingContext.java:769)
org.apache.naming.NamingContext.lookup(NamingContext.java:152)
javax.naming.InitialContext.lookup(InitialContext.java:351)
com.transcriptionportal.utils.DBManager.init(DBManager.java:25)
org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:53)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) 


org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


I have enclosed my server.xml, web.xml, context.xml (that i placed in 
my web/META-INF folder), and the class I'm using to make the 
connection.  Thanks again to everyone who has helped me so far.


sean

Allistair Crossley wrote:


Hi,

He isn't using that method of configuration, that's just 1 option of 
3. He is nesting his Context definition within the server.xml Host 
element. Although this is now scorned, it's still valid. The 2 other 
methods are contextname.xml as you say, and also 
META-INF/context.xml within the webapp itself. Allistair.


 


-Original Message-
From: Brian Cook [mailto:[EMAIL PROTECTED]
Sent: 23 August 2005 17:23
To: Tomcat Users List
Subject: Re: jndi question



Ok but do you have the resource defined in context.xml?  If you go 
to <>/conf/Cataliana/localhost/ do you see a file with 
the name of the module ending with .xml?  If so is the resource 
defined in that file?  If not you need to add it.


From the description it sounds like nothing in this set up has been 
done as was show on the example page.


http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources
-howto.html

If you use the code block that is shown, define that resource in 
web.xml and context.xml it will work.  But multiple postings latter 
it still sounds like the JNDI resource is not defined in 
context.xml and the code calling the JNDI resource differs greatly 
from the example provided.



Sean Rowe wrote:
 

The first post on this included the server.xml, and further 



down in the  

page is the relevant part of web.xml ( i just double 



checked that ).  as  

for context.xml, i have listed it in my webapp.xml file, as well 
as server.xml as all other examples have suggested.  i then 



tried it in the  

admin module, where it then put it in server.xml for me.  



i'm willing to  


try anything at this point, though, if you have any suggestions.

as for my post not being jndi specific, i applogize if 



that's the case.   

i'm not really familiar with jndibut when I did a search for 
'connection pooling', jndi seemed to be what everyone 



suggested i use.   

what i want to do, if it's not clear, is to create a 



connection pool to  


my MySql database.
thanks,
sean

Brian Cook wrote:

   

Actually the files I listed are NOT in the first post.  It   




shows the 

Re: jndi question

2005-08-25 Thread Brian Cook


It has probablly already been stated before somewhere in this thread but 
what versions of Tomcat and JDK are you using?



Sean Rowe wrote:

yes, there is a file in the /conf/Catalina/localhost directory for my app

Brian Cook wrote:


Sean,

One thing that stands out in your message is that the conext.xml file 
was placed in the META-INF folder.  Is it also in <Folder>>/conf/Catalina/localhost/ as the module name?  i.e. If the 
context path name of your webapp is "/seansApp" the context.xml file 
should appear in this folder as seansApp.xml.



The context.xml file is stored in META-INF during development but 
needs to be placed in <>/conf/Catalina/localhost/ 
folder for deployment with the file name of the context path.





Sean Rowe wrote:

I have tried again using the method described in the url brian gave.  
Here is the stack exception I'm receiving:


*type* Exception report

*message*

*description* _The server encountered an internal error () that 
prevented it from fulfilling this request._


*exception*

javax.servlet.ServletException: Name java:comp is not bound in this 
Context

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848) 


org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781) 


org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:69)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) 


org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

*root cause*

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

org.apache.naming.NamingContext.lookup(NamingContext.java:769)
org.apache.naming.NamingContext.lookup(NamingContext.java:152)
javax.naming.InitialContext.lookup(InitialContext.java:351)
com.transcriptionportal.utils.DBManager.init(DBManager.java:25)
org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:53)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) 


org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


I have enclosed my server.xml, web.xml, context.xml (that i placed in 
my web/META-INF folder), and the class I'm using to make the 
connection.  Thanks again to everyone who has helped me so far.


sean

Allistair Crossley wrote:


Hi,

He isn't using that method of configuration, that's just 1 option of 
3. He is nesting his Context definition within the server.xml Host 
element. Although this is now scorned, it's still valid. The 2 other 
methods are contextname.xml as you say, and also 
META-INF/context.xml within the webapp itself. Allistair.


 


-Original Message-
From: Brian Cook [mailto:[EMAIL PROTECTED]
Sent: 23 August 2005 17:23
To: Tomcat Users List
Subject: Re: jndi question



Ok but do you have the resource defined in context.xml?  If you go 
to <>/conf/Cataliana/localhost/ do you see a file with 
the name of the module ending with .xml?  If so is the resource 
defined in that file?  If not you need to add it.


From the description it sounds like nothing in this set up has been 
done as was show on the example page.


http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources
-howto.html

If you use the code block that is shown, define that resource in 
web.xml and context.xml it will work.  But multiple postings latter 
it still sounds like the JNDI resource is not defined in 
context.xml and the code calling the JNDI resource differs greatly 
from the example provided.



Sean Rowe wrote:
 

The first post on this included the server.xml, and further 




down in the 

page is the relevant part of web.xml ( i just double 




checked that ).  as 

for context.xml, i have listed it in my webapp.xml file, as well 
as server.xml as all other examples have suggested.  i then 




tried it in the 

admin module, where it then put it in server.xml for me.  




i'm willing to 


try anything at this point, though, if you have any suggestions.

as for my post not being jndi specific, i applogize if 




that's the case.  

i'm not really familiar with jndibut when I did a search for 
'connection pooling', jndi seemed to be what everyone 




suggested i use.  

what i want to do, if it's not clear, is to create a 




connection pool to 

Re: jndi question

2005-08-25 Thread Sean Rowe

tomcat 5, and jdk 1.5

Brian Cook wrote:



It has probablly already been stated before somewhere in this thread 
but what versions of Tomcat and JDK are you using?



Sean Rowe wrote:

yes, there is a file in the /conf/Catalina/localhost directory for my 
app


Brian Cook wrote:


Sean,

One thing that stands out in your message is that the conext.xml 
file was placed in the META-INF folder.  Is it also in <Folder>>/conf/Catalina/localhost/ as the module name?  i.e. If the 
context path name of your webapp is "/seansApp" the context.xml file 
should appear in this folder as seansApp.xml.



The context.xml file is stored in META-INF during development but 
needs to be placed in <>/conf/Catalina/localhost/ 
folder for deployment with the file name of the context path.





Sean Rowe wrote:

I have tried again using the method described in the url brian 
gave.  Here is the stack exception I'm receiving:


*type* Exception report

*message*

*description* _The server encountered an internal error () that 
prevented it from fulfilling this request._


*exception*

javax.servlet.ServletException: Name java:comp is not bound in this 
Context

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848) 


org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781) 


org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:69)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) 


org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) 


org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

*root cause*

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

org.apache.naming.NamingContext.lookup(NamingContext.java:769)
org.apache.naming.NamingContext.lookup(NamingContext.java:152)
javax.naming.InitialContext.lookup(InitialContext.java:351)
com.transcriptionportal.utils.DBManager.init(DBManager.java:25)
org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:53)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) 


org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) 


org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


I have enclosed my server.xml, web.xml, context.xml (that i placed 
in my web/META-INF folder), and the class I'm using to make the 
connection.  Thanks again to everyone who has helped me so far.


sean

Allistair Crossley wrote:


Hi,

He isn't using that method of configuration, that's just 1 option 
of 3. He is nesting his Context definition within the server.xml 
Host element. Although this is now scorned, it's still valid. The 
2 other methods are contextname.xml as you say, and also 
META-INF/context.xml within the webapp itself. Allistair.


 


-Original Message-
From: Brian Cook [mailto:[EMAIL PROTECTED]
Sent: 23 August 2005 17:23
To: Tomcat Users List
Subject: Re: jndi question



Ok but do you have the resource defined in context.xml?  If you 
go to <>/conf/Cataliana/localhost/ do you see a file 
with the name of the module ending with .xml?  If so is the 
resource defined in that file?  If not you need to add it.


From the description it sounds like nothing in this set up has 
been done as was show on the example page.


http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources
-howto.html

If you use the code block that is shown, define that resource in 
web.xml and context.xml it will work.  But multiple postings 
latter it still sounds like the JNDI resource is not defined in 
context.xml and the code calling the JNDI resource differs 
greatly from the example provided.



Sean Rowe wrote:
 

The first post on this included the server.xml, and further 





down in the

page is the relevant part of web.xml ( i just double 





checked that ).  as

for context.xml, i have listed it in my webapp.xml file, as well 
as server.xml as all other examples have suggested.  i then 





tried it in the

admin module, where it then put it in server.xml for me.  





i'm willing to


try anything at this point, though, if you have any suggestions.

as for my post not being jndi specific, i applogize if 





that's the case. 

i'm not really familiar with jndibut when I did a search for 
'connection pooling', jndi seemed to be what everyone 





suggested i use. 

what i want to do, if it's no

RE: jndi question

2005-08-25 Thread Caldarale, Charles R
> From: Sean Rowe [mailto:[EMAIL PROTECTED] 
> Subject: Re: jndi question
> 
> tomcat 5, and jdk 1.5

Which Tomcat 5?  The configuration for the 5.0 series is not necessarily
the same as in 5.5.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

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



Re: jndi question

2005-08-25 Thread Sean Rowe

right!  sorry, it's 5.5.9

Caldarale, Charles R wrote:

From: Sean Rowe [mailto:[EMAIL PROTECTED] 
Subject: Re: jndi question


tomcat 5, and jdk 1.5
   



Which Tomcat 5?  The configuration for the 5.0 series is not necessarily
the same as in 5.5.

- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

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


 



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



Re: jndi question

2005-08-25 Thread Brian Cook


I thought of that but his code samples and configs are consitant with 
both the 5.0 and 5.5 docs.





Which Tomcat 5?  The configuration for the 5.0 series is not necessarily
the same as in 5.5.



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

Re: jndi question

2005-08-25 Thread Brian Cook

Sean,

I copied your code on top of mine and ran it with no problems.  So you 
can probably eliminate the code as the issue.  Also since the error is 
now on the "java:comp" resource and not your JNDI defined resources I 
think your context.xml and web.xml configuration is correct too.


I googled the javax.naming.NameNotFoundException on string "java:comp" I 
found several postings that mentioned they fixed it by removing the 
following files from their deployments.


http://forum.java.sun.com/thread.jspa?threadID=647982&tstart=105

naming-common.jar,
naming-java.jar,
naming-resources.jar,
naming-factory.jar

Are these by chance in your WEB-INF folder somewhere?  Or any where in 
your Tomcat install?  I checked they are not in mine and I have :



naming-factory.jar
naming-resources.jar

in Tomcat/common/lib/

If you see these files any where else try deleting them.  Other than 
that my only idea would be to try using Tomcat 5.5.


Sean Rowe wrote:
I have tried again using the method described in the url brian gave.  
Here is the stack exception I'm receiving:


*type* Exception report

*message*

*description* _The server encountered an internal error () that 
prevented it from fulfilling this request._


*exception*

javax.servlet.ServletException: Name java:comp is not bound in this Context
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848) 

org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781) 


org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:69)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) 

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) 


org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

*root cause*

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

org.apache.naming.NamingContext.lookup(NamingContext.java:769)
org.apache.naming.NamingContext.lookup(NamingContext.java:152)
javax.naming.InitialContext.lookup(InitialContext.java:351)
com.transcriptionportal.utils.DBManager.init(DBManager.java:25)
org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:53)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) 

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) 


org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


I have enclosed my server.xml, web.xml, context.xml (that i placed in my 
web/META-INF folder), and the class I'm using to make the connection.  
Thanks again to everyone who has helped me so far.


sean

Allistair Crossley wrote:


Hi,

He isn't using that method of configuration, that's just 1 option of 
3. He is nesting his Context definition within the server.xml Host 
element. Although this is now scorned, it's still valid. The 2 other 
methods are contextname.xml as you say, and also META-INF/context.xml 
within the webapp itself. Allistair.


 


-Original Message-
From: Brian Cook [mailto:[EMAIL PROTECTED]
Sent: 23 August 2005 17:23
To: Tomcat Users List
Subject: Re: jndi question



Ok but do you have the resource defined in context.xml?  If you go to 
<>/conf/Cataliana/localhost/ do you see a file with the 
name of the module ending with .xml?  If so is the resource defined 
in that file?  If not you need to add it.


From the description it sounds like nothing in this set up has been 
done as was show on the example page.


http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources
-howto.html

If you use the code block that is shown, define that resource in 
web.xml and context.xml it will work.  But multiple postings latter 
it still sounds like the JNDI resource is not defined in context.xml 
and the code calling the JNDI resource differs greatly from the 
example provided.



Sean Rowe wrote:
  

The first post on this included the server.xml, and further 


down in the   

page is the relevant part of web.xml ( i just double 


checked that ).  as   

for context.xml, i have listed it in my webapp.xml file, as well as 
server.xml as all other examples have suggested.  i then 


tried it in the   

admin module, where it then put it in server.xml for me.  


i'm willing to   


try anything at this point, though, if you have any suggestions.

as for my post not being jndi specific, i applogize if 


that's the case.

i'm not really familiar with jndibut

Re: jndi question

2005-08-25 Thread Sean Rowe
i do have those files.  i'll remove them and see what happens.  i really 
appreciate the help.


sean

Brian Cook wrote:


Sean,

I copied your code on top of mine and ran it with no problems.  So you 
can probably eliminate the code as the issue.  Also since the error is 
now on the "java:comp" resource and not your JNDI defined resources I 
think your context.xml and web.xml configuration is correct too.


I googled the javax.naming.NameNotFoundException on string "java:comp" 
I found several postings that mentioned they fixed it by removing the 
following files from their deployments.


http://forum.java.sun.com/thread.jspa?threadID=647982&tstart=105

naming-common.jar,
naming-java.jar,
naming-resources.jar,
naming-factory.jar

Are these by chance in your WEB-INF folder somewhere?  Or any where in 
your Tomcat install?  I checked they are not in mine and I have :



naming-factory.jar
naming-resources.jar

in Tomcat/common/lib/

If you see these files any where else try deleting them.  Other than 
that my only idea would be to try using Tomcat 5.5.


Sean Rowe wrote:

I have tried again using the method described in the url brian gave.  
Here is the stack exception I'm receiving:


*type* Exception report

*message*

*description* _The server encountered an internal error () that 
prevented it from fulfilling this request._


*exception*

javax.servlet.ServletException: Name java:comp is not bound in this 
Context

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848) 


org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781) 


org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:69)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) 


org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

*root cause*

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

org.apache.naming.NamingContext.lookup(NamingContext.java:769)
org.apache.naming.NamingContext.lookup(NamingContext.java:152)
javax.naming.InitialContext.lookup(InitialContext.java:351)
com.transcriptionportal.utils.DBManager.init(DBManager.java:25)
org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:53)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) 


org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


I have enclosed my server.xml, web.xml, context.xml (that i placed in 
my web/META-INF folder), and the class I'm using to make the 
connection.  Thanks again to everyone who has helped me so far.


sean

Allistair Crossley wrote:


Hi,

He isn't using that method of configuration, that's just 1 option of 
3. He is nesting his Context definition within the server.xml Host 
element. Although this is now scorned, it's still valid. The 2 other 
methods are contextname.xml as you say, and also 
META-INF/context.xml within the webapp itself. Allistair.


 


-Original Message-
From: Brian Cook [mailto:[EMAIL PROTECTED]
Sent: 23 August 2005 17:23
To: Tomcat Users List
Subject: Re: jndi question



Ok but do you have the resource defined in context.xml?  If you go 
to <>/conf/Cataliana/localhost/ do you see a file with 
the name of the module ending with .xml?  If so is the resource 
defined in that file?  If not you need to add it.


From the description it sounds like nothing in this set up has been 
done as was show on the example page.


http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources
-howto.html

If you use the code block that is shown, define that resource in 
web.xml and context.xml it will work.  But multiple postings latter 
it still sounds like the JNDI resource is not defined in 
context.xml and the code calling the JNDI resource differs greatly 
from the example provided.



Sean Rowe wrote:
 

The first post on this included the server.xml, and further 



down in the  

page is the relevant part of web.xml ( i just double 



checked that ).  as  

for context.xml, i have listed it in my webapp.xml file, as well 
as server.xml as all other examples have suggested.  i then 



tried it in the  

admin module, where it then put it in server.xml for me.  



i'm willing to  


try anything at this point, though, if you have any suggestions.

as f

Re: jndi question

2005-08-25 Thread Sean Rowe
pper.service(JspServletWrapper.java:322) 


org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


I have enclosed my server.xml, web.xml, context.xml (that i placed in 
my web/META-INF folder), and the class I'm using to make the 
connection.  Thanks again to everyone who has helped me so far.


sean

Allistair Crossley wrote:


Hi,

He isn't using that method of configuration, that's just 1 option of 
3. He is nesting his Context definition within the server.xml Host 
element. Although this is now scorned, it's still valid. The 2 other 
methods are contextname.xml as you say, and also 
META-INF/context.xml within the webapp itself. Allistair.


 


-Original Message-
From: Brian Cook [mailto:[EMAIL PROTECTED]
Sent: 23 August 2005 17:23
To: Tomcat Users List
Subject: Re: jndi question



Ok but do you have the resource defined in context.xml?  If you go 
to <>/conf/Cataliana/localhost/ do you see a file with 
the name of the module ending with .xml?  If so is the resource 
defined in that file?  If not you need to add it.


From the description it sounds like nothing in this set up has been 
done as was show on the example page.


http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources
-howto.html

If you use the code block that is shown, define that resource in 
web.xml and context.xml it will work.  But multiple postings latter 
it still sounds like the JNDI resource is not defined in 
context.xml and the code calling the JNDI resource differs greatly 
from the example provided.



Sean Rowe wrote:
 

The first post on this included the server.xml, and further 



down in the  

page is the relevant part of web.xml ( i just double 



checked that ).  as  

for context.xml, i have listed it in my webapp.xml file, as well 
as server.xml as all other examples have suggested.  i then 



tried it in the  

admin module, where it then put it in server.xml for me.  



i'm willing to  


try anything at this point, though, if you have any suggestions.

as for my post not being jndi specific, i applogize if 



that's the case.   

i'm not really familiar with jndibut when I did a search for 
'connection pooling', jndi seemed to be what everyone 



suggested i use.   

what i want to do, if it's not clear, is to create a 



connection pool to  


my MySql database.
thanks,
sean

Brian Cook wrote:

   

Actually the files I listed are NOT in the first post.  It   




shows the  

server.xml and the code calling it but does not show web.xml or 
context.xml.


The error you are getting just means that that the JNDI   




resource being  


called in the code is not defined in both web.xml and context.xml.

In looking at the code snip it in the first post I am not   




following  

what you are trying to do.  The post is for a JNDI   




question but in the  

code it looks like you are calling the DB URL directly.  The 
whole point of JDNI being to get specific URL, and configuration 
info outside of the code base.  I am not following what it is you 
are trying to do here.




Sean Rowe wrote:

 

Brian, thank you for replying.  I was afraid my topic was 




dead.  If  

you could look at my first post, I listed all the files 




that you have  

suggested I take a look at.  I have done everything you have 
suggested, but am still getting errors.  The error I am 




getting now is
 

javax.naming.NameNotFoundException: Name java:comp is not 




bound in  


this Context

I can't find anything on the net or in any books I've 




looked at that  

explains this.  As far as I can tell, java:comp should just be 
there.  Any ideas?  Thanks again.


Sean

Brian Cook wrote:

   

Yes you can use JNDI with out using JSTL.  But the only way to 
configure it is to define the JNDI resources in the web.xml and 
context.xml files.Technically you should be able to use the 
globally defined JNDI resources in server.xml, and I have seen 
configuration set ups doing it when googling.  But could   




never get  


them to work.

This highlights another area of seemingly unneeded   




complication in  

Java/Unix development.  Using JNDI for data sources which was 
supposed to help you save time requires that you   




redundantly define  


the JNDI resource in at lest 2 if not 3 places.

The admin tool which was also supposed to help save time   




defines the  

JNDI resources in server.xml which does not really seem   




to be all  

that helpful.  I am sure there is likely a reason for   




this but I am  

ignorant of it.  The admin tool is also supposed to let   




you define  

JNDI resources  per context but it errors out when ever 

Re: jndi question

2005-08-25 Thread Brian Cook
.jar

in Tomcat/common/lib/

If you see these files any where else try deleting them.  Other than 
that my only idea would be to try using Tomcat 5.5.


Sean Rowe wrote:

I have tried again using the method described in the url brian gave.  
Here is the stack exception I'm receiving:


*type* Exception report

*message*

*description* _The server encountered an internal error () that 
prevented it from fulfilling this request._


*exception*

javax.servlet.ServletException: Name java:comp is not bound in this 
Context

org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848) 


org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781) 


org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:69)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) 


org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

*root cause*

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

org.apache.naming.NamingContext.lookup(NamingContext.java:769)
org.apache.naming.NamingContext.lookup(NamingContext.java:152)
javax.naming.InitialContext.lookup(InitialContext.java:351)
com.transcriptionportal.utils.DBManager.init(DBManager.java:25)
org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:53)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322) 


org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


I have enclosed my server.xml, web.xml, context.xml (that i placed in 
my web/META-INF folder), and the class I'm using to make the 
connection.  Thanks again to everyone who has helped me so far.


sean

Allistair Crossley wrote:


Hi,

He isn't using that method of configuration, that's just 1 option of 
3. He is nesting his Context definition within the server.xml Host 
element. Although this is now scorned, it's still valid. The 2 other 
methods are contextname.xml as you say, and also 
META-INF/context.xml within the webapp itself. Allistair.


 


-Original Message-
From: Brian Cook [mailto:[EMAIL PROTECTED]
Sent: 23 August 2005 17:23
To: Tomcat Users List
Subject: Re: jndi question



Ok but do you have the resource defined in context.xml?  If you go 
to <>/conf/Cataliana/localhost/ do you see a file with 
the name of the module ending with .xml?  If so is the resource 
defined in that file?  If not you need to add it.


From the description it sounds like nothing in this set up has been 
done as was show on the example page.


http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources
-howto.html

If you use the code block that is shown, define that resource in 
web.xml and context.xml it will work.  But multiple postings latter 
it still sounds like the JNDI resource is not defined in 
context.xml and the code calling the JNDI resource differs greatly 
from the example provided.



Sean Rowe wrote:
 

The first post on this included the server.xml, and further 




down in the 

page is the relevant part of web.xml ( i just double 




checked that ).  as 

for context.xml, i have listed it in my webapp.xml file, as well 
as server.xml as all other examples have suggested.  i then 




tried it in the 

admin module, where it then put it in server.xml for me.  




i'm willing to 


try anything at this point, though, if you have any suggestions.

as for my post not being jndi specific, i applogize if 




that's the case.  

i'm not really familiar with jndibut when I did a search for 
'connection pooling', jndi seemed to be what everyone 




suggested i use.  

what i want to do, if it's not clear, is to create a 




connection pool to 


my MySql database.
thanks,
sean

Brian Cook wrote:

  

Actually the files I listed are NOT in the first post.  It   





shows the 

server.xml and the code calling it but does not show web.xml or 
context.xml.


The error you are getting just means that that the JNDI   





resource being 


called in the code is not defined in both web.xml and context.xml.

In looking at the code snip it in the first post I am not   





following 

what you are trying to do.  The post is for a JNDI   





question but in the 

code it looks like you are calling the DB URL directly.  The 
whole point of J