× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--
[ Picked text/plain from multipart/alternative ]
I'm in the process of creating a java servlet on our AS400.  I've created an
introductory "Hello World" servlet to get my feet wet and it works. Both
this servlet and the one that doesn't work come from O'Reilly's Java Servlet
Programming book.   I'm not really worried about how our Apache server is
set up.  I'm using JDK version 1.2 in the ASF Tomcat settings.  All the
Hello World servlet does is create a web page when called.  My next step was
to create a form using the GET method and then use the servlet to display
the information gathered from the form.  The following is the information I
get when I try to run the servlet:


Error: 500


Location: /PVSW/test

Internal Servlet Error:
java.lang.ClassCastException
      org/apache/tomcat/core/ServletWrapper.loadServlet()V+54
(ServletWrapper.java:268)
      org/apache/tomcat/core/ServletWrapper.init()V+32
(ServletWrapper.java:289)

org/apache/tomcat/core/Handler.service(Lorg/apache/tomcat/core/Request;Lorg/
apache/tomcat/core/Response;)V+18 (Handler.java:254)

org/apache/tomcat/core/ServletWrapper.service(Lorg/apache/tomcat/core/Reques
t;Lorg/apache/tomcat/core/Response;)V+139 (ServletWrapper.java:372)

org/apache/tomcat/core/ContextManager.internalService(Lorg/apache/tomcat/cor
e/Request;Lorg/apache/tomcat/core/Response;)V+248 (ContextManager.java:806)

org/apache/tomcat/core/ContextManager.service(Lorg/apache/tomcat/core/Reques
t;Lorg/apache/tomcat/core/Response;)V+15 (ContextManager.java:752)

org/apache/tomcat/service/connector/JNIConnectionHandler.processConnection(J
J)V+249 (JNIConnectionHandler.java:186)
      org/apache/tomcat/service/JNIEndpoint.service(JJ)I+13
(JNIEndpoint.java:176)


Here is a copy of the code I'm using to gather the form information and
create the page:

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

public class Hello extends HttpServlet
{
            public void doGet(HttpServletRequest req, HttpServletResponse
res)
                        throws ServletException, IOException
            {
                        res.setContentType("text/html");
                        PrintWriter out = res.getWriter();

                        String name = req.getParameter("name");
                        out.println("<html>");
                        out.println("<head><title>Hello, " + name +
"</title></head>");
                        out.println("<body>");
                        out.println("Hello, " + name);
                        out.println("</body></html>");
            }

            public String getServletInfo()
            {
                        return "A servlet that knows the name of the person
to whom it's" +
                                    "saying hello";
            }
}

I've searched the web for the exception error that I'm receiving and it
really didn't help me out so I thought I'd try this forum to see if there is
anyone that can tell me why I can't get this second servlet to run.  The
only code I added to this sevlet to make it different from the first one is:

String name = req.getParameter("name");

and,

public String getServletInfo()
{
            return "A servlet that knows the name of the person to whom
it's" +
                        "saying hello";
}

I tried running this with and without the getServletInfo code and I get the
same results, so I don't think the problem lies there either.  Any
suggestion as to what I may be doing wrong would be appreciated.


Thanks,
Eric Bennion


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.