500 Internal Server Error


Hi,

I am trying to read in a file with objects I serialized previously.

The error message and the source code was included.

I tested the program out side a Web server environment, Java WebServer
2.0, and it worked fine. I dont' see whatsoever what the problem could
be.

Thanks


----------------------   ERROR MESSAGE  --------------------------------

The servlet named invoker at the requested URL

     http://localhost:8080/servlet/Params00

reported this exception: PgParams. Please report this to the
administrator of the web server.

     java.lang.IllegalAccessError: PgParams
     at Params00.init(Compiled Code)
     at com.sun.server.ServletState.callInit(ServletState.java:194)
     at
com.sun.server.ServletManager.loadServlet(ServletManager.java:720)
     at
com.sun.server.ServletManager.loadServlet(ServletManager.java:606)
     at
com.sun.server.ServletManager.getAndLoadServletState(CompiledCode)
     at com.sun.server.ServletManager.getAndLoadServletState(Compiled
Code)
     at com.sun.server.ServletManager.callServletService(Compiled Code)
     at com.sun.server.http.servlet.InvokerServlet.service(Compiled
Code)
     at javax.servlet.http.HttpServlet.service(Compiled Code)
     at com.sun.server.ServletState.callService(Compiled Code)
     at com.sun.server.ServletManager.callServletService(Compiled Code)
     at com.sun.server.ProcessingState.invokeTargetServlet(Compiled
Code)
     at com.sun.server.http.HttpProcessingState.execute(Compiled Code)
     at com.sun.server.http.stages.Runner.process(Compiled Code)
     at com.sun.server.ProcessingSupport.process(Compiled Code)
     at com.sun.server.Service.process(Compiled Code)
     at com.sun.server.http.HttpServiceHandler.handleRequest(Compiled
Code)
     at
com.sun.server.http.HttpServiceHandler.handleRequest(CompiledCode)
     at com.sun.server.HandlerThread.run(Compiled Code)


-------------   CODE FOR SERIALIZING OBJECTS --------------------------
/* Context Page for JRFDB.SCHOLAR */

import java.io.*;
import java.util.*;

public class PgParamsSer00{
 public static final int itTtlTgParams = 4;
 public static final String azSecDir = "";
 public static final String azCtxtPgFlNm = "Pg_Name_ParamsCtxt.bin"; //
ParametersContext file

 public static void main(String[] azArgs){
  String azFlNm = azSecDir + azCtxtPgFlNm;
  serObj(azFlNm);
 }

// --
 static void serObj(String azFlNm){
  PgParams[] PgPrm = new PgParams[itTtlTgParams];

// -- Constructing Objects

  PgPrm[0] =  new PgParams("Param00","scholar_id", 0, false);
  PgPrm[1] =  new PgParams("Param02","prefix", 1, false);
  PgPrm[2] =  new PgParams("Param04","first_name", 2, false);
  PgPrm[3] =  new PgParams("Param06","middle_initial", 3, false);

// -- Serializing Objects (Saving them to a file)
  ObjectOutputStream OOStrm = null;
  try{
   File PgCtxtFl = new File(azFlNm);
   FileOutputStream FlOStrm = new FileOutputStream(PgCtxtFl);
   OOStrm = new ObjectOutputStream(FlOStrm);

   for(int itJ = 0; itJ < itTtlTgParams; ++itJ){
    OOStrm.writeObject(PgPrm[itJ].azParam);
    OOStrm.writeObject(PgPrm[itJ].azDBFld);
    OOStrm.writeInt(PgPrm[itJ].itIxParam);
    OOStrm.writeBoolean(PgPrm[itJ].blnChckd);
   } // < --
   if(OOStrm != null){ OOStrm.flush();  OOStrm.close(); }
  } catch (IOException IOXcptn){ IOXcptn.printStackTrace(); }

//  for(int itJ = 0; itJ < itTtlTgParams; ++itJ){
System.out.println(PgPrm[itJ].toString()); }

 }
}

