[jboss-user] [Beginners Corner] - Re: multiple datasource

weston.price@jboss.com do-not-reply at jboss.com
Wed Feb 14 13:52:54 EST 2007


Ok, so the problem is in your resource-ref

When you deploy a seperate datasource, your resorce-ref needs to point to your new datasource, not DefaultDS. 

Your configuration


  | <resource-ref>
  |                           <description>jdbc:mysql://127.0.0.2:3306/tmp</description>
  |                           <res-ref-name>jdbc/DefaultDS</res-ref-name>
  |                           <res-type>javax.sql.DataSource</res-type>
  |                           <res-auth>Container</res-auth>
  |                           <res-sharing-scope>Shareable</res-sharing-scope>
  |                       </resource-ref>	
  | 

Should be rewritten as 


  | <resource-ref>
  |                           <description>jdbc:mysql://127.0.0.2:3306/tmp</description>
  |          
  |                  <res-ref-name>jdbc/SOME-NEW_NAME-FOR-MY-DS</res-ref-name>
  |                           <res-type>javax.sql.DataSource</res-type>
  |                           <res-auth>Container</res-auth>
  |                           <res-sharing-scope>Shareable</res-sharing-scope>
  |                       </resource-ref>	
  | 
  | 
  |   | 
  |   | The resource-ref name is simply a logical binding used in your code to avoid having to hardcode resource-JNDI names. 
  |   | 
  |   | Now you simply need a jboss.xml file to bind the resource-ref to the actual JNDI name in your *-ds.xml file: 
  |   | 
  |   | 
  |   |   |       <resource-ref>
  |   |   |         <res-ref-name >jdbc/SOME-NEW_NAME-FOR-MY-DS</res-ref-name>
  |   |   |         <resource-name>THE-ACTUAL-JNDI-NAME</resource-name>
  |   |   |       </resource-ref>
  |   |   | 
  |   | 
  |   | The jboss.xml file should go in the META-INF directory of your EJB jar file. My suggestion would be to start with a fresh install of JBoss, make the changes and redeploy.

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

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



More information about the jboss-user mailing list