chelakkad ben

Ranch Hand
+ Follow
since Feb 09, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by chelakkad ben

Hello

'Why do you insist upon making it harder than it needs to be?'

Sorry. Not intentionally. New to servlets.
Wont repeat,once i learn them.

Changed to what you said...
<web-app>
<servlet>
<servlet-name>Hello</servlet-name>
<servlet-class>Hello</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Hello</servlet-name>
<url-pattern>/Hello</url-pattern>
</servlet-mapping>
</web-app>
and the index.html with
<a href="/testservlet/Hello">Execute</a>

But still the error remains
HTTP Status 500
exception
javax.servlet.ServletException: Class Hello is not a Servlet
Any changes needed in conf/web.xml?
rgds
17 years ago
Hi
Its all a bit confusing!! I have changed the class name to Hello. So will this do?

<web-app>
<servlet>
<servlet-name>Hello</servlet-name>
<servlet-class>Hello</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>Hello</servlet-name>
<url-pattern>/testservlet/Hello</url-pattern>
</servlet-mapping>
</web-app>

and the index.html in webapps/testservlet/ folder
<a href="/testservlet/Hello">Execute</a> ?

rgds
17 years ago
Hello Dittmer,

In that case why is www.knobe.org:8080/servlets-examples working?

My app name is testservlet. This folder is in webapps. So the mapping in web.xml should be...

<web-app>
<servlet>
<servlet-name>testservlet</servlet-name>
<servlet-class>testservlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>testservlet</servlet-name>
<url-pattern>/testservlet/testservlet</url-pattern>
</servlet-mapping>
</web-app>

Is that correct? The second 'testservlet' in the url-pattern being the class file. And the index.html in webapps/testservlet/ should have
<a href="testservlet/testservlet">Execute</a> . Right?

rgds
17 years ago
Hello
Any one got the solution?
17 years ago
Hi Prabhu,
No need. The servlets-examples is working perfectly! Its /servlet/.. there.
ie. http://www.knobe.org:8080/servlets-examples/servlet/HelloWorldExample
works fine.
rgds
17 years ago
Rahul,
I tried what you said. Changed to 'myApp' in web.xml and index.html.
but getting the same HTTP - 500 error
rgds
17 years ago
Hello Rahul,
Now what is 'myApp'?
you mean <a href="testservlet/testservlet">Execute</a> or what?
i dont get it. pl clarify.
rgds
17 years ago
Hello Ben,

Deleted the old class file, recompiled and restarted Tomcat. But still the same error is displayed...

HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.

exception
javax.servlet.ServletException: Class testservlet is not a Servlet
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Unknown Source)


root cause

java.lang.ClassCastException: testservlet
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool

Is there any prob with the configuration, i wonder?
rgds
csb
17 years ago
Hello,
Can someone pl tell me why this servlet is not being called?


"Hello world " Servlet
----------------------


Deployment Descriptor
---------------------

testservlet folder in webapps/

testservlet.class is in webapps/testservlet/WEB-INF/classes

index.html is in webapps/testservlet/ folder

The deployment descriptor web.xml is in folder webapps/testservlet/WEB-INF/

index.html
----------

Now when i click on the 'Execute ' link on this page
http://www.knobe.org:8080/testservlet/
i get the error

HTTP - 500
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Class testservlet is not a Servlet
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Unknown Source)


root cause

java.lang.ClassCastException: testservlet
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Unknown Source)

Subsequent requests generates the error..

HTTP Status 404 - Servlet testservlet is not available

type Status report

message Servlet testservlet is not available

description The requested resource (Servlet testservlet is not available) is not available.



At the same time the servlets-examples are working fine..ie if i click on the 'Execute' link on this index page, the example works.

http://www.knobe.org:8080/servlets-examples/

rgds
ben

[ December 16, 2006: Message edited by: chelakkad ben ]
[BSouther: Added UBB Code Tags]
[ December 16, 2006: Message edited by: Ben Souther ]
17 years ago
Hello
Is is necessary to put them in a package?
Even otherwise it has to work. In fact it worked once - the first time after installation.
rgds
17 years ago
Hello Ben,

