5 Replies Latest reply on May 26, 2009 5:20 AM by jaikiran

    Webservice error

      Hi,
      I am trying to extend a stateless sesssion bean BookSearchActionService to webservice.
      After deploying, when i try to invoke the webserice. I get following error.

      java.lang.IllegalArgumentException: Wrong target. class webservices.action.BookSearchActionService for public webservices.beans.Book[] webservices.action.BookSearchActionService.searchBooks(java.lang.String)

      Here is my SLB code

      package webservices.action;
      
      import java.util.ArrayList;
      
      import javax.ejb.Stateless;
      import javax.jws.WebMethod;
      import javax.jws.WebService;
      import javax.jws.soap.SOAPBinding;
      import javax.jws.soap.SOAPBinding.ParameterStyle;
      import javax.jws.soap.SOAPBinding.Style;
      import javax.jws.soap.SOAPBinding.Use;
      import javax.persistence.EntityManager;
      import javax.persistence.PersistenceContext;
      
      import webservices.beans.Book;
      @Stateless
      @WebService(name="booksearch",
       serviceName="booksearch",
       targetNamespace="URN:ejbmodule.bookserch")
      @SOAPBinding(parameterStyle=ParameterStyle.WRAPPED,style=Style.DOCUMENT,use=Use.LITERAL)
      public class BookSearchActionService {
      
       @PersistenceContext
       private EntityManager mgr;
       @WebMethod(operationName="searchBooksByAuthor",action="searchBooksByAuthor")
       public Book[] searchBooks(String author) {
       ArrayList<Book> list = (ArrayList<Book>) mgr.createNamedQuery("findBooksByAuthor").setParameter("author", author).getResultList();
       Book[] books = new Book[list.size()];
       for (int i = 0; i < list.size(); i++) {
       books = list.get(i);
       }
       return books;
       }
      
       }
      
      


      Am I missing anything here ?
      thanks in advance.
      Mayuresh

        • 1. Re: Webservice error
          jaikiran

          Please post the entire exception stacktrace and the client code which looks up the stateless bean.

          While posting logs or xml content or code, please remember to wrap it in a code block by using the Code button in the message editor window. Please use the Preview button to ensure that your post is correctly formatted.

          • 2. Re: Webservice error

            here is the entire exception stack

            javax.ejb.EJBException: java.lang.IllegalArgumentException: Wrong target. class webservices.action.BookSearchActionService for public webservices.beans.Book[] webservices.action.BookSearchActionService.searchBooks(java.lang.String)
             at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:77)
             at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
             at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
             at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
             at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
             at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
             at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
             at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
             at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
             at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67)
             at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
             at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:372)
             at org.jboss.ejb3.stateless.StatelessContainer.invokeEndpoint(StatelessContainer.java:727)
             at org.jboss.wsf.container.jboss50.invocation.InvocationHandlerEJB3.invoke(InvocationHandlerEJB3.java:96)
             at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:219)
             at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:474)
             at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:295)
             at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:205)
             at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:131)
             at org.jboss.wsf.common.servlet.AbstractEndpointServlet.service(AbstractEndpointServlet.java:85)
             at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
             at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
             at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
             at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
             at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
             at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
             at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
             at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
             at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
             at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
             at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
             at java.lang.Thread.run(Thread.java:595)
            


            • 3. Re: Webservice error

              When i use java premitives/Strings as IN OUT paramters, the service displays no malfuntion.
              Is there anything missing when deploying ejbs as webservices which pass
              java objects in its methods ?

              • 4. Re: Webservice error

                Solved.

                Solution :

                Do not use overriden methods in SLSB which extend as Webservice.

                I was using method searchBooks which was overridden.

                • 5. Re: Webservice error
                  jaikiran

                   

                  "z_idane" wrote:
                  Solved.

                  Do not use overriden methods in SLSB which extend as Webservice.



                  You might want to bring this up in the WebSerives forums probably http://www.jboss.org/index.html?module=bb&op=viewforum&f=200. If this is reproducible with just EJB3 beans then let us know. And please mention the JBoss AS version when you create a new post in the Webservice forum