Applet/Servlet works fine in Jdeveloper, not when deployed to Tomcat

From: Dave <shoad316_at_hotmail.com>
Date: 5 Mar 2003 22:33:54 -0800
Message-ID: <78cf0572.0303052233.1402d95_at_posting.google.com>



[Quoted] Hey all, I have a real simple servlet that works withing Jdeveloper. An applet displays a button and when you click on the button it contacts the servlet and the servlet returns a string.. I put that string in a textarea widget.

 But if I create a deployment profile, deploy it to a jar file, put the jar file in the tomcat/webapps directory and start up tomcat it doesn't work. Applet works fine but the textarea widget doesn't get updated.

(Note: to get it to work in jdeveloper I have to change the port to 8992 but tomcat is running on 8080)

Here's a clip of the code that contacts the servlet:

   String protocol = "http";
 String host = "localhost";
 int port = 8080;

String urlSuffix = "/Applet1/servlet/";

    try {

       String loginServletURL = "my_package.TestServlet";
     
        URL dataURL = new URL(protocol, host, port, urlSuffix
+loginServletURL);
        URLConnection connection = dataURL.openConnection();
    
        connection.setDoOutput(true);
        connection.setUseCaches(false);
        connection.setDoInput(true);
        connection.setRequestProperty("Content-Type",
"application/x-java-serialized-object");
        
        ObjectInputStream in =  new
ObjectInputStream(connection.getInputStream());
        String test = (String) in.readObject();
        in.close();

        textArea.setText(test);



Here's the servlet main code:

  public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException   {

String test= "TEST MESSAGE";

           ObjectOutputStream out = new
ObjectOutputStream(response.getOutputStream());

            out.writeObject(test);
            out.flush();
            out.close();
  

  }

Like I said, this works fine in Jdeveloper. Its a pretty simple servlet.... I have created html pages that contact servlets without any issues. But for some reasons an applet is causing me a headache.

Any ideas?? Any other information you may need let me know. Need the rest of the code and I can send you the entire workspace.

Thanks Received on Thu Mar 06 2003 - 07:33:54 CET

Original text of this message