-
1. cannot be cast to javax.servlet.Servlet
pkondaka1 Apr 15, 2011 5:24 PM (in response to pkondaka1)Sorry. I am using Jboss-6.0.0 with jdk-1.6
-
2. cannot be cast to javax.servlet.Servlet
peterj Apr 15, 2011 5:33 PM (in response to pkondaka1)How is the compiler plugin defined in your pom.xml? By default, Maven compiles everything for 1.4 (or ws it 1.3?), unless you tell it otherwise, regardless of which JDK version you are using.
-
3. cannot be cast to javax.servlet.Servlet
pkondaka1 Apr 15, 2011 6:06 PM (in response to peterj)<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
-
4. cannot be cast to javax.servlet.Servlet
peterj Apr 15, 2011 6:12 PM (in response to pkondaka1)How are you accessing the web service?
-
5. cannot be cast to javax.servlet.Servlet
pkondaka1 Apr 15, 2011 6:18 PM (in response to peterj)It is failing while deploying. ClassCastException. Reason being i am casting my POJO object to Servlet in web.xml
Am i missing anything?
-
6. cannot be cast to javax.servlet.Servlet
pkondaka1 Apr 15, 2011 6:36 PM (in response to pkondaka1)Now i am getting following error while accessing the url. deployment was fine.
I am accessing via https https://localhosthttps://localhost:9:9443/myapp
Allocate exception for servlet TestService: java.lang.ClassCastException: xxx.xxxx.xxxx.MyBean cannot be cast to javax.servlet.Servlet
-
7. cannot be cast to javax.servlet.Servlet
peterj Apr 16, 2011 5:05 PM (in response to pkondaka1)Where did MyBean come from? The original post stated the clas was named Hello.
I don't see anything wrong in what you posted, so there must be something you are leaving out. Please zip up your project directory and post it.
-
8. cannot be cast to javax.servlet.Servlet
pkondaka1 Apr 18, 2011 1:49 PM (in response to peterj)Sorry for the typo. here are the files for review
Hello.java - these class files are jarred up in my _logic.jar
package com.cg.webservice;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;@WebService(name="Hello")
@SOAPBinding(style=SOAPBinding.Style.DOCUMENT, use=SOAPBinding.Use.LITERAL, parameterStyle=SOAPBinding.ParameterStyle.WRAPPED)
public class Hello
{
@WebMethod
public String sayHello(String name)
{
return "Hello " + name + " from the web service.";
}
}web.xml - under my _war.war file and WAR file includes _logic.jar in WEB-INF\lib
<?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_2_5.xsd"
id="WebApp_ID" version="2.5">
<servlet>
<servlet-name>HelloService</servlet-name>
<servlet-class>com.cg.webservice.Hello</servlet-class>
</servlet><servlet-mapping>
<servlet-name>HelloService</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app> -
9. cannot be cast to javax.servlet.Servlet
pkondaka1 Apr 18, 2011 2:02 PM (in response to pkondaka1)This is actual error message. Am i missing any jar files in jboss classpath? any dependencies missing? Please help me
13:58:32,946 INFO [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/2gdb]] Marking servlet HelloService as unavailable
13:58:32,946 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/2gdb].[TestService]] Allocate exception for servlet HelloService: java.lang.ClassCastException: com.cg.webservice.Hello cannot be cast to javax.servlet.Servlet
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1162) [:6.0.0.Final]
-
10. cannot be cast to javax.servlet.Servlet
peterj Apr 18, 2011 2:28 PM (in response to pkondaka1)There are only two things you are doing differently from me:
a) I placed my classes into WEB-INF/classes (I did not create a JAR)
b) My url-pattern in web.xml contains a context name, such as "/hello", not '/*'
Of the 2, I suspect that "b" is the problem.