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()); }
@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());