2 Replies Latest reply on Jul 21, 2010 4:25 PM by mahmut1

    Weld on JBOSS causes NPE

    mahmut1

      Hello,


      I'm trying to run a simple CDI example on latest nightly builded JBOSS 6.
      Runnig the example causes a NPE:




      Caused by: java.lang.NullPointerException
              at de.SoapService.sayHello(SoapService.java:26) [:]
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_17]
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_17]
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_17]
              at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_17]
              at org.jboss.wsf.common.invocation.AbstractInvocationHandlerJSE.invoke(AbstractInvocationHandlerJSE.java:129) [:1.4.0.Beta1]
              at org.jboss.wsf.stack.cxf.AbstractInvoker._invokeInternal(AbstractInvoker.java:161) [:3.4.0.Beta1]
              ... 41 more
      


      My goal is to inject a utility class into another class:




      public class UtilBean {
          public UtilBean(){}
          
          public String doSomething(String message){
           return "made something with parameter " + message;
          }
      }





      @WebService(targetNamespace = "http://de.com/soap", serviceName = "SoapService")
      @SOAPBinding(style = SOAPBinding.Style.RPC)
      public class SoapService {
           @Inject private UtilBean utilBean;
           
           @WebMethod
           @WebResult(name="result")
           public String sayHello(@WebParam(name="message") String message){
                System.out.println("calling utilBean: " + this.utilBean.doSomething(message));
                return "saying hello from soapservice to " + message;
           }
           




      The injected UtilBean is always null and I don't now why.


      Thanks in advance.
      Mahmut