I am having some problems with dependency injection of an ejb in a webservice on jboss
4.0.5. What am i doing wrong?
The below code i have also tried @EJB without any parameters:
Also i could not get the setter to work either. it never entered the setter and displayed
the logs.
| @EJB(name="LookupTest/remote",
| beanInterface=RemoteLookupTest.class)
| RemoteLookupTest ps;
|
| /* public void setPersonService(RemoteLookupTest newPs){
| log.info("injecting new personService: "+newPs);
| this.ps = newPs;
| log.info("injected personService: ps="+ps);
| }
| */
| @WebMethod
| public Person queryPerson(long personId) throws RemoteException{
| System.out.println(ps.getName());
| }
|
this code gives me a null pointer exception at the ps.getName();
this next code snippet is the next function in the web service and it works fine. this
makes me think that the bean is deployed correctly.
| @WebMethod
| public void testLookupBean() throws RemoteException{
| try{
| Context ctx = new InitialContext();
| String jndiName = "LookupTest/remote";
| RemoteLookupTest obj = (RemoteLookupTest)ctx.lookup(jndiName);
| System.out.println(obj.getName());
|
thanks in advance
-==-
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4093087#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...