Tried www.knobe.org:8080/testservlet/servlet/testservlet.
The first time after restarting Tomcat, i got this error

HTTP Status 500 -
type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Class testservlet is not a Servlet
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.connector.CoyoteAdapter.service
......
......
root cause

java.lang.ClassCastException: testservlet
org.apache.catalina.valves.ErrorReportValve.invoke
.....
.....

Second time onwards it is 404 error

HTTP Status 404 - Servlet testservlet is not available

type Status report

message Servlet testservlet is not available

description The requested resource (Servlet testservlet is not available) is not available.

rgds
17 years ago
Hello Ben,

The deployment descriptor in folder webapps\testservlet\WEB-INF
----------------------------------------------------------------

<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>testservlet</servlet-name>
<servlet-class>testservlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>testservlet</servlet-name>
<url-pattern>/servlet/testservlet</url-pattern>
</servlet-mapping>
</web-app>

The class file - testservlet.class , is in folder webapps\testservlet\WEB-INF\classes
---------------------------------------------------------------------------

Apache httpd is having the following entry...
--------------------------------------------

LoadModule jk_module modules/mod_jk.so

<IfModule mod_jk.c>

JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel error
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat "%w %V %T"

Alias /jsp-examples "D:/ApacheSoftwareFoundation/Tomcat5.5/webapps/jsp-examples/"

<Directory "D:/ApacheSoftwareFoundation/Tomcat5.5/webapps/jsp-examples/">
Options Indexes +FollowSymLinks
AllowOverride None
Allow from all
</Directory>

Alias /servlets-examples "D:/ApacheSoftwareFoundation/Tomcat5.5/webapps/servlets-examples/"

<Directory "D:/ApacheSoftwareFoundation/Tomcat5.5/webapps/servlets-examples/">
Options Indexes +FollowSymLinks
AllowOverride None
Allow from all
</Directory>


<Location /*/WEB-INF/*>
AllowOverride None
deny from all
</Location>

JkMount /jsp-examples/*.jsp example
JkMount /servlets-examples/* example
JkMount /testservlet/* example

</IfModule>

The mod_jk modules is in modules folder
---------------------------------------
D:\ApacheSoftwareFoundation\Apache2.2\modules


'Apache/2.2.3(Win32)mod_jk/1.2.19' is displayed in the status bar of the
Apache Service Monitor screen.

The following worked fine...
----------------------------
Published site knobe.org
http://www.knobe.org - the default page obtained
http://www.knobe.org:8080 - the default Tomcat page displayed
http://www.knobe.org/jsp-examples/ - defauls JSP examples page displayed
http://www.knobe.org/servlets-examples/ - displays default servlets examples page.Able to run the examples links in that page(eg. HelloWorld,functions ...etc)

and now this brings in the error...
-------------------------------
http://www.knobe.org/html/test.html - the page displayed with a submit button. POST to
action="http://www.knobe.org/testservlet/servlet/testservlet"
On clicking on the button the above mentioned error is displayed.

I hope it is now clear.
[ November 14, 2006: Message edited by: chelakkad ben ]
17 years ago
Hello,
Has anyone got any clue on this?

I wonder what's wrong with this servlet...


import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class testservlet extends HttpServlet{

public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException{
PrintWriter out;

resp.setContentType("text/html");
out = resp.getWriter();

out.println("<h1>Hello World</h1>");
}
}

because i still keep getting the error...

type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.

exception
javax.servlet.ServletException: Class testservlet is not a Servlet
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter

is NOT a servlet!
Help!!
rgds
17 years ago
Hello
Even a simple 'Hello world' servlet is giving the 500 error.
Can someone help?
gthri
17 years ago
Any modification needed in conf/httpd file?
gthri
[ November 01, 2006: Message edited by: chelakkad ben ]
17 years ago