日期:2014-05-20  浏览次数:20821 次

求助:在做:J2ME 实现简单电子邮件发送功能 时,遇到的问题!
执行:http://localhost:8888/cs/MaileServlet时,出现错误如下:

message  

description   The   server   encountered   an   internal   error   ()   that   prevented   it   from   fulfilling   this   request.

exception  

java.io.EOFException
java.io.DataInputStream.readUnsignedShort(DataInputStream.java:310)
java.io.DataInputStream.readUTF(DataInputStream.java:545)
java.io.DataInputStream.readUTF(DataInputStream.java:522)
servlet.MaileServlet.doPost(MaileServlet.java:60)
servlet.MaileServlet.doGet(MaileServlet.java:51)
javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note   The   full   stack   trace   of   the   root   cause   is   available   in   the   Apache   Tomcat/5.0.28   logs.


请问各位大侠哪里错了?该如何解决呢?

代码如下:
--------------MIDlet-----------

package   com;

import   java.io.DataOutputStream;
import   java.io.IOException;

import   javax.microedition.io.Connector;
import   javax.microedition.io.HttpConnection;
import   javax.microedition.lcdui.Alert;
import   javax.microedition.lcdui.AlertType;
import   javax.microedition.lcdui.Display;
import   javax.microedition.lcdui.Displayable;
import   javax.microedition.lcdui.TextField;
import   javax.microedition.midlet.MIDlet;
import   javax.microedition.midlet.MIDletStateChangeException;

public   class   MailClient   extends   MIDlet   {

private   MainForm   mainForm;
private   ContentForm   contentForm;
private   Display   display;
private   Message   message;

public   Message   getMessage()
{
return   message;
}
public   void   setMessage(Message   message)
{
this.message   =   message;
}

public   void   displayAlert(String   text,   AlertType   type,   Displayable   disp)
{
Alert   alert   =   new   Alert( "Application   Error ");
alert.setString(text);
alert.setType(type);
alert.setTimeout(2000);
display.setCurrent(alert,   disp);
}

public   ContentForm   getContentForm()
{
return   contentForm;
}

public   Display   getDisplay()
{
return   display;
}
public   MainForm   getMainForm()
{
return   mainForm;
}

public   void   initMIDlet()
{
MailThread   t   =   new   MailThread(this);
t.start();
message   =   new   Message();
display   =   Display.getDisplay(this);
mainForm   =   new   MainForm(this,   "Simple   Mail   Client ");
contentForm   =   new   ContentForm( "Content ",   null,   150,   TextField.ANY,   this);
display.setCurrent(mainForm);
}

public   MailClient()   {
//   TODO   Auto-generated   constructor   stub
}

protected   void   destroyApp(boolean   arg0)   throws   MIDletStateChangeException   {
//   TODO   Auto-generated   method   stub

}

protected   void   pauseApp()   {