Jens Mander [
http://community.jboss.org/people/JensMander] created the discussion
"Dependancy injection with datasources within a webservice"
To view the discussion, visit:
http://community.jboss.org/message/540065#540065
--------------------------------------------------------------
Hi,
I'am trying to use the @Resouce-Annotation for a datasource in my WebService (wsdl). I
guess the datasource is properly configured because the following snippet works without
any problems.
public String myFunction(String in) throws NamingException {
InitialContext ctx;
ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:/MyDataSource");
// do something with the datasource
return "something";
}
but if I'am trying something like that
@Resource(name="MyDataSource")
private DataSource ds;
public String myFunction(String in) throws NamingException {
// do something with the datasource ds
return "something";
}
I can't even deploy my webservice to the JBoss AS. The message says that
"MyDataSource" couldn't be found ;(
I hope somebody has a piece of advice for me. Thanks a lot.
Jens
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/540065#540065]
Start a new discussion in JNDI and Naming at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]