Results 1 to 10 of 10
Thread: Run Servlet On IIS
- 06-08-2011, 06:37 AM #1
Member
- Join Date
- Jun 2011
- Location
- india
- Posts
- 6
- Rep Power
- 0
- 06-08-2011, 09:53 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
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.
- 06-08-2011, 10:31 AM #3
Member
- Join Date
- Jun 2011
- Location
- india
- Posts
- 6
- Rep Power
- 0
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.......
- 06-08-2011, 10:50 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
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.
- 06-08-2011, 10:53 AM #5
Member
- Join Date
- Jun 2011
- Location
- india
- Posts
- 6
- Rep Power
- 0
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);
}
}
- 06-08-2011, 11:18 AM #6
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
In your catch block do a stack trace.
That should tell you where it's being thrown from.
- 06-08-2011, 12:02 PM #7
Member
- Join Date
- Jun 2011
- Location
- india
- Posts
- 6
- Rep Power
- 0
getting same error
- 06-08-2011, 12:04 PM #8
Member
- Join Date
- Jun 2011
- Location
- india
- Posts
- 6
- Rep Power
- 0
javax.microedition.io.ConnectionNotFoundException: Could not resolve hostname
- 06-08-2011, 12:12 PM #9
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
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.
- 06-08-2011, 12:48 PM #10
Member
- Join Date
- Jun 2011
- Location
- india
- Posts
- 6
- Rep Power
- 0
Similar Threads
-
how can i link html+servlet+xml to form servlet
By balachandarr in forum Java ServletReplies: 0Last Post: 04-15-2009, 04:06 PM -
Servlet to Servlet connection through URLConnection
By bsrjavaforum in forum NetworkingReplies: 0Last Post: 04-01-2009, 04:12 PM -
Servlet - apache tomcat/glassfish server shuts down on servlet usage
By StewS in forum Java ServletReplies: 1Last Post: 12-02-2008, 12:23 AM -
Is there any way to transfer the file Streams from one servlet to another servlet .
By HenaPriyadarsini in forum Java ServletReplies: 0Last Post: 08-30-2008, 11:52 AM -
javax.servlet.ServletException: Wrapper cannot find servlet class util.t2
By osval in forum Advanced JavaReplies: 1Last Post: 08-07-2007, 03:47 PM


LinkBack URL
About LinkBacks


Bookmarks