On Jan 11, 2009, at 7:08 PM, bongosdude wrote:


Hi,

I have created sucessfully a data pool name="jdbc/mydb" and below is my
stateless ejb

@Stateless(name="myslsb")
@Local(ISessionLocal.class)
@Remote(ISessionRemote.class)
public class MySLSB implements ISessionLocal, ISessionRemote {

   @Resource(name="jdbc/mydb")
   private DataSource ds = null;
.........
}

my slsb ejb tried to get a datasource and pass it to another bean which can execute a stored procedure. however, when I try to deploy it from eclipse, I
got the following error:

Unable to resolve resource reference 'jdbc/mydb' (Could not auto-map to resource. Try adding a resource-ref mapping to your Geronimo deployment
plan.

1. I have tried all value for the name, including the global JNDI value but
all failed with the same error.
2. If I have to modify openejb-jar.xml, can someone give help on how to add
ref to datasource in the openejb-jar.xml



For servlets you definitley need and I think for ejbs also that the plugin or module that defines the datasource is a parent of the application with the annotation. So, if you're deploying all these as geronimo plugins, you can add the datasource plugin as a maven dependency of the ejb app plugin. If you are deploying directly you can include the datasource id in the list of dependencies in the geronimo plan.

thanks
david jencks


Thanks

-B

-----
B Amigo:super:
--
View this message in context: 
http://www.nabble.com/How-to-Inject-Datasource-into-session-stateless-bean--tp21407678s134p21407678.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Reply via email to