[jboss-user] [Beginner's Corner] - Simple Web Services are NOT Working -- Please Help
phanto
do-not-reply at jboss.com
Wed Oct 5 09:46:10 EDT 2011
phanto [http://community.jboss.org/people/phanto] created the discussion
"Simple Web Services are NOT Working -- Please Help"
To view the discussion, visit: http://community.jboss.org/message/630226#630226
--------------------------------------------------------------
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/docs/DOC-15778 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
--------------------------------------------------------------
Reply to this message by going to Community
[http://community.jboss.org/message/630226#630226]
Start a new discussion in Beginner's Corner at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20111005/e497c265/attachment-0001.html
More information about the jboss-user
mailing list