----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files.  Don't make us guess your problem!!!
----------------------------------------------------------------

Dear java/apache,
I have successfully intsalled Apache and JServ
on Windows 98.  I have the following problem
and I didn't understand the answer on the FAQ

I am using jdk1.2.2  jsdk2.0   apache_1_3_9_win32
and  Apache_JServ_1_0
I have a problem with a class that I created and
apache can't find it.
  What I think this all boils down to is that I need to put a
HTML.class file that I created somewhere where apache and/or apache
jserv
can find it, or I need to tell apache and/or apache jserv where to
find my HTML.class file.  I don't know how to do that.  Do I
put it in some directory, or do I modify some apache configuration file?

What am I doing wrong?


I have an html form located in the directory

C:\Program Files\Apache Group\Apache\htdocs

My form has the following tag for invoking a new webpage when
the submit button is pressed

<FORM ACTION="http://localhost:80/servlets/HelloWorld" METHOD="POST">

When I hit the submit button on my form I go and try to invoke the java
servlet
 ( HelloWorld.class)

http://localhost:80/servlets/HelloWorld

and the following is showing on my browser ( Netscape ) :

---------------------------------------------------------------------


Internal Server Error

The server encountered an internal error or misconfiguration and was
unable to complete your
request.

Please contact the server administrator, [EMAIL PROTECTED] and inform
them of the time the
error
occurred, and anything you might have done that may have caused the
error.

More information about this error may be available in the server error
log.


Apache/1.3.9 Server at http://localhost Port 80




------------------------------------------------------------------

and the following is what shows up in my server error log,
i.e. the file error.log located in the directory

C:\Program Files\Apache Group\Apache\logs

and seems to indicate that my HTML.class file, which is also a
servlet, can't be found
( I have a class file named HTML.class )

--------------------------------------------------------------------


defaults=Changed to default settings.

# ConsolePanel properties

string.loading=Loading console, please wait....
string.problem=Cannot load this console

# 0: the invalid class name
error.notfound.format=Configuration problem: Cannot find console Class
{0}
error.noclass=Configuration problem: Console has no class specified.

# 0 The  class name
# 1 The exception message
error.create=Configuration problem: Cannot create {0}: {1}
# 0 The  class name
# 1 The exception message
error.access=Configuration problem: Cannot use console {0}: {1}

dialog.noconsole.title=Configuration Problem

# EndpointTuning properties

slider.units.threads=threads
slider.units.connections=connections
slider.units.seconds=seconds
slider.capacity.label=Capacity:
slider.minthreads.label=Minimum:
slider.maxthreads.label=Maximum:
slider.handlers.label=Maximum:
slider.timeout.label=Timeout:
slider.invalid_threads=Minimum number of threads must be less than or
equal to the maximum
number of threads.

# GridApplet properties


# LogDetail properties

name.label=Log Name:
description.label=Description:
which.label=Which Messages:
logto.label=Log To:

choices.destination.roll=Rolling File
choices.destination.file=Single File
choices.destination.socket=Socket
choices.destination.output=Standard Output
choices.destination.error=Standard Error
choices.destination.class=Special Class File

serverNameEnabled.label=Log Virtual Host Name:
serverNameEnabled.enabled.label= Enabled
serverNameEnabled.disabled.label= Disabled

class.label=Class File:
file.label=File Name:
rollover.size.label=Rollover File Size:
rollover.unit=KB
buffer.size.label=Buffer Size:

stderr.label=Logging is being written to Error Output
stdout.label=Logging is being written to Standard Output

socket.host.label=Socket Host:
socket.port.label=Socket Port:

# PollingPanel properties

poll.button.start=Start View
poll.button.restart=Restart View
poll.button.stop=Stop View

poll.update.label=Update Interval:
poll.nextupdate.label=Next Update:

# PropertyFileEditor resources

table.property.label=Property
table.value.label=Value

dialog.missingfile.title=Missing File
dialog.missingfile.text=Configuration Problem: No property file
specified for editing.

# RetryPoller properties

retry.interval.label=Retry Interval:
retry.next.label=Next Retry:

# 0: the date of the retry
retry.message={0} Retrying...

# 0: connection's target host
# 1: connection's target port
retry.connectto=Connect to {0}:{1}

# SectionsPanel properties

# 0 List of applicable choices
cantleave.label=Click on one of the {0} items.

# ServicePanel properties

button.manage=Manage
button.shutdown=Shut Down

# 0: the target host
dialog.shutdown.title=Shut Down All Servers
java.lang.NoClassDefFoundError: com/wrox/util/HTML
 at
org.apache.jserv.JServConnection.processRequest(JServConnection.java,
Compiled Code)

 at org.apache.jserv.JServConnection.run(JServConnection.java, Compiled
Code)
 at java.lang.Thread.run(Thread.java:479)



-------------------------------------------------------------------


