Hi all !
I have posted this question in the persistence forum yesterday, but I had no 
luck. Meybe this forum is more appropriate: so I'm trying to inject a 
Datasource in a Webservice....

@WebService(name = "CalculatorWS", targetNamespace = 
"http://webservice_calc/calculator";)
  | public class CalculatorWS
  | {
  |   @Resource(mappedName="java:/OracleDS") 
  |   DataSource datasource;
  |    
  |    @WebMethod
  |    public Person calculate(Object obj) {
  |       System.out.println("Datasource is " + datasource; // NULL !!
  |      // .....
  |    }
  | }   
  | 
  | 
  | 

The Datasource injected is null in the method calculate.....
so I have tried to get the datasource with the InitialContext

DataSource ds = (DataSource)new InitialContext().lookup("java:/OracleDS"); 
  | 
  | Connection conn = null; 
  | try { 
  |      
  | conn = ds.getConnection(); 
  | System.out.println("Connection with initial context" +conn);
  | }   
  | 
  | 

and the Connection is correctly retrieved.

Do I miss something to make it work also with injection ???
The AS I0m using is JBoss 5.0 GA but I have tested also with 4.2 and it doesn't 
work too. :-(
Thanks a lot
Marco 

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

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4209416
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to