Message object returns SharedByteArrayInputStream instead of Multipart.

Dear friends,
I am using java Mail API v 1.3.1 to access POP3 server.
I am getting problem while I try to read an RTF message from POP3 server.
When I try to access the data through getContent() method on javax.mail.Message Object, it sometimes gives me correct result as a Multipart data, while sometimes, it returns an object of type com.sun.mail.util.SharedByteArrayInputStream.
Although it returns SharedByteArrayInputStream object, when I invoke getContentType() on Message Object, it returns Multipart as correct.
I think this is some problem with the JavaMail API.
Going specifically, I use the POP server : ksc.th.com
Waiting for reply,
-> Maulik Soni.

hi,
I have the same Problem,too. But now, i have found the reason.
the javamail jar delivers a file named 'mailcap' in the META-INF dir of the library jar with
the following content:
text/plain;;          x-java-content-handler=com.sun.mail.handlers.text_plain
text/html;;          x-java-content-handler=com.sun.mail.handlers.text_html
text/xml;;          x-java-content-handler=com.sun.mail.handlers.text_xml
multipart/*;;          x-java-content-handler=com.sun.mail.handlers.multipart_mixed
message/rfc822;;     x-java-content-handler=com.sun.mail.handlers.message_rfc822
now while creating the default instance of MailcapCommandMap (activation framework),
this class is searching the 'mailcap' file in the META-INF dir. if 'mailcap' is not found, the
activation framework don't map these mimetyps.
workaround:
make sure, that the MailcapCommandMap can find the mailcap file in META-INF or in user.home dir
or
map manually (javax.activation.MailcapCommandMap):
MailcapCommandMap map = (MailcapCommandMap)MailcapCommandMap.getDefaultCommandMap();
map.addMailcap("text/plain;;x-java-content-handler=com.sun.mail.handlers.text_plain");
map.addMailcap("text/html;;x-java-content-handler=com.sun.mail.handlers.text_html");
map.addMailcap("text/xml;;x-java-content-handler=com.sun.mail.handlers.text_xml");
map.addMailcap("multipart/*;;x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
map.addMailcap("message/rfc822;;x-java-content-handler=com.sun.mail.handlers.message_rfc822");
simple,
if you known it.
thx, bye.
franz bartlechner

Similar Messages

  • IMAPInputStream instead of Multipart when handling MIME message

    Hi all,
    I'm creating standalone java application, which read e-mails from exchange server using IMAP protocol.
    I have a problem with handling MIME Multipart messages. My message is type of "multipart/alternative", but content is IMAPInputStream instead of Multipart object and I don't know why.
    if (message.isMimeType("multipart/alternative")) {
      System.out.println(message.getContent().getClass()
    }and i get >>> class com.sun.mail.imap.IMAPInputStream
    I found only 1 advice - to have a mail.jar before activation.jar in classpath, but this didn't help. {I'm using latest jars}
    Thanks for any answer.
    Regards,
    djuri

    If it wasn't being loaded from the mail.jar file, something else is
    broken in your environment. You might want to look for the root
    cause and fix it before it causes other problems.
    Note that there are other configuration files that are read from
    mail.jar, and not all of them can be copied to your home directory.

  • Message.messagekey  is coming instead of message text of message pool

    Hi All.
    I am facing one problem , I have created one error message in message pool ,and
    I am validating the field but when I am trying to use this ,Its highlighting the fields but
    message is not coming instead message.messagekey is coming.
    I am using the following code:
    ai=wdContext.getNodeInfo().getAttribute(IPrivateVEmployeeRequestView.IContextElement.DATE_OF_RESIGNATION);
    messageMgr.reportContextAttributeMessage(wdContext.currentContextElement(),ai,IMessageCEmployeeRequest.MSG, new Object[]{" resignation date is a non-working day. Please select a working day"},true);
    Thanks in Advance.
    Regards
    Abhishekh Singh

    Hi Abhishekh,
    Could you please check the message pool entry for the error, refer below example:-
    Message Key    Message Type    Message Text
    MissingInput       error                    : Entry of a valid is required for proceeding with the requested service. 
    Deepak!!!

  • Sync/Async JMS without BPM - No receiver specified in message object

    Hi All,
    My scenario is Proxy - JMS - Proxy.  I have chosen to do this without BPM and had followed closely to the instructions given in various help documents/blog/forum threads.  During testing, the proxy returns a system fault 'No receiver specified in message object'.  In RWB it indicates that the correlation is correct and the JMS Receiver adapter is getting the response, below is part of the audit log:
    2009-08-03 18:12:32 Information WRB: retrieving the message for de80831d-97f5-08f1-bdaf-00145e6883af ...
    2009-08-03 18:12:33 Information WRB: retrieved the message: ApplicationResponse
    2009-08-03 18:12:33 Information WRB: leaving WaitResponseBean
    2009-08-03 18:12:33 Information MP: leaving
    2009-08-03 18:12:33 Information The message was successfully delivered to the application using connection JMS_http://sap.com/xi/XI/System.
    2009-08-03 18:12:33 Information The message status was set to DLVD.
    When I check SXMB_MONI in XI-ABAP, I see 2 messages with status 'System Error - Restart not possible' and 1 with status 'Log Version'.  The message with status 'Log Version' is the respond.  The other 2 messages has the following error:
      <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
    - <!--  Request Message Mapping
      -->
    - <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
      <SAP:Category>XIServer</SAP:Category>
      <SAP:Code area="MAPPING">NO_RECEIVER</SAP:Code>
      <SAP:P1 />
      <SAP:P2 />
      <SAP:P3 />
      <SAP:P4 />
      <SAP:AdditionalText />
      <SAP:Stack>No receiver specified in message object</SAP:Stack>
      <SAP:Retry>N</SAP:Retry>
      </SAP:Error>
    It seem to me that the system does not know where to go/what to do next after returning to the JMS Receiver adapter.  I am at a lost what could have gone wrong.  Here is how I've done my configuration.
    Repository
    - Sync Sender Interface for R/3 Backend
    - Sync Receiver Interface for MQ
    - Async Sender Interface for the reply
    Directory
    - 1 CC for JMS Recevier
    - 1 CC for JMS Sender (for the respond)
    - 1 CC for Proxy Sender
    - 1 Interface Determination
    - 1 Receiver Determination
    - 1 Receiver Agreement for JMS Receiver
    - 1 Sender Agreement for the reply
    Any help is appreciated.  Thanks.

    Hi Prateek,
    This is what was tried in my first case. I did exactly what was given in that link.But since the Message id being 32 bytes and length of correlation id is 24 bytes id is getting truncated.
    So its not working fine.
    @ke i am having a look at the note will update you on this
    Thanks for your response
    Rgds
    Aditya

  • Copy activity fails while copying/reading sql object return type

    Hi,
    Please help me by providing some information for the following issue
    i am executing a db adapter in BPEL service ,i am calling a stored procedure it returns a object type . i can see the outputparameters retrun values in the audit(BPEL console) but i am unable to copy the object return type using assign copy operation.
    it shows parser error.Please find below mentioned error information.
    fault message:
    ULNAPP_JW_100_02_OutputVariable>
    -<part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="OutputParameters">
    -<db:OutputParameters xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:db="http://xmlns.oracle.com/pcbpel/adapter/db/DEVJ2EE/ULNAPP_JW_100_02/EDIT/">
    -<IV_EDI_REC_T>
    <EDI_EDIT>CNLNCE_APP_EDIT_00
    </EDI_EDIT>
    <EDI_SUPER_PRODUCT_TYPE_CD>CN
    </EDI_SUPER_PRODUCT_TYPE_CD>
    <EDI_PRODUCT_TYPE_CD>LN
    </EDI_PRODUCT_TYPE_CD>
    <EDI_FUNDING_TYPE_CD>CE
    </EDI_FUNDING_TYPE_CD>
    <EDI_PTC_COMPANY>ALL
    </EDI_PTC_COMPANY>
    <EDI_PCB_BRANCH>ALL
    </EDI_PCB_BRANCH>
    <EDI_STATE_CD>ALL
    </EDI_STATE_CD>
    <EDI_PRD_PRODUCT>ALL
    </EDI_PRD_PRODUCT>
    <EDI_EDIT_TYPE_CD>ORG-ENTRY
    </EDI_EDIT_TYPE_CD>
    <EDI_ENABLED_IND>Y
    </EDI_ENABLED_IND>
    <CREATED_BY>SETUP
    </CREATED_BY>
    <CREATION_DATE>2008-01-30T17:02:35.000+05:30
    </CREATION_DATE>
    <LAST_UPDATED_BY>SETUP
    </LAST_UPDATED_BY>
    <LAST_UPDATE_DATE>2008-01-30T17:02:35.000+05:30
    </LAST_UPDATE_DATE>
    <EDI_RESULT_CD>ERROR
    </EDI_RESULT_CD>
    <EDI_OVR_RESPONSIBILITY_CD>UNDEFINED
    </EDI_OVR_RESPONSIBILITY_CD>
    <EDI_ERE_ID>102688
    </EDI_ERE_ID>
    </IV_EDI_REC_T>
    <IV_RESULT>0
    </IV_RESULT>
    <IV_ERR_DESC xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
    </db:OutputParameters>
    </part>
    <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="response-headers">[]
    </part>
    </ULNAPP_JW_100_02_OutputVariable>
    </messages>
    Assign_1
    [2008/04/10 20:01:50] Updated variable "TMP_Output"More...
    -<TMP_Output>
    -<part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="OutputParameters">
    -<OutputParameters xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/DEVJ2EE/ULNAPP_JW_100_02/EDIT/">
    -<IV_EDI_REC_T xmlns="">
    <EDI_EDIT>CNLNCE_APP_EDIT_00
    </EDI_EDIT>
    <EDI_SUPER_PRODUCT_TYPE_CD>CN
    </EDI_SUPER_PRODUCT_TYPE_CD>
    <EDI_PRODUCT_TYPE_CD>LN
    </EDI_PRODUCT_TYPE_CD>
    <EDI_FUNDING_TYPE_CD>CE
    </EDI_FUNDING_TYPE_CD>
    <EDI_PTC_COMPANY>ALL
    </EDI_PTC_COMPANY>
    <EDI_PCB_BRANCH>ALL
    </EDI_PCB_BRANCH>
    <EDI_STATE_CD>ALL
    </EDI_STATE_CD>
    <EDI_PRD_PRODUCT>ALL
    </EDI_PRD_PRODUCT>
    <EDI_EDIT_TYPE_CD>ORG-ENTRY
    </EDI_EDIT_TYPE_CD>
    <EDI_ENABLED_IND>Y
    </EDI_ENABLED_IND>
    <CREATED_BY>SETUP
    </CREATED_BY>
    <CREATION_DATE>2008-01-30T17:02:35.000+05:30
    </CREATION_DATE>
    <LAST_UPDATED_BY>SETUP
    </LAST_UPDATED_BY>
    <LAST_UPDATE_DATE>2008-01-30T17:02:35.000+05:30
    </LAST_UPDATE_DATE>
    <EDI_RESULT_CD>ERROR
    </EDI_RESULT_CD>
    <EDI_OVR_RESPONSIBILITY_CD>UNDEFINED
    </EDI_OVR_RESPONSIBILITY_CD>
    <EDI_ERE_ID>102688
    </EDI_ERE_ID>
    </IV_EDI_REC_T>
    <IV_RESULT xmlns="">0
    </IV_RESULT>
    <IV_ERR_DESC xsi:nil="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns=""/>
    </OutputParameters>
    </part>
    </TMP_Output>
    </sequence>
    </flow>
    <switch>
    Assign_Output (faulted)
    [2008/04/10 20:01:50] Error in evaluate <from> expression at line "399". The result is empty for the XPath expression : "/ns9:OutputParameters/ns9:IV_RESULT". More...
    oracle.xml.parser.v2.XMLElement@d2838
    [2008/04/10 20:01:50] "{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure" has been thrown.less
    -<selectionFailure xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    -<part name="summary">
    <summary>
    empty variable/expression result.
    xpath variable/expression expression "/ns9:OutputParameters/ns9:IV_RESULT" is empty at line 399, when attempting reading/copying it.
    Please make sure the variable/expression result "/ns9:OutputParameters/ns9:IV_RESULT" is not empty.
    </summary>
    </part>
    </selectionFailure
    Thanks in advance,

    I'm having a similar problem where I'm unable to copy data from a single element from a response from a stored procedure (through an ESB service). If I copy the entire response xml to another variable it works fine however.
    Working code:
    <variable name="VariableOut" messageType="ns10:OutputParameters_reply"/>
    <assign name="assignStatusCode">
    <copy>
    <from variable="VariableOut" part="OutputParameters" query="/ns11:OutputParameters/ns11:EnclosureOutput/ns11:P_STATUS_CODE"/>
    <to variable="statusCodeFromEnclosures"/>
    </copy>
    </assign>
    results in:
    Updated variable "VariableOut"
    <invokeAPPS_DB_Enclosures_Out_execute_OutputVariable>
    <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="OutputParameters">
    <OutputParameters xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.oracle.com/pcbpel/adapter/db/DOC_INT/DOC_INV_ENCLOSURE_PKG/SEND_ENCLOSURES/">
    <P_ENCLOSURES xsi:nil="true"/>
    <P_STATUS_CODE>1</P_STATUS_CODE>
    <P_STATUS_TEXT>My text</P_STATUS_TEXT>
    </OutputParameters>
    </part>
    </invokeAPPS_DB_Enclosures_Out_execute_OutputVariable>
    Not working code:
    <variable name="statusCodeFromEnclosures" type="xsd:unsignedInt"/>
    <assign name="assignStatusCode">
    <copy>
    <from variable="VariableOut" part="OutputParameters" query="/ns11:OutputParameters/ns11:EnclosureOutput/ns11:P_STATUS_CODE"/>
    <to variable="statusCodeFromEnclosures"/>
    </copy>
    </assign>
    results in:
    Error in evaluate <from> expression at line "195". The result is empty for the XPath expression : "/ns11:OutputParameters/ns11:EnclosureOutput/ns11:P_STATUS_CODE".
    oracle.xml.parser.v2.XMLElement@14d4901

  • Problem: Applets cannot Create SOAP Message Objects using JAX Pack

    Hi all
    I want to invoke a simple webservice located at a url.
    I wish to send a SOAP Message . The Message is creating using
    javax.xml.soap package
    Here is the code
    public void init(){
    try{
    MessageFactory MF = MessageFactory.newInstance();
    SOAPMessage message = MF.createMessage();
    SOAPPart SP = message.getSOAPPart();
    SOAPEnvelope SE = SP.getEnvelope();
    SOAPHeader SH = SE.getHeader();
    SOAPBody SB = SE.getBody();
    Name bodyName = SE.createName
    ("testString","L","http://tempuri.org/");
    SOAPBodyElement SBE = SB.addBodyElement(bodyName);
    }catch(Exception e){}
    When I run the applet in a browser I am getting ExceptionInInitializerError or NullPointer Exception.
    The same application works when i run as a standalone application. But not in APPLET.
    Can somebody help me in this regard

    Im trying to do the same thing !!, i have a servlet that processes SOAP messages, and return SOAP messages back.
    Like you i have a implementation running with a stand alone client instead of an applet, which runs fine (there are several .jar files that have to be included in the jre/lib/ext directory, in total about a meg!).
    Im now looking to incorporate this client into an applet, but it moans about cannot find classes (the JAXM and SOAP classes).
    Have you found a solution to this yet ?? Surely you cannot expect the user to download all the required jar files along with the applet??
    With regards to your problem try setting up a button that fires off the SOAP Msg and processes the response, i read on the Sun Java Applet tutorials that some code should stay out of the init method(its a bit vague about WHAT should stay out..), maybe this is an example.
    Thanks,
    (i dont really expect a response as you posted this ages ago !!, but it would be nice.)

  • Error on pages: "_spBodyOnLoadFunctionNames' is undefined" and "Message: Object expected"

    We are seeing the following error on our SharePoint 2010 site:
    Webpage error details
    User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; InfoPath.3;
    MS-RTC LM 8; .NET4.0E; MS-RTC EA 2)
    Timestamp: Tue, 5 Jun 2012 16:05:37 UTC
    Message: '_spBodyOnLoadFunctionNames' is undefined
    Line: 130
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: '_spBodyOnLoadFunctionNames' is undefined
    Line: 157
    Char: 1752
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: 'ContextInfo' is undefined
    Line: 547
    Char: 7
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 602
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: 'ContextInfo' is undefined
    Line: 627
    Char: 7
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 682
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: 'ContextInfo' is undefined
    Line: 735
    Char: 7
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 788
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: 'ContextInfo' is undefined
    Line: 801
    Char: 7
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 854
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: 'ContextInfo' is undefined
    Line: 867
    Char: 7
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 920
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: '_spBodyOnLoadFunctionNames' is undefined
    Line: 964
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: 'WPSC' is undefined
    Line: 1105
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 1118
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 1119
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 1120
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 1121
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 1122
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 1123
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 1124
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 1125
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 1126
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 1127
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 1128
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 1129
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 1130
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 1131
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 1132
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 1133
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 1134
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 1135
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 1136
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 1146
    Char: 119
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: 'SetupFixedWidthWebParts' is undefined
    Line: 1152
    Char: 112
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: '_spBodyOnLoadFunctionNames' is undefined
    Line: 1073
    Char: 76
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 157
    Char: 77
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 682
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Message: Object expected
    Line: 682
    Char: 1
    Code: 0
    URI: http://prodshare/Pages/default.aspx
    Sites are not loading images from the \14\TEMPLATE\IMAGES (we get the red x) and site controls are not working.
    We have two web front ends that are load balanced with the alternate access mapping setup for the prodshare url. 
    Opening prodshare from the applications server (also a wfe) does not produce all of the errors but some items are still missing.
    We’ve rerun the products configuration wizard on the wfes, performed issresets, and rebooted both servers. 
    I’ve also tried running the install software as a repair with no change.
    I'm not sure what to attempt next and would appreciate any suggestions.
    Greg Glidden

    The load balancer is setup using the F5 Sharepoint 2010 template. All traffic is directed to one server or the other.  The AAM has the nlb url as the default for the port
    80 web app.
    We have two other SP2010 environments (development and QA) setup that work appropriately.  To the best of my knowledge we've got them all setup the same on the network. 
    When we access the site using both the wfe server addresses (http://spweb1 or http://spweb2 instead of the nlb 
    http://prodshare), we get the same errors so we ruled out the nlb as the issue.   When accessing the site using the app server address
    (http://spapp1) all images and controls work correctly.  It appears to be something wrong in the setup on the web front end servers.   But running the SharePoint 2010 Products
    Configuration Wizard did not fix the issue.
    Greg Glidden

  • No object DCH for MIME type multipart/related

    Hi, everyone!!!
    When I execute my code, I got this exception:
    javax.activation.UnsupportedDataTypeException: no object DCH for MIME type multipart/related
    boundary="----=_Part_0_20851530.1186777547859"
    the funny things is : I got it work before. However, when I come back a few days to run, it doesn't.
    I use tomcat 5.0,
    mail.jar: version: 1.6
    activation.jar:version: I don't know but I download the new ones in sun website.
    Note: Also, when I run the code below in standalone application (java application), it works but doesn't work on tomcat application
    Any help would be appreciate.
    I tried some helps tips from other website such as http://www.jguru.com/faq/view.jsp?EID=237257
    and still doesn't work :((((
    ***********Here is my code**********
    ********props is properties file...............
    Authenticator auth = new SMTPAuthenticator();
              // Get session
              Session session = Session.getDefaultInstance(props, auth);
              session.setDebug(true);
              // Create the message
              Message message = new MimeMessage(session);
              // Fill its headers
              message.setSubject(subject);
              message.setFrom(new InternetAddress(from));
    for(int x=0;x<recipients.size();x++)
         message.addRecipient(Message.RecipientType.TO, new InternetAddress(recipients.get(x).toString()));
                        // Create your new message part
                        BodyPart messBodyPart=new MimeBodyPart();
                        // Set the HTML content, be sure it references the attachment
                        String htmlText="<h1>Hi</h1>"+"<img src=\"cid:picture\">";
                        // Set the content of the body part
                        messBodyPart.setContent(htmlText, "text/html");
                        // Create a related multi-part to combine the parts
                        MimeMultipart multipart=new MimeMultipart("related");
                        // Add body part to multipart
                        multipart.addBodyPart(messBodyPart);
                        // Create part for the image
                        messBodyPart=new MimeBodyPart();
                        // Fetch the image and associate to part
                        System.out.println("before dataSource");
                        DataSource fds=new FileDataSource(this.getString("image_location"));
                        System.out.println("After dataSource");
                        messBodyPart.setDataHandler(new DataHandler(fds));
                        System.out.println("*************** dataSource");
                        // Add a header to connect to the HTML
                        messBodyPart.setHeader("Content-ID", "<picture>");
                        // Add part to multi-part
                        multipart.addBodyPart(messBodyPart);
                        // Associate multi-part with message
                        message.setContent(multipart);
                        // Send message
                        System.out.println("Before Send");
                        Transport.send(message);
                        System.out.println("Finish");
    }

    Thank you for your response!!!
    I already found the solution. For those who still having problem send e-mail, make sure to put mail.jar and activation.jar in the same location.
    Also, make sure to check catalina.xml to make sure those jars are same location!!!->That what I found out.
    ->I put jars in same location of my eclipse project but it turns out, the tomcat app server didn't put them in same location.
    Anyway, Thank you java_2006 for your response!!!!!
    :)

  • Message Object assembly failure - IBatis Framework

    I am calling a procedure using IBatis Framework , which returns a cursor.
    While mapping the data from cursor to POJO class, I am getting the following exception :
    Exception Message Object assembly failure on eligibility.domain.Test for Field: data
    class Test
         A data;
    setter and getter for data;
    could you please help me to resolve this issue.
    Regards
    Venky

    Hi,
    While importing select the type as wsdl and then import it.
    Otehrwise try to import as xsd.
    Hope this helps.
    Regards,
    Moorthy

  • Fetch mails for offline usage vs. leight-weight filling of Message object

    Hello!
    I'm working on a simple mail class having just a send and a fetch method. But I ran into problems with the latter, because I can't return the messages I fetch. The JavaMail documentation says "Folder implementations are expected to provide light-weight Message objects, which get filled on demand.", so obviously my code won't work out.
    public static Message[] fetchMails()
       Message messages[] = folder.getMessages();
       folder.close(true);
       store.close();
       return messages;
    Messages msg[] = MailAccount.fetchMails();
    System.out.println(msg.getSubject()); // error: Folder is not open.So how can I return the messages as an object, which I can work on even if the connection to the server is already closed? Is there any high level solution for this or do I have to use message.writeTo() or create my own container class for email contents?
    Tnx in advance!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Could you please give an example for your first advice? folder.getMessages() returns an array of Message objects, but the MimeMessage constructor only takes MimeMessage objects and some InputStreams. Do I have to cast the Message objects somehow?
    I try to keep my code as simple as possible (it's just a litte demo appication), so I don't want to go for any third party products. But the MimeMessage thing sounds like a good idea, if it works.
    Thanks for your reply so far.

  • Unable to read payload from the message object in XI

    Hello Guys,
    Please help me about my problem in XI version 7.0.im quite new here.
    im trying to test my config but error message occured. "Unable to read payload from the message object"
    when i checked the comm channel this is the error message :
    Error during database connection to the database URL 'jdbc:sqlserver://172.16.40.20:1433;databasename=TRAVEL:SelectMethod=cursor' using the JDBC driver 'com.microsoft.sqlserver.jdbc.SQLServerDriver': 'com.sap.aii.adapter.jdbc.sql.DriverManagerException: Cannot establish connection to URL 'jdbc:sqlserver://172.16.40.20:1433;databasename=TRAVEL:SelectMethod=cursor': com.microsoft.sqlserver.jdbc.SQLServerException: Cannot open database "TRAVEL:SelectMethod=cursor" requested by the login. The login failed.'
    when i tried my login in sql it works...but in this message the login is failed..what shall i  do..
    Please advice.
    Thanks in advance
    aVaDuDz

    Hi
    Check with the connection string & Authorization of user you have used.
    MSSQL string is
    jdbc:microsoft:sqlserver://dbhost:1433;databaseName=example;SelectMethod=Cursor
    While doing JDBC its good to refer Note 831162 lot of problems can be resolved.
    Thanks
    Gaurav

  • IOS 5.0.1 messages show phone number instead of names

    after the iOS 5.0.1 update, all my incoming and outgoing messages show phone number instead of names even though i have them in my contacts.
    i tried deleting previous messages, and restarting a new outoging msg to a specific number but when i start a new msg, after i add the contact, and i send it, it'll show the number instead of the person from my contact.
    anyone else having this issue and any possible solutions?
    also the number show up as +1 (951) XXX - XXXX
    +1 (area code) then the number.... instead of the name of the person in my contact.

    i went to the apple store and the tech told me the following:
    make sure you backup your photos, contacts, etc.
    the problem she said is due to a corrupt file for some iphones4s.
    1) sync your iphone with itunes
    2) do a restore and restore with a "new phone" instead of from backup
    3) your phone will be reset, but you'll have all your apps.
    after doing all this, your contacts and message should sync up.
    hope this helps.

  • Unable to read payload from the message object

    Hi
    I have a scenario where i am send request to http receiver and getting the response. When I am testing through WFETCH it is working fine. But when i am testing through XI I am getting the follwoing error
    Unable to read payload from the message object
    I have tested the XI payload in mapping. I have done all kinds of testing but it is still giving the same error.
    One more strange thing is
    I have done one BPM scenario where Data is coming from Source to BPM( which is asyn) and then from it will go from BPM to Target (which is sync) But when I am checking the SXMB_MONI... it showing the messages like this
    Source to BPM
    Target to BPM
    Target to BPM.
    But i think it should show message like
    Source to BPM
    BPM to Target
    Target to BPM
    why i am getting the flo

    Hi
    Check with the connection string & Authorization of user you have used.
    MSSQL string is
    jdbc:microsoft:sqlserver://dbhost:1433;databaseName=example;SelectMethod=Cursor
    While doing JDBC its good to refer Note 831162 lot of problems can be resolved.
    Thanks
    Gaurav

  • Modify Application: Error Message:: Object Variable or With Block variable

    Hi Experts,
    We just installed 5.1 on our server and once the application is installed.
    When I try to modify the aplication I get this error at the end
    This is step what the modify app does:
    Check environment information
    Drop Fact table index.
    Modify fact table.
    Update application information.
    Set Fact table index.
    Create stored procedures and comment table.
    Increase application version and make legal consolidation table.
    Make OLAP database and Journal/Audit reports. / Validate dimension formulas.
    Error Message:: Object Variable or With Block variable
    Any one has any any answer ? I will appreciate your help on this.
    Thanks

    Please check if Reporting Services is working properly.
    Just open IE and type http://nameofserver/reports
    If you receive any error then you have to fix that error verifying configuration of RS.
    If RS is working make sure you add the right information into Server Manager Server Option for RS and Report Server virtual directory.
    Also please check the tblappsetinfo to have all the fields completed (regarding servers).
    Regards
    Sorin Radulescu

  • Sometimes when I am texting the screen freezes.  I have to go out of messages and return and then I can send.

    Sometimes when I am texting the screen freezes.  I have to go out of messages and return and then I can send.

    Hello mdcrab1,
    Thank you for participating in the Apple Support Communities.
    If your screen freezes sometimes when you're texting until you quit and re-launch Messages, try these troubleshooting steps first:
    Restart your device and check for updates
    Restart your device.
    Check for a carrier settings update.
    Check for an iOS software update.
    You can find these steps and more troubleshooting tips at this link:
    If you can't send or receive messages on your iPhone, iPad, or iPod touch - Apple Support
    If the issue continues, and it only happens in the Messages app, I recommend trying the rest of the steps in the above article.
    If the screen freezes sometimes when you're using other apps, the steps in this article can help:
    If the screen on your iPhone, iPad, or iPod touch doesn't respond to touch - Apple Support
    Sincerely,
    Jeremy

Maybe you are looking for