class PgParams implements Serializable{
 String azParam;
 String azDBFld;
 int itIxParam;
 boolean blnChckd;
 public PgParams(String azParam, String azDBFld, int itIxParam, boolean
blnChckd){
  this.azParam = azParam;  this.azDBFld = azDBFld;  this.itIxParam =
itIxParam;  this.blnChckd = blnChckd;
 }
 public PgParams(ObjectInputStream OIStrm){
  try{
   this.azParam = (String)OIStrm.readObject();
   this.azDBFld = (String)OIStrm.readObject();
   this.itIxParam = OIStrm.readInt();
   this.blnChckd = OIStrm.readBoolean();
  } catch(OptionalDataException OptnlDtXcptn){
OptnlDtXcptn.printStackTrace(); }
     catch (ClassNotFoundException KlsNotFndXcptn){
KlsNotFndXcptn.printStackTrace(); }
      catch (IOException IOXcptn){ IOXcptn.printStackTrace(); }

 }

 public String toString(){
  String azS = "";
  azS = this.azParam + "|" + this.azDBFld + "|" + this.itIxParam + "|" +
this.blnChckd;
  return azS;
 }
}

-------------   SERVLET CODE   --------------------------------

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

public class Params00 extends HttpServlet{

 public static final int itTtlTgParams = 47;
 public static final String azSecDir = "";
 public static final String azCtxtPgFlNm = "Pg_Name_ParamsCtxt.bin"; //
ParametersContext file


 public void init(ServletConfig config) throws ServletException{
  String azFlNm = azSecDir + azCtxtPgFlNm;

  PgParams[] PgPrm = new PgParams[itTtlTgParams];

// -- Reconstructing Objects from File
  ObjectInputStream OIStrm = null;
  try{
   File PgCtxtFl = new File(azFlNm);
   FileInputStream FIStrm = new FileInputStream(PgCtxtFl);
   OIStrm  = new ObjectInputStream(FIStrm);

   for(int itJ = 0; itJ < itTtlTgParams; ++itJ){ PgPrm[itJ] =  new
PgParams(OIStrm); }

//   for(int itJ = 0; itJ < itTtlTgParams; ++itJ){
System.out.println(PgPrm[itJ].toString()); }

   if(OIStrm != null){ OIStrm.close(); }
  } catch (IOException IOXcptn){ IOXcptn.printStackTrace(); }

 }

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

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

  out.println("<HTML>");
  out.println(" <HEAD><TITLE>IntroAppletServlet00</TITLE></HEAD>");
  out.println(" <BODY>");
  out.println("  <APPLET CODE=IntroApplet00.class
CODEBASE=http://localhost:8080/ WIDTH=800 HEIGHT=200>");
  out.println("  </APPLET>");
  out.println(" </BODY>");
  out.println("</HTML>");
 }


}

class PgParams implements Serializable{
 String azParam;
 String azDBFld;
 int itIxParam;
 boolean blnChckd;
 public PgParams(String azParam, String azDBFld, int itIxParam, boolean
blnChckd){
  this.azParam = azParam;  this.azDBFld = azDBFld;  this.itIxParam =
itIxParam;  this.blnChckd = blnChckd;
 }
 public PgParams(ObjectInputStream OIStrm){
  try{
   this.azParam = (String)OIStrm.readObject();
   this.azDBFld = (String)OIStrm.readObject();
   this.itIxParam = OIStrm.readInt();
   this.blnChckd = OIStrm.readBoolean();
  } catch(OptionalDataException OptnlDtXcptn){
OptnlDtXcptn.printStackTrace(); }
     catch (ClassNotFoundException KlsNotFndXcptn){
KlsNotFndXcptn.printStackTrace(); }
      catch (IOException IOXcptn){ IOXcptn.printStackTrace(); }

 }

 public String toString(){
  String azS = "";
  azS = this.azParam + "|" + this.azDBFld + "|" + this.itIxParam + "|" +
this.blnChckd;
  return azS;
 }
}

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to