title: How to configure datasource jboss 4.2.3 for a jar library that initialize connection in the default context?
body: <p>we have a jar library util that manage some of the logic of connection to db and store the data in memory. Well, this works fine in tomcat because we can configure the datasource in the $CATALINA_HOME/conf/context.xml and everything work's just fine.</p>
  
  <p>How i can configure a datasource in jboss (4.2.3.GA) that's can be see by all the war, ear or apps deployed and of course this jar util that's it's deployed in the $JBOSS_HOME/server/&lt;<em>instance</em>>/lib ?</p>
  
  <p>Thanks :) </p>
  
  <p>UPDATE:</p>
  
  <p>I specifically want to do:</p>
  
  <p>"2a. Shared resource configuration</p>
  
  <p>Use this option if you wish to define a datasource that is shared across multiple JBoss Web applications, or if you just prefer defining your datasource in this file.</p>
  
  <p><em>This author has not had success here, although others have reported so. Clarification would be appreciated here</em>.</p>
  
  <pre><code>&lt;Resource name="jdbc/postgres" auth="Container"
            type="javax.sql.DataSource" driverClassName="org.postgresql.Driver"
            url="jdbc:postgresql://127.0.0.1:5432/mydb"
            username="myuser" password="mypasswd" maxActive="20" maxIdle="10" maxWait="-1"/&gt;
  </code></pre>
  
  <p>source: <a href="https://docs.jboss.org/jbossweb/2.1.x/jndi-datasource-examples-howto.html" rel="nofollow">https://docs.jboss.org/jbossweb/2.1.x/jndi-datasource-examples-howto.html</a></p>
  
  <p>Well, i'm in the part of "<em>Clarification would be appreciated here</em>"...</p>