• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Define DataSource in META-INF/context.xml ?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(JBoss AS 4.2.2.GA)
(Oracle 10.2)

I currently define my DataSource in $JBOSS_HOME/server/default/deploy/oracle-ds.xml, which looks like this:

My web application (war packaged) WEB-INF/web.xml has:

And of course the corresponding WEB-INF/jboss-web.xml:

Which allows me to get a DataSource as follows:

This all works. However, I would prefer to define my DataSource in my web application's META-INF/context.xml as is done in (standalone) Tomcat, something like this:

I have been unable to get this to work. Does JBoss AS use the context.xml? If so, how do I define my DataSource there?

If I have simply missed the relevant section of the manual and somebody can point me to it, I would be grateful.
[ August 21, 2008: Message edited by: Stephen Byrne ]
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is not possible. The only way of defining a datasource is with a *-ds.xml file.

Is it that you prefer to deploy just a single file, rather than two files? If so, you could package the *.ds.xml and war files in an ear. You would need a META-INF/jboss-app.xml file to reference the *-ds.xml.
 
Stephen Byrne
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Peter Johnson:
Is it that you prefer to deploy just a single file, rather than two files? If so, you could package the *.ds.xml and war files in an ear. You would need a META-INF/jboss-app.xml file to reference the *-ds.xml.



In addition to wanting to deal with only a single file I would like the DataSource pool stopped and started when I redeploy the application. Will that happen if I deploy with a .ear?
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That should get you what you want:

1) Single file to deploy - 100% confidence level

2) Datasource pool restarted on redeploy - 80% confidence level. If you do not change the *-ds.xml file and thus the timestamp remains the same, I am not sure if the datasource would actually be restarted, but a quick test should verify if it is (you'll see it in the console log, and if you are using PostgreSQL you should see a new set of processes). If the timestamp on the *-ds.xml file changes a restart is guaranteed.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Srikant Venkata,
Your post was moved to a new topic.
 
Eat that pie! EAT IT! Now read this tiny ad. READ IT!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic