RE: resource defined in web.xml has null attributes but server.xml is ok

2004-11-10 Thread Steve Kirk
You don't say what version.  I am aware that things are changing in this
area in 5.5.x so what I'm saying possibly applies to 5.0.x only.  Check the
docs if you have a different version.

In 5.0.x, you have to put resource-ref in web.xml if you want to be
compliant with the servlet spec.
If you do that, you do not need the Resource anywhere.  I don't think it's
allowed in web.xml anyway.
TC allows you to omit resource-ref and use Resource instead if you
really must, but this is not spec-compliant.
If you do use Resource, it goes wherever you put ResourceParams as
decribed below.

The ResourceParams can go under a number of places and this is where people
get confused.  You can put it within:
GlobalNamingResources in server.xml, in which case you need a
ResourceLink under your Context to point from the Context to the
global resource

Context in server.xml, which you will have to create under the correct
Host (which is not recommended any longer)

DefaultContext in server.xml, again no longer recommended

CATALINA_HOME/conf/Engine/host/yourwebappname.xml - which contains purely
the Context tag

META-INF/context.xml within a war file (but not an open filesystem).  If you
choose this option, you need to pay attention to TC reloading behaviour when
you edit the Context.

All this is in the docs.  Well worth a read! :)
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/index.html 

 When I set up a db resource in web.xml and create it, for some reasons
 it has null's in its attributes (such as username, url, driverClass,
 ..).
 
 But when I set up the same resource in server.xml, it works fine.
 
 From the documentation it wasn't clear to me if both need to be set up
 the same way. i.e. I use
 
 Resource name=X.../
 ResourceParams name=X
 parameter . /parameter
 /ResourceParams
 
 in server.xml or web.xml, and then create a reference to it using
 Resource-ref in web.xml.
 
 Is this the correct way of doing this and if so any ideas on why a
 resource defined in web.xml should have null attributes when i get the
 object?
 
 Thanks
 
 -
 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: resource defined in web.xml has null attributes but server.xml is ok

2004-11-08 Thread Peter Johnson
Hi,
You need both. You define the resource in the context of the app and 
then link to the resource from the app.

http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html
PJ
Nishant Deshpande wrote:
When I set up a db resource in web.xml and create it, for some reasons
it has null's in its attributes (such as username, url, driverClass,
..).
But when I set up the same resource in server.xml, it works fine.
From the documentation it wasn't clear to me if both need to be set up
the same way. i.e. I use
Resource name=X.../
ResourceParams name=X
parameter . /parameter
/ResourceParams
in server.xml or web.xml, and then create a reference to it using
Resource-ref in web.xml.
Is this the correct way of doing this and if so any ideas on why a
resource defined in web.xml should have null attributes when i get the
object?
Thanks
-
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: resource defined in web.xml has null attributes but server.xml is ok

2004-11-08 Thread Nishant Deshpande
So - I cannot *not* define a resource at the server level (i.e. not
touch the server.xml or any  other server configuration file) and only
define it in the app configuration files - i.e. web.xml ?

It seems like thats what you are saying below - just want to be sure I
understand clearly.

Thanks



On Tue, 09 Nov 2004 10:11:27 +1100, Peter Johnson [EMAIL PROTECTED] wrote:
 Hi,
 
 You need both. You define the resource in the context of the app and
 then link to the resource from the app.
 
 http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html
 
 PJ
 
 
 
 Nishant Deshpande wrote:
 
 When I set up a db resource in web.xml and create it, for some reasons
 it has null's in its attributes (such as username, url, driverClass,
 ..).
 
 But when I set up the same resource in server.xml, it works fine.
 
 From the documentation it wasn't clear to me if both need to be set up
 the same way. i.e. I use
 
 Resource name=X.../
 ResourceParams name=X
 parameter . /parameter
 /ResourceParams
 
 in server.xml or web.xml, and then create a reference to it using
 Resource-ref in web.xml.
 
 Is this the correct way of doing this and if so any ideas on why a
 resource defined in web.xml should have null attributes when i get the
 object?
 
 Thanks
 
 -
 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: resource defined in web.xml has null attributes but server.xml is ok