Well, my java servlet source code follows, and everything ran
smoothly until I added the lines that are in bold
and these added lines are the ones dealing with a class that
I defined called HTML.class located in a package com.wrox.util
The fully qualified path name to my HTML.class file is

C:\WINDOWS.000\Desktop\JavaClasses\com\wrox\util\HTML.class


----------------------------------------------------------------------

//Import Servlet Libraries
import javax.servlet.*;
import javax.servlet.http.*;

//Import Java Libraries
import java.io.*;
import java.util.*;

import com.wrox.util.*;                   //Problem Line

public class HelloWorld extends HttpServlet
{

   String message, msgFrom, msgTo, msgSubject;

   public void doPost(HttpServletRequest req, HttpServletResponse res)
      throws ServletException, IOException
   {

      res.setContentType("text/html");
      PrintWriter out = res.getWriter();
    getParameters(req);

      out.println("<HTML>");
      out.println("<HEAD>");
      out.println("<TITLE>Hello World Sample Servlet</TITLE>");
      out.println("</HEAD>");
      out.println("<BODY>");
      out.println("<CENTER><H1>Hello World!</H1></CENTER>");


      //Send acknowledgment to the browser
      HTML h = new HTML("XYZ Corporation IT Department");
      h.add(HTML.HEADING, "Your request has been submitted", false);
      out.println(h.getPage());


   out.println(message);

      out.println("</BODY>");
      out.println("</HTML>");
      out.close();
   }

  private void getParameters(HttpServletRequest req)
                 throws ServletException, IOException
  {
    StringBuffer tempStringBuffer = new StringBuffer(1024);

    msgSubject = "Tech Suppoer Request";
    msgTo = "[EMAIL PROTECTED]";

    msgFrom = req.getParameter("txtEmail");

    tempStringBuffer.append("From: ");
    tempStringBuffer.append(req.getParameter("txtFirst"));
    tempStringBuffer.append(" ");
    tempStringBuffer.append(req.getParameter("txtLast"));
    tempStringBuffer.append("\n");
    tempStringBuffer.append("Phone: ");
    tempStringBuffer.append(req.getParameter("txtPhone"));
    tempStringBuffer.append("\n");
    tempStringBuffer.append("Email: ");
    tempStringBuffer.append(req.getParameter("txtEmail"));
    tempStringBuffer.append("\n\n");
    tempStringBuffer.append("Software: ");
    tempStringBuffer.append(req.getParameter("ddlb_software"));
    tempStringBuffer.append("\n");
    tempStringBuffer.append("OS: ");
    tempStringBuffer.append(req.getParameter("ddlb_os:="));
    tempStringBuffer.append("\n\n");
    tempStringBuffer.append("Problem: ");
    tempStringBuffer.append(req.getParameter("txtProblem"));
    tempStringBuffer.append("\n");

    message = tempStringBuffer.toString();
  }
}



-----------------------------------------------------------------------------

The source code to my HTML.class file is as follows
and recall that it is located in a package com.wrox.util
The fully qualified path name to my HTML.class file is

C:\WINDOWS.000\Desktop\JavaClasses\com\wrox\util\HTML.class



------------------------------------------------------------------------------





package com.wrox.util;

public class HTML
{
  public static final int NORMAL    = 0;
  public static final int HEADING   = 1;
  public static final int LINE      = 2;

  public StringBuffer buffer;

  public HTML(String title)
  {
    buffer = new StringBuffer(4096);
    this.buffer.append("<HTML><HEAD><TITLE>");
    this.buffer.append(title);
    this.buffer.append("</TITLE></HEAD><BODY>");
  }

  public void add(int style, String text, boolean linebreak)
  {
    switch(style)
    {
      case NORMAL:
        this.buffer.append(text);
        break;
      case HEADING:
        this.buffer.append("<H1>");
        this.buffer.append(text);
        this.buffer.append("</H1>");
        break;
      case LINE:
        this.buffer.append("<HR>");
        break;
      default:
        break;
    }
    if(linebreak)
    {
      buffer.append("<BR>");
    }
  }

  public String getPage()
  {
    this.buffer.append("</BODY></HTML>");
    return this.buffer.toString();
  }
}



------------------------------------------------------------------------





I have attached the techsupp.html file that invokes my HelloWorld.class
servlet, and I have attached the source code and class files
for HelloWorld and HTML, and I have attached my error.log file.

So, what I think this all boils down to is that I need to put the
HTML.class file that I created somewhere where apache and/or apache
jserv
can find it, or I need to tell apache and/or apache jserv where to
find my HTML.class file.  I don't know how to do that.  Do I
put it in some directory, or do I modify some apache configuration file?

If that is not what is wrong then what am I doing wrong?


Sincerely,

Victor Soich






--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html>
Problems?:           [EMAIL PROTECTED]

Reply via email to