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

From: Anonymous <Nobody>
Date: Thu, 6 Mar 2003 13:35:18 -0600
Message-ID: <3e67a310$1_at_giga.realtime.net>


"Dave" <shoad316_at_hotmail.com> wrote in message news:78cf0572.0303052233.1402d95_at_posting.google.com...
> 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

Which version of Tomcat? Have you done any configuration of Tomcat - for example in web.xml? Have you looked at the Tomcat logs? If this was my problem I would put System.out print statements in the init method - to make sure the servlet was even getting loaded, and in the doPost to see if the request is getting through. WBB -----------== Posted via Newsfeed.Com - Uncensored Usenet News ==----------

   http://www.newsfeed.com The #1 Newsgroup Service in the World! -----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =----- Received on Thu Mar 06 2003 - 20:35:18 CET

Original text of this message