|
| @Resource DataSource ds and @EJB injection not working |
 |
Wed, 2 Apr 2008 16:27:51 -0700 |
Hi there,
I'm using wls 10.3 and I'm trying to inject a DataSource and EJB in one of my
webservice (jax-rpc) and using the annotation because I'm just using the jwsc
ant task to generate all my weblogic descriptor. When I tried to test the
DataSource and EJB it is null. I have defined in the admin console a jdbc
DataSource jndi named="jdbc/ppDataSource" and also created both
SystemEJBRemote and SystemEJBLocal ejb's. Sample code below.
@SoapBinding(style=SOAPBinding.Style.DOCUMENT....)
@Stateless(mappedName="CustomerBeanWS")
@WebService(name="CustomerWS",
serviceName="CustomerWSService")
public class CustomerWSImpl
@EJB private SystemEJBLocal systemLocal;
@Resource DataSource(name="jdbc/DataSource") ds;
public void testInjection() {
// test ejb
if (systemLocal != null) {
systemLocal.hello();
} else {
System.out.println("SystemEJBLocal ref injection is null.");
}
if (ds != null) {
ds.getConnection();
} else {
System.out.println("DataSource ref injection is null.");
}
}
@Stateless
@Local( SystemEJBLocal.class )
@Remote( SystemEJBRemote.class )
public class SystemEJBImpl {
public void hello() {
System.out.println( "Hello EJB3!" );
}
}
Your help is very much appreciated.
|
| Post Reply
|
|
|
|
|
|
|
|
|
|