• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Bear Bibeault
  • Rob Spoor
  • Henry Wong
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Frits Walraven
  • Himai Minh
  • Jj Roberts

4.1 to 5.5.20...context.xml question

Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All,

I'm attempting to upgrade from Tomcat 4.1 to 5.5.20, and running into some trouble that I'm having a hard time figuring out. The newest problem is figuring out how to include my database resource properly. In the 5.5 documentation, it is strongly suggested that:

Please note that for tomcat 5, unlike tomcat 4.x, it is NOT recommended to place <Context> elements directly in the server.xml file. Instead, put them in the META-INF/context.xml directory of your WAR file or the conf directory as described above.

So, I'm attempting to put the <Resource> elements within the <Context> element in said context.xml. However, according to the 5.5 documentation, I'm only allowed to place auth, description, name, scope and type elements within the <Resource> element in the context.xml. So, whereas previously I defined my database resource in the server.xml file like so:

I am now supposed to define it this way in the context.xml:

or, something *like* the above. I'm only allowed a few elements, so my resource definition ends up being:

So, where the heck does the *rest* of the context/resource information go? Where do I place the rest of my elements, i.e.

I get the feeling I'm missing something big here. Any help?
[ October 25, 2006: Message edited by: Jeff Pollet ]
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you see:

<Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
maxActive="100" maxIdle="30" maxWait="10000"
username="javauser" password="javadude" driverClassName="com.mysql.jdbc.Driver"

Jeff Pollet
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're right, of course. What confused me was this (from this part of the documentation):

The valid attriutes for a <Resource> element are as follows:

auth Specify whether the web Application code signs on to the corresponding resource manager programatically, or whether the Container will sign on to the resource manager on behalf of the application. The value of this attribute must be Application or Container. This attribute is required if the web application will use a <resource-ref> element in the web application deployment descriptor, but is optional if the application uses a <resource-env-ref> instead.

description Optional, human-readable description of this resource.

name The name of the resource to be created, relative to the java:comp/env context.

scope Specify whether connections obtained through this resource manager can be shared. The value of this attribute must be Shareable or Unshareable. By default, connections are assumed to be shareable.

type The fully qualified Java class name expected by the web application when it performs a lookup for this resource.

I guess I took "the valid attributes for a Resource element" to be all-inclusive. But, as you point out, the examples given have more than these attributes.

Thanks for your help.
If you were a tree, what sort of tree would you be? This tiny ad is a poop beast.
SKIP - a book about connecting industrious people with elderly land owners
    Bookmark Topic Watch Topic
  • New Topic