2004-11-08 Thread Peter Johnson
Almost, you must define it in a context usually app specific rather than 
DefaultContext. The bit that makes it almost is that a context (if not 
DefaultContext) can be defined in the server.xml *or* 
conf/service/engine/app.xml e.g. catalina 
home/conf/Catalina/localhost/test.xml

If deploying as a WAR to Tomcat you would have
WEB-INF/web.xml  *and*
META-INF/context.xml   --- app specific context definition
PJ
Nishant Deshpande wrote:
So - I cannot *not* define a resource at the server level (i.e. not
touch the server.xml or any  other server configuration file) and only
define it in the app configuration files - i.e. web.xml ?
It seems like thats what you are saying below - just want to be sure I
understand clearly.
Thanks

On Tue, 09 Nov 2004 10:11:27 +1100, Peter Johnson [EMAIL PROTECTED] wrote:
 

Hi,
You need both. You define the resource in the context of the app and
then link to the resource from the app.
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html
PJ

Nishant Deshpande wrote:
   

When I set up a db resource in web.xml and create it, for some reasons
it has null's in its attributes (such as username, url, driverClass,
..).
But when I set up the same resource in server.xml, it works fine.
 

From the documentation it wasn't clear to me if both need to be set up
   

the same way. i.e. I use
Resource name=X.../
ResourceParams name=X
parameter . /parameter
/ResourceParams
in server.xml or web.xml, and then create a reference to it using
Resource-ref in web.xml.
Is this the correct way of doing this and if so any ideas on why a
resource defined in web.xml should have null attributes when i get the
object?
Thanks
-
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: resource defined in web.xml has null attributes but server.xml is ok

2004-11-08 Thread Nishant Deshpande
Ok got it.

If I could read property I would have saved myself a lot of time. Just
to emphasise for anyone else looking at this thread..

 a context (if not
 DefaultContext) can be defined in the server.xml *or*
 conf/service/engine/app.xml 

The OR is important - i was defining a context for the same webapp in
server.xml *and* my context.xml. When I do this, the
META-INF/context.xml file does not get read and copied to
/conf/Catalina/hostname/appname.xml. Only the context in
server.xml is read.

Thanks for your help.


On Tue, 09 Nov 2004 11:33:11 +1100, Peter Johnson [EMAIL PROTECTED] wrote:
 Almost, you must define it in a context usually app specific rather than
 DefaultContext. The bit that makes it almost is that a context (if not
 DefaultContext) can be defined in the server.xml *or*
 conf/service/engine/app.xml e.g. catalina
 home/conf/Catalina/localhost/test.xml
 
 If deploying as a WAR to Tomcat you would have
 WEB-INF/web.xml  *and*
 META-INF/context.xml   --- app specific context definition
 
 PJ
 
 
 
 Nishant Deshpande wrote:
 
 So - I cannot *not* define a resource at the server level (i.e. not
 touch the server.xml or any  other server configuration file) and only
 define it in the app configuration files - i.e. web.xml ?
 
 It seems like thats what you are saying below - just want to be sure I
 understand clearly.
 
 Thanks
 
 
 
 On Tue, 09 Nov 2004 10:11:27 +1100, Peter Johnson [EMAIL PROTECTED] wrote:
 
 
 Hi,
 
 You need both. You define the resource in the context of the app and
 then link to the resource from the app.
 
 http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html
 
 PJ
 
 
 
 Nishant Deshpande wrote:
 
 
 
 When I set up a db resource in web.xml and create it, for some reasons
 it has null's in its attributes (such as username, url, driverClass,
 ..).
 
 But when I set up the same resource in server.xml, it works fine.
 
 
 
 From the documentation it wasn't clear to me if both need to be set up
 
 
 the same way. i.e. I use
 
 Resource name=X.../
 ResourceParams name=X
 parameter . /parameter
 /ResourceParams
 
 in server.xml or web.xml, and then create a reference to it using
 Resource-ref in web.xml.
 
 Is this the correct way of doing this and if so any ideas on why a
 resource defined in web.xml should have null attributes when i get the
 object?
 
 Thanks
 
 -
 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]