10 Replies Latest reply on Apr 18, 2011 2:28 PM by Peter Johnson

    cannot be cast to javax.servlet.Servlet

    PRAVEEN KONDAKA Newbie

      Hello Folks,

       

      This might be a duplicate post, but honestly i couldn't find any solutions to this. please help me.

       

      I am trying to expose my POJO as web service using maven. I have _logic.jar, _war.war and _logic jar is available in WEB-INF/lib/_logic.jar

       

      Have a POJO based on javax.jws.* and have simple method

       

      @WebMethod

      public String sayHello(String name)

      {

        return "Hi " + name + " from the New York.";

      }

       

      <servlet>

        <display-name>Hello Web Service</display-name>

        <servlet-name>HelloService</servlet-name>

        <servlet-class>xxx.xxxx.xxxx.xxxx.Hello</servlet-class>

        <load-on-startup>1</load-on-startup>

      </servlet>

      <servlet-mapping>

        <servlet-name>HelloService</servlet-name>

        <url-pattern>/HelloService</url-pattern>

      </servlet-mapping>

      .

      I am getting following error while deploying

      java.lang.ClassCastException: mil.oni.gdb.webservice.Hello cannot be cast to javax.servlet.Servlet

       

      Do i need to add/edit any other files like jboss-web.xml or any other configuration file missing? I was googling for long time, but couldn't find any solution.

       

      PLEASE HELP ME