3 Replies Latest reply on May 3, 2012 8:17 AM by Shekh Morshed Akther

    Simple Web Services are NOT Working -- Please Help

    phanto Newbie

      Hi Everyone,


      I am new to JBoss, and Java Web development in general.  We are currently examining SOA based solutions for a future software development project, and we have been working with both JBoss and Glassfish for testing.  Right now, we have been able to get a simple Java Web Service and REST Web Service created in Netbeans and Glassfish.  This process was rather simple.


      We are now trying to do the exact same thing with JBoss and Eclipse.  Thus far, this has been a complete and utter NIGHTMARE!  I don't understand whether my problem is with Eclipse, JBoss, or both.


      I have created a simple web service following the insturctions posted here:

      http://community.jboss.org/wiki/UsingTheSampleWebServiceWizards .


      It seemed simple to follow, however, I am unable to access the WSDL file and the web service tester tool with the ?wsdl and ?tester urls appended to the web service path.  I followed the JAX-WS example exactly, with the same names used for the example, and I am getting this error while accessing the ?wsdl page:


      java.lang.ClassCastException: org.jboss.samples.webservices.HelloWorld cannot be cast to javax.servlet.Servlet











      I am using JBoss AS 7.0.2 with Eclipse 3.7, and the latest version of the JBoss Tools.  Again, I followed the instructions exactly.  I have absolutely no idea why this isn't working.  So far, my experience with Glassfish has been much more positive, however, we would prefer to stay with JBoss, since it does have a lot of industry backing.


      To assist with the debugging, here is the web.xml file:


      <?xml version="1.0" encoding="UTF-8"?>

      <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">





















      Here is the HelloWorld.java file:

      package org.jboss.samples.webservices;


      import javax.jws.WebMethod;

      import javax.jws.WebService;



      public class HelloWorld {



          public String sayHello(String name) {

              System.out.println("Hello: " + name);

               return "Hello " + name + "!";




      All help is greatly appreciated!


      Thank You