2 Replies Latest reply on Jun 20, 2012 2:41 AM by caartic

    InstantiationException w JBoss 5.1.0GA

    gryffin

      I've gotten ant to access the right JBoss libs on launch, but now I'm getting an instantiation exception.

      Here's what I get when I run the client:

       

      run-client:
           [java] Getting associations for TestingAsset/NLS_Core_Team
           [java] Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Cannot get target bean
      instance
           [java]     at org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS.getSOAPFaultException(SOAPFaultHelpe
      rJAXWS.java:84)
           [java]     at org.jboss.ws.core.jaxws.binding.SOAP11BindingJAXWS.throwFaultException(SOAP11Bind
      ingJAXWS.java:107)
           [java]     at org.jboss.ws.core.CommonSOAPBinding.unbindResponseMessage(CommonSOAPBinding.java:
      579)
           [java]     at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:381)
           [java]     at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:290)
           [java]     at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:170)
           [java]     at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)
           [java]     at $Proxy15.assetAssociationGet(Unknown Source)
           [java]     at dc3.NlsApiClient.getAssociations(NlsApiClient.java:69)
           [java]     at dc3.NlsApiClient.main(NlsApiClient.java:58)
           [java] Java Result: 1

       

      ANd here's what the JBoss log says for this attempt:

       

      2010-03-11 13:48:50,527 ERROR [org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS] (http-127.0.0.1-8080-1) SOAP request exception
      java.lang.IllegalStateException: Cannot get target bean instance
          at org.jboss.wsf.container.jboss50.invocation.InvocationHandlerJSE.getTargetBean(InvocationHandlerJSE.java:82)
          at org.jboss.wsf.container.jboss50.invocation.InvocationHandlerJSE.invoke(InvocationHandlerJSE.java:97)
          at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:222)

      ...

          at java.lang.Thread.run(Thread.java:619)
      Caused by: java.lang.InstantiationException: com.boeing.nmt.nls.api.ws.NlsApiName
          at java.lang.Class.newInstance0(Class.java:340)
          at java.lang.Class.newInstance(Class.java:308)
          at org.jboss.wsf.container.jboss50.invocation.InvocationHandlerJSE.getTargetBean(InvocationHandlerJSE.java:77)
          ... 28 more

       

      From this it appears the problem is on the service side ( as opposed to client ), which was generated via JBoss's wsconsume utility. However the stack trace gives me no where to go with the problem.

       

      Here's the class in question:


      /**
      * This class was generated by the JAX-WS RI.
      * JAX-WS RI 2.1.3-b02-
      * Generated source version: 2.0
      *
      */
      @WebService(
              name = "NlsApiName",
              targetNamespace = "http://www.boeing.com/NLS/api",
              serviceName="NlsApiServiceName",
              wsdlLocation="/WEB-INF/wsdl/NlsApi.wsdl"
      )
      @SOAPBinding(style = SOAPBinding.Style.RPC)
      public interface NlsApiName {


          @WebMethod(action = "urn:http://www.boeing.com/NLS/soap#AssetAssociationDelete")
          @WebResult(name = "CommandStatus", partName = "CommandStatus")
          public AssociationReturnCode assetAssociationDelete(
              @WebParam(name = "Selector", partName = "Selector")
              AssetSelector selector);


          @WebMethod(action = "urn:http://www.boeing.com/NLS/soap#AssetAssociationGet")
          @WebResult(name = "Results", partName = "Results")
          public AssetAssociationGetResults assetAssociationGet(
              @WebParam(name = "Selector", partName = "Selector")
              AssetSelector selector);



          @WebMethod(action = "urn:http://www.boeing.com/NLS/soap#AssetAssociationSet")
          @WebResult(name = "CommandStatus", partName = "CommandStatus")
          public AssociationReturnCode assetAssociationSet(
              @WebParam(name = "Selector", partName = "Selector")
              AssetSelector selector,
              @WebParam(name = "AssociationValues", partName = "AssociationValues")
              AssociationValues associationValues);

       

      }

       

       

      I couldn't find any mention of anyone else having this problem, so I must have stumbled into something really basic.

        • 1. Re: InstantiationException w JBoss 5.1.0GA
          ropalka
          The problem is referenced class is interface and not regular Web Service class with public constructor
          • 2. Re: InstantiationException w JBoss 5.1.0GA
            caartic

            1. Ensure your servlet-class in the web.xml is pointing to the impl class of your interface.

            <servlet-class>package.AbcImpl</servlet-class>

             

            2. Make sure your impl class is declared as a webservice class with the following details:

            import

            javax.jws.WebService;

            ...

             

            @WebService(name = "AbcImpl", serviceName = "Abc", endpointInterface = <package>.Abc")

             

             

             

            public class AbcImpl implements Abc{