How to checkin document with 'Projects' security group

Hi everyone,
i want to checkin a document thru a java class, and set it to Projects security group, also i want to set folder, userlist, grouplist...
Does anyone know how to define these things in java class before execute the CHECKIN service, or there are any extra service needed to run?
Thanks

Hi
I am putting the snippet on how to do a checkin for content RIDC :
public class TestRIDCCheckin {
* @param args
public static void main(String[] args) {
// Create a new IdcClientManager
IdcClientManager manager = new IdcClientManager ();
try{
// Create a new IdcClient Connection using idc protocol (i.e. socket connection to Content Server)
IdcClient idcClient = manager.createClient ("idc://hostname for ucm:intradocserverport");
// Create new context using the 'sysadmin' user
IdcContext userContext = new IdcContext ("sysadmin");
// Create an HdaBinderSerializer; this is not necessary, but it allows us to serialize the request and response data binders
HdaBinderSerializer serializer = new HdaBinderSerializer ("UTF-8", idcClient.getDataFactory ());
// Databinder for checkin request
DataBinder dataBinder = idcClient.createBinder();
dataBinder.putLocal("IdcService", "CHECKIN_UNIVERSAL");
//dataBinder.putLocal("dDocName","TestRIDCCheckin");
dataBinder.putLocal("dDocTitle", "Test RIDC Checkin");
dataBinder.putLocal("dDocType", "ADACCT");
dataBinder.putLocal("dDocAccount", "");
dataBinder.putLocal("dSecurityGroup", "Public");
dataBinder.addFile("primaryFile", new File("/home/oracle/cis"));
dataBinder.putLocal is used set the metadata and details for the content .
Hope this helps
Thanks
Srinath
Edited by: srinathmenon on Aug 20, 2010 1:23 PM

Similar Messages

  • How do I sign an Abode document with a secure environment?

    How do I sign an Abode document with a secure environment?

    If this is related to Adobe Fill & Sign (since you did submit this feedback through the Feedback form) this is an FAQ on security: https://www.acrobat.com/en_us/security.html
    I am not sure if that really is what you wanted, if that doesn't answer please provide more details.
    Thanks,
    Josh
    PS - You might want to look at Electronic Signature Software, Digital Signatures | Adobe EchoSign to see if that fits your needs
    Also Electronic signatures, e-signatures | Adobe Acrobat XI

  • Projects Security Group

    Hi, can anyone tell me (under collaboration) what's the difference between user1 and user2 under this circumstances:
    1. Projects being the security group that comes as default in the system.
    user1 - Projects(RWD)
    user2 - Projects(RWDA)
    where local access (ACL) and account (Prj) permissions are the same?
    2. Prj being the Account that comes as default in the system.
    user1 - Prj(RWD)
    user2 - Prj(RWDA)
    where local access (ACL) and Projects (Security Group) permissions are the same?
    Thanks!

    any help? plz

  • How to park document with reference?

    Hi All,
    We have function to post document with reference in SAP but how about park document with reference?
    Can anybody help me?
    Thanks n really appreciate

    Thanks for your reply. Fyi, I've applied employee limitation to post manual journal at tcode OBA4 and OB57.
    User A : >100K - 500K
    User B : >500K - 1 MILL (Asst. Manager)
    User C : >1 MILL (Manager)
    Normally user A will park all the journals but after apllied the limitation, user A only can park for the journal (normal tcode F-02 or other tcode) which not more than 500K. The limitation affect the park as well.
    Alternative for tcode F-02:
    User A : Park doc at FB50 (any amount) and post at tcode FBV0 by other user. There's no park or post with reference.
    User request to park with reference.. Any idea?
    Thanks friends

  • How to scan documents with HP Officejet 5610 and iMac 21.5 ?

    Hello,
    Please can someone tell me how to scan documents with a HP Officejet 5610 all-in-one printer and an iMac 21.5 , OS X Yosemite version 10.10.1 ?
    Thanks a lot.

    Hi,
    Scanning can be done on Yosemite as listed in the following document:
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c04467713&tmp_task=useCategory&cc=us&dlc=en&lc=e...
    A such will allow scanning as a PDF file as example.
    If by "Scanning a Document" you may refer to OCR scanning (e.g. scanning a text to a Word file which can be edited), a such is not supported by the provided solution and will require a 3rd party software which offer OCR capabilities. Vuescan re as example support a such:
    http://www.hamrick.com/vuescan/hp_officejet_5600.html
    Regards,
    Shlomi
    Say thanks by clicking the Kudos thumb up in the post.
    If my post resolve your problem please mark it as an Accepted Solution

  • How to associate more than one security group for UCM documents?

    When checking in a document we are only able to associate one security group to documents. In our case, a particular document can be seen by more than one group e.g a document can be seen bu both finance and marketing groups.
    How can we associate more than one group for documents?
    Our requirement is related to search. We want to display the documents to the end user based on the security group that is associated with the document. We are planning to use IDM and have all the groups/roles that are possible in the end site (also delivered by same ldap) available in UCM so that when checking in the documents we can associate desired groups who can see these documents.
    Regards,
    Pratap

    One thing before all, is that I suggest that you think through your security model before implementing it in UCM. You should ask yourself questions like :
    - Is security really based on department ?
    - Why two departments need to have access to the same category of document ?
    - Is it really security that I need or classification ? Is it a problem if Accouting have access to Finance or you just don't want Marketing documents in a finance related search ?
    - Maybe what you want is that finance guys to have access to marketing document.
    Without a clear business security model, it's hard to find a UCM security model as it is impossible to associate 2 security groups to one document.

  • Collaboration Projects security group query

    We have installed the Collaborative Projects component. When I create a Project by default it takes Projects as its security group & prj as accounts.
    We want to add custom SG & accounts in my Projects.
    any idea how to achieve this??
    Thanks in Advance.
    Edited by: user11264760 on Jun 12, 2009 10:00 PM

    any help? plz

  • How to resize document with content?

    ID CC 2014
    How do you resize a document with content so that the scale of everything is maintained, but the final output is just a smaller size?
    I have a 7x7 square booklet, laid out with content, I want to make this a  6x6 square booklet.

    Thank you.
    …The more I use InDesign and Illustrator the more and more amazed I am at Adobe's ability to entirely disregard features that seem obvious and required. This process should be no more complex than a dialog box, much like Photoshop's "image size" - Enter a new desired page size, and all objects scale up or down in uniform to match the new page size.
    How is this not in the software already?
    I can't be the only one who has had a output size change after the project has started or is finished.

  • Terminal Server Licensing Problems with GPO Security Group License Server

    Hello,
    I have two fresh installs of W2K12R2.
    One is RD Session Host and the other one is the License Server. Everything is fine until I active the GPO Security Group License Server. After that the License Server gives no licenses
    to die clients (we have User und Device CALs). TS Licensing Diagnostic’s shows no errors, the number of available licenses is displayed correctly, even the state of GPO Security Group License Server is correctly shown as "active" and die
    Membership in the Group "RDS-Endpointserver" is "Yes". Eventlog shows no Errors. Log in on the session host is even possible, maybe because the RDS-Service is in evaluation time.
    If the GPO Security Group License Server is disabled again, the server starts to serve licenses as expected.
    I don’t know what I can do anymore, never had problems with exact the same setup under W2K8, but with W2K12 is the second time I notice this issue.
    Thanks for your ideas,
    Andreas

    Hi Andreas,
    Thank you for posting in Windows Server Forum.
    Sorry to inform but there is no official document for server 2012 related to this event, you can go through below article for reference.
    You cannot use a security group to add computer accounts to the Terminal Server Computers group. You must add each computer account explicitly. To verify whether an RD Session Host server is allowed to request RDS CALs from the Remote Desktop license server,
    you can use the IsSecureAccessAllowed method of Win32_TSLicenseServer class. For more details about this method, click here.
    1. License Diagnosis tool returns error "License server <computer name> cannot issue RDS CALs to the Remote Desktop Session Host Server because the 'License server security group' Group
    Policy setting is enabled."
    2.Control the Issuance of RDS CALs
    Note: You should only enable this policy setting when the license server is a member of a domain. You can only add computer accounts for RD Session Host servers to the RDS Endpoint Servers group when the license server is a member of a domain.
    Hope it helps!
    Thanks, 
    Dharmesh

  • Target Audience with Domain Security Group

    Good morning.
    A simple question...
    Can I use Target Audiences on a web part with Active Directory Security Group?
    Thanks,
    Segio
    Regards,
    Bubu
    http://zsvipullo.blogspot.it
    Please mark my answer if it helped you, I would greatly appreciate it.

    Try to use that in SharePoint Audience and then use that Sharepoint audience on Site webpart

  • How do I send/email Documents with high security and password protected

    I want to send Documents securely to my clients. What product do I need and how do I send/email with password protection? I recently purchased Adobe Send but not sure this was the right product needed to send my documents securely?

    In Acrobat you can create a Portfolio in which your documents (any types) will be placed as attachments and encrypt the whole portfolio. You can also create a small PDF, possibly with explanation what is in it, attach your files to it, and encrypt this PDF. In this case you can encrypt attachments only, so that the user can open the shell PDF but to extract the files would need to know the password.

  • How to create a pdf document with specific security settings

    Hallo,
    in Adobe Acrobat you can set security settings which make documents unprintable, unchangeable etc.
    What I want to do is: I want to set these security settings by creating the pdf-document, because I do not want to open every document and change the security settings. Is this possible at all???
    Thank you for help
    Elisabeth

    How are you creating the documents? If using Adobe PDF printer, use the security options in Adobe PDF printer settings. If using PDFMakers (Acrobat buttons inside Office applications, open the Preferences menu item and set security there)

  • How do I deal with project bloat? Long Save time is getting worse?

    Here are the FB posts I have got about this issue. I tried to paste them neatly but didn't work.
    To be honest I am baffled that such an advanced NLE has so many issues. There should be a warning about the Warp Stabilizer messing up a project I had no idea till now.
    This was my question to a PP user group on FB.
    I am cutting a 60+ minute doc with lots of source material and the project takes a dogs age to save now which is beginning to interrupt my workflow. I would have thought the save would take less time depending on how much work was done since the last save. I suppose working with Proxies might be the solution but I am already 70% done.
    Here are the responses
    Saving the project file on an SSD might be a good idea.
    Your project size is slowing you down. Create a couple of projects, each containing a part of the footage. Organized in bins as needed. Call them footage projects. Create an other project named edit and cut in there. Use the media browser to browse the footage projects. Import what you need and use search bins to keep it organized.
    If you didn't transcode your footage before you started the project it could be part of the problem. And like the other post says only having the footage you are currently working on will also help. The claim that you don't have to transcode when working in Premiere is misleading because in most cases when working with many different source codecs transcoding will always improve your computers performance.
    I had the exact same experience cutting a 90 min feature with 120 hours of Pro Res 4444 footage. Long save times are caused by project bloat, either by having too many assets loaded or a lot of warp stabilizer effects applied. Transcoding will only affect playback performance and exports - it doesn't sound like it's the problem in this case.
    only some codecs (4K GoPro, 6K R3D, lengthy h264/AVCHD clips for example) benefit from transcoding and will be snappier and playback smoother. But transcoding will never ever help the loading or saving time of your project
    Don't apply warp stabilizsr to everything. All those coordinates get stored in project file
    All I can say is that I worked on a Premiere project in November where my computer spent up to 5-7 minutes scanning through all the different directories with footage after the project was open before I could play back the sequences in my project. I ha...
    some of the ftg is in need of stabilization so I did use the warp stabilizer but not excessively. 15 x 3-10 second clips. Is there a way of managing the storage of the coordinates too minimize the hit on the project size?
    nope. Try importing existing project into a new project.
    I usually stabilize footage in a separate project to avoid huge project files, and export the stabilized result. Then I use the stabilized version in the main project.
    I also work with Nested Sequences a lot. Working in short, manageable timelines. When opening a large project, Premiere will find the footage for the active sequence first, so I can start working quickly, while Premiere is still finding the rest of the footage.
    Could do your warp stabilizing in AE and export renders of them, then import those renders into your project so the are just media files instead of files with stabilizer tracking points.

    I usually stabilize footage in a separate project to avoid huge project files, and export the stabilized result. Then I use the stabilized version in the main project.
    That would be something like  the advice I would have given
    and  more likely...
    Save heavy duty  FX application until after you have locked down your edit. (eg Blurs , Warp, 3rd party FX(MB)
    I Create separate sequences or Duplicate Projects for many reasons.  eg CC/Grade  and
    Warp Stabiliser ...definitely.  Its even has a slow save  impact on After Effects Projects!

  • New Document with Layer Comp & Groups Link ?

    I'd like to create a script that creates a new photoshop document that automatically creates a set of layer comps with specific names that are linked with groups with identical names or the same name. I don't know whether to create this in Adobe Configurator but since I want to create a 'new' document that does this automatically I don't know if Adobe Configurator is the best route to go ?
    An added bonus it would be benifical to select the layer comp, and save only the selected layer comp or an option to save the entire composition or a layer comp.

    What good are Layer Comps that show Groups if one is to add Layers only
    later on or should Layers in the Groups be created right away?
    In Photoshop when you create a new document File -> New it would create the following layer comps and layer groups.
    The layer comps would be linked to the layer groups with the same name or identical name if allowed, for example if the Layer Group name is not Layer Comp A, rather CompyDesignA the script would know to still link it to Layer Comp A.
    I don't know how many layers I would add to the layer group so the script wouldn't create these layers, the script would then export the layer comp with the selected layer group.
    For example, I select Layer Comp A which is tied to the Layer Group, Layer Group A / or similiar name if I select the layer comp Layer Comp A it would know to save only the Layer Group 'Layer Group A / or similar name' automatically, with the option to save the entire composition with all layer comps and all layer groups, understand ?
    I suppose that upon creating the new composition/document each layer group would have a layer created called 'background' and the first layer created above that background layer would have a screen blend mode applied, automate the task.

  • How can i deal with java.security.AccessControlException?

    Hi all, I need to implement JavaMail using Servlet and deploy throught J2EE deployment tool. But when i test out the servlet i will always encounter this exception thrown. How can i solve this?
    java.security.AccessControlException: access denied (java.util.PropertyPermission * read,write)
    This is the servlet i am testing. Please advise. Thanks in advance!
    * @(#)JavaMailServlet.java     1.3 99/12/06
    * Copyright 1998, 1999 Sun Microsystems, Inc. All Rights Reserved.
    * This software is the proprietary information of Sun Microsystems, Inc.
    * Use is subject to license terms.
    import java.io.*;
    import java.util.*;
    import java.text.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    * This is a servlet that demonstrates the use of JavaMail APIs
    * in a 3-tier application. It allows the user to login to an
    * IMAP store, list all the messages in the INBOX folder, view
    * selected messages, compose and send a message, and logout.
    * <p>
    * Please note: This is NOT an example of how to write servlets!
    * This is simply to show that JavaMail can be used in a servlet.
    * <p>
    * For more information on this servlet, see the
    * JavaMailServlet.README.txt file.
    * <p>
    * For more information on servlets, see
    * * http://java.sun.com/products/java-server/servlets/index.html
    * @author Max Spivak
    public class JavaMailServlet extends HttpServlet implements SingleThreadModel {
    String protocol = "POP3";
    String mbox = "INBOX";
    * This method handles the "POST" submission from two forms: the
    * login form and the message compose form. The login form has the
    * following parameters: <code>hostname</code>, <code>username</code>,
    * and <code>password</code>. The <code>send</code> parameter denotes
    * that the method is processing the compose form submission.
    public void doPost(HttpServletRequest req, HttpServletResponse res)
         throws ServletException, IOException {
    // get the session
         HttpSession ssn = req.getSession(true);
         String send = req.getParameter("send");
    String host = req.getParameter("hostname");
    String user = req.getParameter("username");
    String passwd = req.getParameter("password");
    URLName url = new URLName(protocol, host, -1, mbox, user, passwd);
    ServletOutputStream out = res.getOutputStream();
         res.setContentType("text/html");
         out.println("<html><body bgcolor=\"#CCCCFF\">");
         if (send != null) {
         // process message sending
         send(req, res, out, ssn);
         } else {
         // initial login
         // create
         MailUserData mud = new MailUserData(url);
         ssn.putValue("javamailservlet", mud);
         try {
              Properties props = System.getProperties();
              System.out.println("url");
              props.put("mail.smtp.host", host);
              Session session = Session.getDefaultInstance(props, null);
              session.setDebug(false);
              Store store = session.getStore(url);
              store.connect();
              Folder folder = store.getDefaultFolder();
              if (folder == null)
              throw new MessagingException("No default folder");
              folder = folder.getFolder(mbox);
              if (folder == null)
              throw new MessagingException("Invalid folder");
              folder.open(Folder.READ_WRITE);
              int totalMessages = folder.getMessageCount();
              Message[] msgs = folder.getMessages();
              FetchProfile fp = new FetchProfile();
              fp.add(FetchProfile.Item.ENVELOPE);
              folder.fetch(msgs, fp);
              // track who logged in
              System.out.println("Login from: " + store.getURLName());
              // save stuff into MUD
              mud.setSession(session);
              mud.setStore(store);
              mud.setFolder(folder);
              // splash
              out.print("<center>");
              out.print("<font face=\"Arial,Helvetica\" font size=+3>");
              out.println("<b>Welcome to JavaMail!</b></font></center><p>");
              // folder table
              out.println("<table width=\"50%\" border=0 align=center>");
              // folder name column header
              out.print("<tr><td width=\"75%\" bgcolor=\"#ffffcc\">");
              out.print("<font face=\"Arial,Helvetica\" font size=-1>");
              out.println("<b>FolderName</b></font></td><br>");
              // msg count column header
              out.print("<td width=\"25%\" bgcolor=\"#ffffcc\">");
              out.print("<font face=\"Arial,Helvetica\" font size=-1>");
              out.println("<b>Messages</b></font></td><br>");
              out.println("</tr>");
              // folder name
              out.print("<tr><td width=\"75%\" bgcolor=\"#ffffff\">");
              out.print("<a href=\"" + HttpUtils.getRequestURL(req) + "\">" +
                   "Inbox" + "</a></td><br>");
              // msg count
              out.println("<td width=\"25%\" bgcolor=\"#ffffff\">" +
                   totalMessages + "</td>");
              out.println("</tr>");
              out.println("</table");
         } catch (Exception ex) {
              out.println(ex.toString());
         } finally {
              out.println("</body></html>");
              out.close();
    * This method handles the GET requests for the client.
    public void doGet (HttpServletRequest req, HttpServletResponse res)
         throws ServletException, IOException {
    HttpSession ses = req.getSession(false); // before we write to out
    ServletOutputStream out = res.getOutputStream();
         MailUserData mud = getMUD(ses);
         if (mud == null) {
         res.setContentType("text/html");
         out.println("<html><body>Please Login (no session)</body></html>");
         out.close();
         return;
         if (!mud.getStore().isConnected()) {
         res.setContentType("text/html");
         out.println("<html><body>Not Connected To Store</body></html>");
         out.close();
         return;
         // mux that takes a GET request, based on parameters figures
         // out what it should do, and routes it to the
         // appropriate method
         // get url parameters
         String msgStr = req.getParameter("message");
    String logout = req.getParameter("logout");
         String compose = req.getParameter("compose");
         String part = req.getParameter("part");
         int msgNum = -1;
         int partNum = -1;
         // process url params
         if (msgStr != null) {
         // operate on message "msgStr"
         msgNum = Integer.parseInt(msgStr);
         if (part == null) {
              // display message "msgStr"
    res.setContentType("text/html");
              displayMessage(mud, req, out, msgNum);
         } else if (part != null) {
              // display part "part" in message "msgStr"
              partNum = Integer.parseInt(part);
    displayPart(mud, msgNum, partNum, out, res);
         } else if (compose != null) {
         // display compose form
         compose(mud, res, out);
    } else if (logout != null) {
         // process logout
    try {
    mud.getFolder().close(false);
    mud.getStore().close();
              ses.invalidate();
    out.println("<html><body>Logged out OK</body></html>");
    } catch (MessagingException mex) {
    out.println(mex.toString());
         } else {
         // display headers
         displayHeaders(mud, req, out);
    /* main method to display messages */
    private void displayMessage(MailUserData mud, HttpServletRequest req,
                        ServletOutputStream out, int msgNum)
         throws IOException {
         out.println("<html>");
    out.println("<HEAD><TITLE>JavaMail Servlet</TITLE></HEAD>");
         out.println("<BODY bgcolor=\"#ccccff\">");
         out.print("<center><font face=\"Arial,Helvetica\" ");
         out.println("font size=\"+3\"><b>");
         out.println("Message " + (msgNum+1) + " in folder " +
              mud.getStore().getURLName() +
              "/INBOX</b></font></center><p>");
         try {
         Message msg = mud.getFolder().getMessage(msgNum);
         // first, display this message's headers
         displayMessageHeaders(mud, msg, out);
         // and now, handle the content
         Object o = msg.getContent();
         //if (o instanceof String) {
         if (msg.isMimeType("text/plain")) {
              out.println("<pre>");
              out.println((String)o);
              out.println("</pre>");
         //} else if (o instanceof Multipart){
         } else if (msg.isMimeType("multipart/*")) {
              Multipart mp = (Multipart)o;
              int cnt = mp.getCount();
              for (int i = 0; i < cnt; i++) {
              displayPart(mud, msgNum, mp.getBodyPart(i), i, req, out);
         } else {
              out.println(msg.getContentType());
         } catch (MessagingException mex) {
         out.println(mex.toString());
         out.println("</BODY></html>");
         out.close();
    * This method displays a message part. <code>text/plain</code>
    * content parts are displayed inline. For all other parts,
    * a URL is generated and displayed; clicking on the URL
    * brings up the part in a separate page.
    private void displayPart(MailUserData mud, int msgNum, Part part,
                   int partNum, HttpServletRequest req,
                   ServletOutputStream out)
         throws IOException {
         if (partNum != 0)
         out.println("<p><hr>");
    try {
         String sct = part.getContentType();
         if (sct == null) {
              out.println("invalid part");
              return;
         ContentType ct = new ContentType(sct);
         if (partNum != 0)
              out.println("<b>Attachment Type:</b> " +
                   ct.getBaseType() + "<br>");
         if (ct.match("text/plain")) {
              // display text/plain inline
              out.println("<pre>");
              out.println((String)part.getContent());
              out.println("</pre>");
         } else {
              // generate a url for this part
              String s;
              if ((s = part.getFileName()) != null)
              out.println("<b>Filename:</b> " + s + "<br>");
              s = null;
              if ((s = part.getDescription()) != null)
              out.println("<b>Description:</b> " + s + "<br>");
              out.println("<a href=\"" +
                   HttpUtils.getRequestURL(req) +
                   "?message=" +
                   msgNum + "&part=" +
                   partNum + "\">Display Attachment</a>");
         } catch (MessagingException mex) {
         out.println(mex.toString());
    * This method gets the stream from for a given msg part and
    * pushes it out to the browser with the correct content type.
    * Used to display attachments and relies on the browser's
    * content handling capabilities.
    private void displayPart(MailUserData mud, int msgNum,
                   int partNum, ServletOutputStream out,
                   HttpServletResponse res)
         throws IOException {
         Part part = null;
    try {
         Message msg = mud.getFolder().getMessage(msgNum);
         Multipart mp = (Multipart)msg.getContent();
         part = mp.getBodyPart(partNum);
         String sct = part.getContentType();
         if (sct == null) {
              out.println("invalid part");
              return;
         ContentType ct = new ContentType(sct);
         res.setContentType(ct.getBaseType());
         InputStream is = part.getInputStream();
         int i;
         while ((i = is.read()) != -1)
              out.write(i);
         out.flush();
         out.close();
         } catch (MessagingException mex) {
         out.println(mex.toString());
    * This is a utility message that pretty-prints the message
    * headers for message that is being displayed.
    private void displayMessageHeaders(MailUserData mud, Message msg,
                        ServletOutputStream out)
         throws IOException {
         try {
         out.println("<b>Date:</b> " + msg.getSentDate() + "<br>");
    Address[] fr = msg.getFrom();
    if (fr != null) {
    boolean tf = true;
    out.print("<b>From:</b> ");
    for (int i = 0; i < fr.length; i++) {
    out.print(((tf) ? " " : ", ") + getDisplayAddress(fr));
    tf = false;
    out.println("<br>");
    Address[] to = msg.getRecipients(Message.RecipientType.TO);
    if (to != null) {
    boolean tf = true;
    out.print("<b>To:</b> ");
    for (int i = 0; i < to.length; i++) {
    out.print(((tf) ? " " : ", ") + getDisplayAddress(to[i]));
    tf = false;
    out.println("<br>");
    Address[] cc = msg.getRecipients(Message.RecipientType.CC);
    if (cc != null) {
    boolean cf = true;
    out.print("<b>CC:</b> ");
    for (int i = 0; i < cc.length; i++) {
    out.print(((cf) ? " " : ", ") + getDisplayAddress(cc[i]));
              cf = false;
    out.println("<br>");
         out.print("<b>Subject:</b> " +
              ((msg.getSubject() !=null) ? msg.getSubject() : "") +
              "<br>");
    } catch (MessagingException mex) {
         out.println(msg.toString());
    * This method displays the URL's for the available commands and the
    * INBOX headerlist
    private void displayHeaders(MailUserData mud,
                        HttpServletRequest req,
    ServletOutputStream out)
         throws IOException {
    SimpleDateFormat df = new SimpleDateFormat("EE M/d/yy");
    out.println("<html>");
    out.println("<HEAD><TITLE>JavaMail Servlet</TITLE></HEAD>");
         out.println("<BODY bgcolor=\"#ccccff\"><hr>");
         out.print("<center><font face=\"Arial,Helvetica\" font size=\"+3\">");
         out.println("<b>Folder " + mud.getStore().getURLName() +
              "/INBOX</b></font></center><p>");
         // URL's for the commands that are available
         out.println("<font face=\"Arial,Helvetica\" font size=\"+3\"><b>");
    out.println("<a href=\"" +
              HttpUtils.getRequestURL(req) +
              "?logout=true\">Logout</a>");
    out.println("<a href=\"" +
              HttpUtils.getRequestURL(req) +
              "?compose=true\" target=\"compose\">Compose</a>");
         out.println("</b></font>");
         out.println("<hr>");
         // List headers in a table
    out.print("<table cellpadding=1 cellspacing=1 "); // table
         out.println("width=\"100%\" border=1>"); // settings
         // sender column header
         out.println("<tr><td width=\"25%\" bgcolor=\"ffffcc\">");
         out.println("<font face=\"Arial,Helvetica\" font size=\"+1\">");
         out.println("<b>Sender</b></font></td>");
         // date column header
         out.println("<td width=\"15%\" bgcolor=\"ffffcc\">");
         out.println("<font face=\"Arial,Helvetica\" font size=\"+1\">");
         out.println("<b>Date</b></font></td>");
         // subject column header
         out.println("<td bgcolor=\"ffffcc\">");
         out.println("<font face=\"Arial,Helvetica\" font size=\"+1\">");
         out.println("<b>Subject</b></font></td></tr>");
         try {
         Folder f = mud.getFolder();
         int msgCount = f.getMessageCount();
         Message m = null;
         // for each message, show its headers
         for (int i = 1; i <= msgCount; i++) {
    m = f.getMessage(i);
              // if message has the DELETED flag set, don't display it
              if (m.isSet(Flags.Flag.DELETED))
              continue;
              // from
    out.println("<tr valigh=middle>");
    out.print("<td width=\"25%\" bgcolor=\"ffffff\">");
              out.println("<font face=\"Arial,Helvetica\">" +
                   ((m.getFrom() != null) ?
                   m.getFrom()[0].toString() :
                   "" ) +
                   "</font></td>");
              // date
    out.print("<td nowrap width=\"15%\" bgcolor=\"ffffff\">");
              out.println("<font face=\"Arial,Helvetica\">" +
    df.format((m.getSentDate()!=null) ?
                        m.getSentDate() : m.getReceivedDate()) +
                   "</font></td>");
              // subject & link
    out.print("<td bgcolor=\"ffffff\">");
              out.println("<font face=\"Arial,Helvetica\">" +
              "<a href=\"" +
                   HttpUtils.getRequestURL(req) +
    "?message=" +
    i + "\">" +
    ((m.getSubject() != null) ?
                   m.getSubject() :
                   "<i>No Subject</i>") +
    "</a>" +
    "</font></td>");
    out.println("</tr>");
         } catch (MessagingException mex) {
         out.println("<tr><td>" + mex.toString() + "</td></tr>");
         mex.printStackTrace();
         out.println("</table>");
         out.println("</BODY></html>");
         out.flush();
         out.close();
    * This method handles the request when the user hits the
    * <i>Compose</i> link. It send the compose form to the browser.
    private void compose(MailUserData mud, HttpServletResponse res,
                   ServletOutputStream out)
         throws IOException {
         res.setContentType("text/html");
         out.println(composeForm);
         out.close();
    * This method processes the send request from the compose form
    private void send(HttpServletRequest req, HttpServletResponse res,
              ServletOutputStream out, HttpSession ssn)
         throws IOException {
    String to = req.getParameter("to");
         String cc = req.getParameter("cc");
         String subj = req.getParameter("subject");
         String text = req.getParameter("text");
         try {
         MailUserData mud = getMUD(ssn);
         if (mud == null)
              throw new Exception("trying to send, but not logged in");
         Message msg = new MimeMessage(mud.getSession());
         InternetAddress[] toAddrs = null, ccAddrs = null;
         if (to != null) {
              toAddrs = InternetAddress.parse(to, false);
              msg.setRecipients(Message.RecipientType.TO, toAddrs);
         } else
              throw new MessagingException("No \"To\" address specified");
         if (cc != null) {
              ccAddrs = InternetAddress.parse(cc, false);
              msg.setRecipients(Message.RecipientType.CC, ccAddrs);
         if (subj != null)
              msg.setSubject(subj);
         URLName u = mud.getURLName();
         msg.setFrom(new InternetAddress(u.getUsername() + "@" +
                             u.getHost()));
         if (text != null)
              msg.setText(text);
         Transport.send(msg);
         out.println("<h1>Message sent successfully</h1></body></html>");
         out.close();
         } catch (Exception mex) {
         out.println("<h1>Error sending message.</h1>");
         out.println(mex.toString());
         out.println("<br></body></html>");
    // utility method; returns a string suitable for msg header display
    private String getDisplayAddress(Address a) {
    String pers = null;
    String addr = null;
    if (a instanceof InternetAddress &&
    ((pers = ((InternetAddress)a).getPersonal()) != null)) {
         addr = pers + " "+"<"+((InternetAddress)a).getAddress()+">";
    } else
    addr = a.toString();
    return addr;
    // utility method; retrieve the MailUserData
    // from the HttpSession and return it
    private MailUserData getMUD(HttpSession ses) throws IOException {
         MailUserData mud = null;
         if (ses == null) {
         return null;
         } else {
         if ((mud = (MailUserData)ses.getValue("javamailservlet")) == null){
              return null;
         return mud;
    public String getServletInfo() {
    return "A mail reader servlet";
    * This is the HTML code for the compose form. Another option would
    * have been to use a separate html page.
    private static String composeForm = "<HTML><HEAD><TITLE>JavaMail Compose</TITLE></HEAD><BODY BGCOLOR=\"#CCCCFF\"><FORM ACTION=\"/servlet/JavaMailServlet\" METHOD=\"POST\"><input type=\"hidden\" name=\"send\" value=\"send\"><P ALIGN=\"CENTER\"><B><FONT SIZE=\"4\" FACE=\"Verdana, Arial, Helvetica\">JavaMail Compose Message</FONT></B><P><TABLE BORDER=\"0\" WIDTH=\"100%\"><TR><TD WIDTH=\"16%\" HEIGHT=\"22\">     <P ALIGN=\"RIGHT\"><B><FONT FACE=\"Verdana, Arial, Helvetica\">To:</FONT></B></TD><TD WIDTH=\"84%\" HEIGHT=\"22\"><INPUT TYPE=\"TEXT\" NAME=\"to\" SIZE=\"30\"> <FONT SIZE=\"1\" FACE=\"Verdana, Arial, Helvetica\"> (separate addresses with commas)</FONT></TD></TR><TR><TD WIDTH=\"16%\"><P ALIGN=\"RIGHT\"><B><FONT FACE=\"Verdana, Arial, Helvetica\">CC:</FONT></B></TD><TD WIDTH=\"84%\"><INPUT TYPE=\"TEXT\" NAME=\"cc\" SIZE=\"30\"> <FONT SIZE=\"1\" FACE=\"Verdana, Arial, Helvetica\"> (separate addresses with commas)</FONT></TD></TR><TR><TD WIDTH=\"16%\"><P ALIGN=\"RIGHT\"><B><FONT FACE=\"Verdana, Arial, Helvetica\">Subject:</FONT></B></TD><TD WIDTH=\"84%\"><INPUT TYPE=\"TEXT\" NAME=\"subject\" SIZE=\"55\"></TD></TR><TR><TD WIDTH=\"16%\"> </TD><TD WIDTH=\"84%\"><TEXTAREA NAME=\"text\" ROWS=\"15\" COLS=\"53\"></TEXTAREA></TD></TR><TR><TD WIDTH=\"16%\" HEIGHT=\"32\"> </TD><TD WIDTH=\"84%\" HEIGHT=\"32\"><INPUT TYPE=\"SUBMIT\" NAME=\"Send\" VALUE=\"Send\"><INPUT TYPE=\"RESET\" NAME=\"Reset\" VALUE=\"Reset\"></TD></TR></TABLE></FORM></BODY></HTML>";
    * This class is used to store session data for each user's session. It
    * is stored in the HttpSession.
    class MailUserData {
    URLName url;
    Session session;
    Store store;
    Folder folder;
    public MailUserData(URLName urlname) {
         url = urlname;
    public URLName getURLName() {
         return url;
    public Session getSession() {
         return session;
    public void setSession(Session s) {
         session = s;
    public Store getStore() {
         return store;
    public void setStore(Store s) {
         store = s;
    public Folder getFolder() {
         return folder;
    public void setFolder(Folder f) {
         folder = f;

    You posted a thousand lines of badly-formatted code and didn't have the sense to say which one had the exception.
    My guess is that it was this one:Session session = Session.getDefaultInstance(props, null);because that happened to me. I fixed it by calling getInstance instead of getDefaultInstance.
    However if that isn't the problem, how about spending a few seconds to post a less useless question?

Maybe you are looking for

  • Problems with Prepared Statement

    Hi, I am developing an Java Bean that reads from a database of Entertainments of my home city of Glasgow and displays that info to a text area. I want the User to input the type of Entertainment they want e.g. Bars or Clubs, and the name of the place

  • Moving photos from an iPhone to another with an iMac

    I was at a friends house and wanted to move 30 of his photos from his IMac to my iPhone, when I connected my iPhone to his iMac we could see my iPhone on his iMac\iTunes but couldn't copy the photos to my iPhone, Is there an easy way to do this? than

  • Oracle Apps  Implementation

    Hi, Please give the detail of Oracle Apps Implementation life cycle in Finance modul: AP, AR, GL, FA, CM

  • Flash Air For Android FaceBook Invaild Hash Key Error

    Hi all, I'm getting facebook connect error with flash/air app on Android device , anyone can help me plz ? http://screencast.com/t/Ff6yqVqk 2jmj7l5rSw0yVb/vlWAYkK/YBwk=

  • Xcelsius save button not working

    Hi Experts, I am trying to export the Xcelsiud dashboard to the CMS server but the SAVE button does not work. I am using the 5.3.0.0 version. Please advice Regards Lerato