java发邮件时 com/sun/mail/util/LineInputStream 过错csdn - 乐橙lc8

java发邮件时 com/sun/mail/util/LineInputStream 过错csdn

2019-02-12 08:00:24 | 作者: 范明 | 标签: 小弟,那本书,协议 | 浏览: 4865

webservice报错:java.lang.NoClassDefFoundError: com/sun/mail/util/LineInputStream 小弟我第一次触摸webservice,依照OREILLY那本书上的比如。做了个经过javamail和soap协议发送一个xml给一个servlet的比如,报了个如题过错,事前我现已把mail.jar,commons-email-1.1.jar,soap.jar,mailapi.jar等包载入了,详细发送端如下:rnpublic class SimpleGenericHTTPSoapClient rnrn /**rn * @param argsrn */rn rn private static final String DEFAULT_HOST_URL= https://localhost:8081 +rn /SoapServlet/SimpleHTTPReceive rn rn private static final String DEFAULT_DATA_FILENAME= ./PO.xml rn rn private static final String URI= urn:oreilly-jaws-samples rn rn rn rn private String m_hostURL;rn rn private String m_dataFileName;rn rn public SimpleGenericHTTPSoapClient(String hostURL,String dataFileName)rn throws Exceptionrn m_hostURL=hostURL;rn m_dataFileName=dataFileName;rn System.out.println();rn System.out.println( - rn System.out.println( Starting SimpleGenericHTTPSoapClient: rn System.out.println( host url = +m_hostURL);rn System.out.println( data file = +m_dataFileName);rn System.out.println( - rn System.out.println();rn rn rn rn public void sendSOAPMessage()rn rn tryrn rn FileReader fr=new FileReader(m_dataFileName);rn DocumentBuilder xdb=org.apache.soap.util.xml.XMLParserUtils.rn getXMLDocBuilder();rn Document doc=xdb.parse(new org.xml.sax.InputSource(fr));rn rn if(docnull)rn throw new org.apache.soap.SOAPException(org.apache.soap.rn Constants.FAULT_CODE_CLIENT, parsing error rn rn rn rn Envelope envelope=new Envelope();rn rn Vector bodyElements=new Vector();rn rn bodyElements.add(doc.getDocumentElement());rn rn Body body=new Body();rn rn body.setBodyEntries(bodyElements);rn rn envelope.setBody(body);rn rn rn Message msg=new Message();rn rn msg.send(new URL(m_hostURL), URI, envelope);rn System.out.println( Sent SOAP Message with Apache +rn HTTP SOAP Client. rn rn rn //承受呼应,输出到屏幕rn System.out.println( Waiting for response.... rn SOAPTransport st=msg.getSOAPTransport();rn BufferedReader br=st.receive();rn String line=br.readLine();rn rn if(linenull)rn System.out.println( HTTP POST was successful. \n rn rn elsern while(line!=null)rn System.out.println(line);rn line=br.readLine();rn rn rn rn rn rn catch(Exception e)rn e.printStackTrace();rn rn rn rn rn rn rn rn public static void main(String[] args) rn // TODO Auto-generated method stub rn rn tryrn SimpleGenericHTTPSoapClient soapClient=new SimpleGenericHTTPSoapClient( https://localhost:8081 +rn /SoapServlet/SimpleHTTPReceive , ./PO.xml rn soapClient.sendSOAPMessage();rn rn catch(Exception e)rn e.printStackTrace();rn rn rnrnrnrn报错如:rnrnxception in thread main java.lang.NoClassDefFoundError: com/sun/mail/util/LineInputStreamrn at javax.mail.internet.MimeUtility.(MimeUtility.java:1161)rn at javax.mail.internet.ParameterList.quote(ParameterList.java:334)rn at javax.mail.internet.ParameterList.toString(ParameterList.java:304)rn at javax.mail.internet.ContentType.toString(ContentType.java:207)rn at javax.mail.internet.MimeMultipart.(MimeMultipart.java:167)rn at org.apache.soap.rpc.SOAPContext.addBodyPart(SOAPContext.java:322)rn at org.apache.soap.rpc.SOAPContext.setRootPart(SOAPContext.java:380)rn at org.apache.soap.rpc.SOAPContext.setRootPart(SOAPContext.java:419)rn at org.apache.soap.rpc.SOAPContext.setRootPart(SOAPContext.java:394)rn at org.apache.soap.transport.TransportMessage.save(TransportMessage.java:303)rn at org.apache.soap.transport.http.SOAPHTTPConnection.send(SOAPHTTPConnection.java:281)rn at org.apache.soap.messaging.Message.send(Message.java:123)rn at org.test.servletservice.SimpleGenericHTTPSoapClient.sendSOAPMessage(SimpleGenericHTTPSoapClient.java:77)rn at org.test.servletservice.SimpleGenericHTTPSoapClient.main(SimpleGenericHTTPSoapClient.java:122)rn各位大哥帮帮忙啊!!!谢谢了!!!rn

版权声明
本文来源于网络,版权归原作者所有,其内容与观点不代表乐橙lc8立场。转载文章仅为传播更有价值的信息,如采编人员采编有误或者版权原因,请与我们联系,我们核实后立即修改或删除。

猜您喜欢的文章