----------------------------------------------------------------
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!!!
----------------------------------------------------------------

Hello,
    I tried synchronizing the mathods in Servlet itself as my DLL is not
multithreaded. But with this did not solve my problem.
I am giving the code below.
Initially at the server the System.out of my code results in printing,

before dll
After dll
Postmethos

This is first time when i execute the servlet successfully. The next time it is

before dll
After dll

and the server crashes.

Here is the code:


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

public class screenServlet extends HttpServlet
{
     String  CompanyName = "";
  String  Representative = "";
  String  EmailId = "";
  String  ContactPhone = "";
  String  Address = "";
  String  Registration = "";
  String  Version = "";
     String  Criticality = "";
  String  BoughtFrom = "";
  String  Product = "";
  String  ModelDetails = "";
  String  Frequency = "";
  String  Type = "";
  String  MoreInfo = "";

  String  project = "" ;
  String  userid = "" ;
  String  description = "" ;
  String  criticality = "" ;
  String  phase = "" ;
  String  version = "" ;
  String  type = "" ;
  String  detail_desc = "" ;

   public native int accessFields();
//   static native int accessFields();

   public void init (ServletConfig config)
   throws ServletException
   {
      super.init(config) ;
   }

 /*  static {
          System.loadLibrary("DllSpots");
   }
*/
   public void doGet(HttpServletRequest request, HttpServletResponse response)
   throws ServletException , IOException
   {
          doPost(request, response) ;
   }

   public  void doPost(HttpServletRequest request, HttpServletResponse response)

   throws ServletException , IOException
   {


  System.out.println("before dll");
 //static {
          System.loadLibrary("DllSpots");
 //  }

  System.out.println("After dll");
     response.setContentType("text/html") ;
     PrintWriter out=response.getWriter();

  CompanyName = request.getParameter ("txtCompanyName");
  Representative = request.getParameter ("txtRepresentative");
  EmailId = request.getParameter ("txtEmailId");
  ContactPhone = request.getParameter ("txtContactPhone");
  Address = request.getParameter ("taAddress");
  Registration = request.getParameter ("txtRegistration");
  Version = request.getParameter ("cbVersion");
  Criticality = request.getParameter ("cbCriticality");
  BoughtFrom = request.getParameter ("cbBoughtFrom");
  Product = request.getParameter ("cbProduct");
  ModelDetails = request.getParameter ("txtModelDetails");
  Frequency = request.getParameter ("cbFrequency");
  Type = request.getParameter ("cbType");
  MoreInfo = request.getParameter ("taMoreInformation");

  project = "testspots" ;
  userid = "rajani" ;
  description = Representative + " of " +CompanyName ;
  criticality = Criticality;
  phase = Frequency ;
  version = Version ;
  type = BoughtFrom ;
  detail_desc = "Email Id : "+EmailId+
      "\n\nContact Phone : " +ContactPhone+
     "\n\nAddress : "+Address+
     "\n\nRegistration : "+Registration+
     "\n\nModel Details : "+ModelDetails+
     "\n\nMore Info : "+MoreInfo;

  int returnValue = accessFields ();

  System.out.println("Post methos");
     out.println("<html>") ;
     out.println("<body>") ;
     out.println("<script language=javascript>");
  out.println("alert ("+returnValue+")");
  if (returnValue != -1) {
      out.println("alert (\"Report Number : "+returnValue+" !\")") ;
  // out.println("project =
"+project+"userid="+userid+"description="+description+"type="+type+
  //
"detail_desc="+detail_desc+"criticality="+criticality+"phase="+phase+"version="+version);


  }
  else {
         out.println("alert (\"Report could not be submitted !\")") ;
     }
  out.println("WINDOW.history.back()");
     out.println("</script>") ;
     out.close() ;
   }

   public  String getServletInfo()
   {
      return "Server side code" ;
   }
}


Can u suggest me something with this??

Regards,
Rajani

Jon Smirl wrote:

> ----------------------------------------------------------------
> 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!!!
> ----------------------------------------------------------------
>
> You can synchronize in the server or the DLL. You don't have to synchronize,
> if your DLL is truly multithreaded you don't need to synchronize.
>
> Here's another problem you may have. When the servlet is loaded the first
> time, static variables are initialized. The second time you call it these
> static variables are not reinitialized and cause your GPF. Not
> reinitializing is the way DLL's are suppose to work.
>
> A debugger is really necessary in order to sort these problems out. If you
> are running a debugger it will show you the line of code and variable
> causing the problem.
>
> Jon Smirl
> [EMAIL PROTECTED]
>
> --
> --------------------------------------------------------------
> 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]



--
--------------------------------------------------------------
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