[jboss-user] [Beginners Corner] - Re: jboss and spring frame work

PeterJ do-not-reply at jboss.com
Wed Aug 8 13:25:02 EDT 2007


I don't have Spring-related example, but here is one using plain servlets/JSPs. In my web.xml file I have:

  <resource-ref>
  |     <res-ref-name>ds/SomeDS</res-ref-name>
  |     <res-type>javax.sql.DataSource</res-type>
  |     <res-auth>Container</res-auth>
  |     <res-sharing-scope>Shareable</res-sharing-scope>
  |   </resource-ref>

and in jboss-web.xml I have:

<jboss-web>
  |   <resource-ref>
  |     <res-ref-name>ds/SomeDS</res-ref-name>
  |     <jndi-name>java:ds/SomeDS</jndi-name>
  |   </resource-ref>
  | </jboss-web>

and in my application I look up the datasource as:

InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/ds/SomeDS");


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4072119#4072119

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4072119



More information about the jboss-user mailing list