3 Replies Latest reply on May 3, 2012 8:17 AM by shekh

    Simple Web Services are NOT Working -- Please Help

    phanto

      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

      org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:139)

      org.jboss.as.web.NamingValve.invoke(NamingValve.java:57)

      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)

      org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)

      org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667)

      org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:952)

       

      java.lang.Thread.run(Thread.java:662)

       

      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">

         <display-name>MySampleWS</display-name>

        <welcome-file-list>

          <welcome-file>index.html</welcome-file>

          <welcome-file>index.htm</welcome-file>

          <welcome-file>index.jsp</welcome-file>

           <welcome-file>default.html</welcome-file>

          <welcome-file>default.htm</welcome-file>

          <welcome-file>default.jsp</welcome-file>

        </welcome-file-list>

        <servlet>

           <display-name>HelloWorld</display-name>

          <servlet-name>HelloWorld</servlet-name>

          <servlet-class>org.jboss.samples.webservices.HelloWorld</servlet-class>

        </servlet>

         <servlet-mapping>

          <servlet-name>HelloWorld</servlet-name>

          <url-pattern>/HelloWorld</url-pattern>

        </servlet-mapping>

      </web-app>

       

      Here is the HelloWorld.java file:

      package org.jboss.samples.webservices;

       

      import javax.jws.WebMethod;

      import javax.jws.WebService;

       

      @WebService()

      public class HelloWorld {

       

          @WebMethod()

          public String sayHello(String name) {

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

               return "Hello " + name + "!";

          }

      }

       

      All help is greatly appreciated!

       

      Thank You

        • 1. Re: Simple Web Services are NOT Working -- Please Help
          phanto

          Just a quick question I want to add:  Am I supposed to install anything on top of JBoss to provide Web Services support?  I downloaded JBoss 7.0.2 Final (Everything) from http://www.jboss.org/jbossas/downloads/

           

          I am also seeing some people talk about jbossws.  Is this required?  I am going to try to install it and see what happens...If I can figure out how to install it...

          • 2. Re: Simple Web Services are NOT Working -- Please Help
            phanto

            I finally got it working, but not for AS7.  I took a look at the jbossws plugin, and it is not yet compatible with JBoss AS 7.  So, I downloaded 5.1, and it installed.  I published the application, and it works!

             

            Surely JBoss AS7 supports JAX-WS web services...Right?

            1 of 1 people found this helpful
            • 3. Re: Simple Web Services are NOT Working -- Please Help
              shekh

              Well, today I have also faced exactly the same problem. But I can resolve this issue by starting the server in standalone mode with parameter as following:

               

              standalone.bat --server-config=standalone-preview.xml

               

              If you check the extentions in standalone.xml, which is under JBOSS_AS7/standalone/configuration you will found no webservice module to be loaded. Again, if you check standalone-preview.xml you will found webservice modules to load on server startup.

               

              So by running your server using the mentioned command you will have your web service working. Enjoy exploring

               

              - Shekh Morshed Akther