[jboss-user] [Installation, Configuration & DEPLOYMENT] - Re: DI and annotations not working

irinac do-not-reply at jboss.com
Wed Sep 10 10:46:46 EDT 2008


Here is the code for the java side


  | 
  | @Stateless
  | @WebService(serviceName="TestService") 
  | @SOAPBinding(
  |      style=javax.jws.soap.SOAPBinding.Style.RPC,
  |      use=javax.jws.soap.SOAPBinding.Use.LITERAL)
  | public class TestWebService extends Remote implements TestWebServiceInterface {
  | 	
  | 	@EJB private DomainManager domainManager;
  | 
  |         public TestWebService() {
  | 	}
  |  
  |         @WebMethod
  | 	public String sayHello() {
  | 		 		
  | 		String hellostring = domainManager.sayHello();
  | 		return hellostring;
  | 	}
  | }
  | 
  | @Local
  | public interface DomainManager {
  | 	
  | 	public String sayHello();
  | }
  | 
  | @Stateless
  | public class DomainManagerBean implements DomainManager{
  | 	
  | 		
  | 	public DomainManagerBean() {
  | 	}
  | 	
  | 	public String sayHello() {
  | 		return "Hello";
  | 	}
  | }
  | 
  | 

I am invoking the web service from a flex application, not sure if pasting that code will help ...

Upon invokation this is the line where the null pointer is thrown


  | String hellostring = domainManager.sayHello();
  | 


Alternatively, this is the code i was using inside the WebMethod to look up the bean


  | 
  | InitialContext ctx = new InitialContext();
  | 	         domainManager = (DomainManager) ctx.lookup("RPortal/DomainManagerBean/local");
  | 
  | 

and it works ...



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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4175603



More information about the jboss-user mailing list