Results 1 to 10 of 10
  1. #1
    nyerunkar is offline Member
    Join Date
    Jun 2011
    Location
    india
    Posts
    6
    Rep Power
    0

    Default Run Servlet On IIS

    Hello Friends,

    I made servlet for database connection..
    Its working fine on Tomat & IIS Also.

    but when i try to send data from Servlet to my J2ME platform it is not sending ...
    I'm unable to find where is problem..

    Need Help

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    18

    Default

    What do you mean by "sending data"?
    Are you getting any errors?
    Is your J2ME client calling the servlet (how?) then the servlet gets data from the db and returns that data in some way back to the client?

    In other words, you have not provided anywhere near enough information.

  3. #3
    nyerunkar is offline Member
    Join Date
    Jun 2011
    Location
    india
    Posts
    6
    Rep Power
    0

    Default

    i'm using DataOutput & Datainput stream for send data between servlet & j2me......
    but on j2me side i'm getting error .."java.io.IOException: Error in HTTP operation"

    but when i'm using Tomcat server that case work properly.....

    so i'm not getting where is actual problem either servlet or j2me.......

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    18

    Default

    Why are you using a DataOutputStream?
    You might need to show us some code from the servlet, because it looks like you're not sending the correct stuff.

  5. #5
    nyerunkar is offline Member
    Join Date
    Jun 2011
    Location
    india
    Posts
    6
    Rep Power
    0

    Default

    Quote Originally Posted by Tolls View Post
    Why are you using a DataOutputStream?
    You might need to show us some code from the servlet, because it looks like you're not sending the correct stuff.
    in servlet :-

    protected void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
    {
    // processRequest(request, response);
    DataInputStream INPUT_STREAM = new DataInputStream(request.getInputStream());
    String sText = " "+INPUT_STREAM.readUTF();
    INPUT_STREAM.close();
    DataOutputStream OUTPUT_STREAM = new DataOutputStream(response.getOutputStream());
    OUTPUT_STREAM.writeUTF(sText);
    OUTPUT_STREAM.flush();
    OUTPUT_STREAM.close();
    }

    in J2ME:---------------------------------

    private void da()
    {
    HttpConnection connection = null;
    DataInputStream dataInputStream = null;
    DataOutputStream dataOutputStream = null;

    try
    {
    connection=(HttpConnection) Connector.open("http://localhost:8084/TestServlet/Test/",Connector.READ_WRITE,false);
    connection.setRequestProperty("User-Agent", "Profile/MIDP-2.0, Configuration/CLDC-1.1");
    connection.setRequestProperty("Content-Language", "en-US");
    connection.setRequestMethod(HttpConnection.POST);
    dataOutputStream = connection.openDataOutputStream();
    dataOutputStream.writeUTF("asasaasas");
    // dataOutputStream.flush();
    dataOutputStream.close();

    dataInputStream = connection.openDataInputStream();
    dataInputStream.close();
    connection.close();

    }
    catch(Exception e)
    {
    System.out.println("Error In Collect : "+e);
    }
    }

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    18

    Default

    In your catch block do a stack trace.
    That should tell you where it's being thrown from.

  7. #7
    nyerunkar is offline Member
    Join Date
    Jun 2011
    Location
    india
    Posts
    6
    Rep Power
    0

    Default

    getting same error

  8. #8
    nyerunkar is offline Member
    Join Date
    Jun 2011
    Location
    india
    Posts
    6
    Rep Power
    0

    Default

    javax.microedition.io.ConnectionNotFoundException: Could not resolve hostname

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,450
    Rep Power
    18

    Default

    That's not the same error.
    And now you know why it's not working...it couldn't find the host.

    Also, one of the reasons for doing the stack trace was to identify where the exception was happening.
    Part of debugging is to locate where a problem happens...so on a forum like this we expect to be told not just what exception, but where exactly it was thrown.

  10. #10
    nyerunkar is offline Member
    Join Date
    Jun 2011
    Location
    india
    Posts
    6
    Rep Power
    0

Similar Threads

  1. how can i link html+servlet+xml to form servlet
    By balachandarr in forum Java Servlet
    Replies: 0
    Last Post: 04-15-2009, 04:06 PM
  2. Servlet to Servlet connection through URLConnection
    By bsrjavaforum in forum Networking
    Replies: 0
    Last Post: 04-01-2009, 04:12 PM
  3. Replies: 1
    Last Post: 12-02-2008, 12:23 AM
  4. Replies: 0
    Last Post: 08-30-2008, 11:52 AM
  5. Replies: 1
    Last Post: 08-07-2007, 03:47 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •