Getting a Mail session from Initialcontext

Hi,
Does anyone know how to configure oc4j such that i could get a mail session by looking up in the initial context? I know it could be done in jboss by altering an xml file. But I am not sure how to do it in oc4j. Could someone help please?
Could any one explain to me what is the use of PortableRemoteObject.narrow method used for? As down cast could be done directly, why is there a need for PortableRemoteObject. Thanks
if say, part of the j2ee application (some ejb jar files) is running on a host, and the j2ee application (some different ejb jar files) is running on a different host, and to look up the ejb on diferrent host normal java casting cannot be done cause they are network appart. So we need PortableRemoteObject to do the down casting. Is that right?
If say, on a different situation, a server (orion or weblogic) is running on a host and the j2ee application is on another different host, to get the initial context, we need to set the provider and the uri say something like t3 for weblogic and ormi for orion... Am I right so far? please correct me if i am not. And to lookup the DataSource for connection pooling in order to get a connection, do we need to use portable remove object as well? I think so cause they are separated and they should communicate using rmi-iiop? Is that correct?
Is CreateException, FinderException, RemoveException and EJBException applicable to their respective methods? Say CreateException is thorwn when problems in creating a bean instance and finder when canno find bean due to (maybe connection or sql error) etc. RemoveException when ejbRemove encounter problems and EJBException when business methods cannot succeed? In sun tutorial all methods throw EjbException which confused me. Could someone shed some light on this issue please?
Thanks a lot
Ras

No.

Similar Messages

  • With Acer 5745 laptop, I cant get e-mail deleted from my yahoo mail accont, I can delete e-mails if

    why cant I get e-mails to delete when I sign in to yahoo mail on my laptop? ( Acer 5745 ) They will delete if I access e-mail acct. on my smart phone.

    Hi walkkenn, and a warm welcome to the forums!
    And we never did hear back if it worked for Abstractman23 !
    Is this a POP or IMAP account?
    In the Webmail Interface is there a Trash folder or just a deleted messages folder?

  • How do I get voice mail removed from my iPhone 5s

    I Don't want voice mail on my iphone5s how can I remove this

    Voicemail is provided by your phone carrier, contact them.

  • Get the current session in a Session Bean?

    Hi,
    I know how to get the current session from a Servlet, you use request.getSession().
    However I need access to the current session from a Session Bean. As far as I know, only Servlets have a request object, so I can't use request.getSession()
    Any ideas on how to access the session from a Session Bean?
    Thanks!

    Hi,
    I managed to get around the problem by using a JSP to
    pass a session object to a method in my session bean.
    ThanksJust be aware that the serialized Session object can be a huge stream to remotely pass to your bean...
    Kexkey

  • I can't get e-mail. Keeps refusing my password, or telling me there may be "missing resources" yet my non-Apple accounts all work just fine.

    Having trouble all of a sudden--Mail keeps rejecting my password.  If I sign on to iCloud, password works fine.  Claick on Mail from iCloud, and it will not load, citing "missing resources" or "trouble with server".  Same problem from my iPhone.  Not sure how or where to report the problem--there aren't a lot of "contact Apple" links (at least I can't find any that will reply to a problem).
    I have tried turning off the computer, and I have tried updating it. I have no idea what is doing this, but I need to get e-mail soon from some source! My work depends on it.
    Any suggestions?

    Update to above question:
    Hello All,
    To anyone with the same problem described above, on THEIR iPad (if it is running iOS 7.0.2):
    Go to Settings; Mail, Contacts, Calendars; DELETE your *******@btinternet.com e-mail account, that you originally set up either using 'Other', or the 'BT' option which I am sure was in the list previous to the iOS 7 update.
    Then ADD a NEW account choosing YAHOO from the list of options. DO NOT USE 'OTHER'.
    Enter the correct details just as you (almost certainly) had already done in your previous attempts using 'other'.
    When you see the 'verifying......' and 'the blue ticks' you should be able to exit settings and open your mail app and then receive all your 'old' e-mails again, AND be able to SEND as well.
    All my 'old' e-mails, were NOT found in the 'old e-mail' folder though. THEY are still in my inbox.
    So this fix worked for me.
    After I deleted my account from 'OTHER' and put it in Yahoo, I like other people also ended up with more folders.
    I hope this works for you on YOUR Apple devices.
    Bob

  • Session from Portal Service

    Hi,
    how can I get the HTTP session from within a portal service?
    - Frank

    You can't. You have to pass the request variable from another component to portal service and then grab http session from it.

  • How to stop mail app from embedding photos

    How do I get the Mail App from embedding my photo attachments. I'm using Yahoo that was just migrated from a PC through Migration assistant

    Thanks Linc, it took me a bit to figure out that within this link was a way to close the message viewer, which I've done for now.
    I would still be interested to know if there is a way for the message viewer panel to be open and have mail NOT open the next message automatically.  I do like to have the message panal open.  But I am not sure why the default is to jump to the next message, or why we cannot have it sit at the last messge and allow us to choose when we are ready to read the next message. 
    For now, the link you sent does give me an option.
    Thank you!
    Michelle

  • Can't get mail session

    I'm using
    Context context = new InitialContext();
    Session session = (Session)context.lookup(MAIL_SESSION);
    in a web application running under Sun ONE Application Server 7 Platform Edition and it's throwing me a
    java.lang.ClassCastException: com.sun.enterprise.deployment.MailConfiguration
    on the session. The context.lookup(MAIL_SESSION) is returning an object of type "com.sun.enterprise.deployment.MailConfiguration" instead of "javax.mail.Session", like it should. I used the GUI to set up the mail session. Is something configured wrong, or is this a bug? I can't find any documentation on the com.sun.enterprise.deployment.MailConfiguration class.

    Thanks for the detailed code.
    With more effort I was able to reduce it as shown below.
    com.sun.enterprise.deployment.MailConfiguration is the object I get with the JNDI lookup. This class is present in j2ee.jar (from java-sdk1.4.2) and in /opt/SUNWappserver/lib/appsrvr-rt.jar -- use the former in your IDE to compile the code, and do not deploy the j2ee.jar
    // Acquire our JavaMail session object
    Context initCtx = new InitialContext();
    final MailConfiguration mailConfig = (MailConfiguration)initCtx.lookup("mail/mymail");
    final java.util.Properties props = mailConfig.getMailProperties();
    final javax.mail.Session session = javax.mail.Session.getInstance(props);
    // Prepare our mail message
    final Message message = new MimeMessage(session);
    ....... <rest as in any other sample code u see> ....
    // Transport.send() gets to see
    // ALL the variables attributes of the session instance!
    Transport.send(message);
    // All of the following, does the same as the above ONE LINE OF CODE!
    // // Send our mail message
    // Transport trans = null;
    // try {
    //      // create transport object
    // trans = session.getTransport();
    // trans.connect();
    // // send email
    // trans.sendMessage(message, message.getAllRecipients());
    // }finally{
    // trans.close();
    You can verify that the JNDI lookup worked using these two lines of code...
    //          System.err.println("mailConfig.getMailProperties() returned :- ");
    //          props.list(System.err);
    ================
    Also, I tried all kinds of experiments with SJAS8.0 and 8.1 (as of Jan 2005) and I simply couldn't get hold of the javax.mail.Session object -- the commented code below was my various trials ...
    // Acquire our JavaMail session object
    Context initCtx = new InitialContext();
    // Context envCtx = (Context) initCtx.lookup("java:comp/env");
    // final javax.mail.Session session = (javax.mail.Session) envCtx.lookup("javamail/maakompa");
    //               // This returned a null ptr.
    // final javax.mail.Session session = (javax.mail.Session) initCtx.lookup("java:mail/maakompa");
    // // ClassCastException :- we get an object of type 'com.sun.enterprise.deployment.MailConfiguration mc;'
    //           final Object o = initCtx.lookup("java:comp/env/mail/maakompa");
    //               System.err.println("initCtx.lookup returned type '"+o.getClass().getName()+"'.");
    //get properties and create session
    // java.util.Properties props = new java.util.Properties();
    // props.put("mail-host", "mailfwd0.localdomain");
    // props.put("mail-user", "sarma");
    // props.put("mail-from", "[email protected]");
    // props.put("mail-store.protocol", "pop3");
    // props.put("mail-transport.protocol", "smtp");

  • Does WebSphere pool the connections from Mail session?

    Hi,
    I configured a mail session in WebSphere through the console under 'Mail Providers' and did a lookup of the jndi name as below:
    try{
    javax.naming.InitialContext ctx = new javax.naming.InitialContext();
    javax.mail.Session mailSession = (javax.mail.Session) ctx.lookup("mail/TestSession");
    MimeMessage mm = new MimeMessage(mailSession);
    Transport.send(mm);
    catch (MessagingException me) {
    }It looks like if I invoke this piece of code 10 times, then 10 connections to the mail server is established to send the message. Doesn't WAS handle the connection pooling under the returned MailSession object?
    Thanks

    Ok..this is very confusing...we created a singleton class to hold the mail session and the connected transport like this:
    public class MailCache
         private static MailCache sessionPool = new MailCache();
         private static Session mailSession ;
         private static Transport transport;
         static {
              try
                   mailSession = (Session) LookupHelper.lookup("mail/TestSession");
                   transport = mailSession.getTransport();
                   transport.connect();
         public static Transport getTransport() {
              if (transport == null) {
                   try
                        transport = getMailSession().getTransport();
                        transport.connect();
                   catch (NoSuchProviderException e)
                        e.printStackTrace();
                   catch (MessagingException e1)
                        e1.printStackTrace();
              else {
                   // transport exists, check if connected!
                   if (!transport.isConnected()) {
                        try
                             transport.connect();
                        catch (MessagingException e)
                             e.printStackTrace();
              return transport;
         public static Session getMailSession() {
              if (mailSession == null) {
                   System.out.println("Mail session scoped out");
              return mailSession;
    }and this is how I send the mail:
    MimeMessage message = new MimeMessage(MailCache.getInstance().getMailSession());
    Transport transport = MailCache.getInstance().getTransport();
    transport.send(message);
    ...When I send a bulk mail (for e.g. 20 messages) in a loop (setup as a junit) I notice that 21 connections are established on the smtp server trace for sending the messages. All the connections process exactly 1 message and get disconnected after sending the message. But one connection (i presume its the one that Ia, holding open in the singleton) is never used at all!. What Iam trying to acheive is to have only 1 connection open from my server to send messages. What am I doing wrong?

  • Always get the InternetAddress & javax.mail.Session error

    <%@ page import="javax.mail.*" %>
    <%@ page import="javax.mail.internet.*" %>
    <%@ page import="javax.activation.*" %>
    <%@ page import="java.util.*,java.io.*" %>
    <%@ page contentType="text/html;charset=big5" %>
    <html>
    <head>
    <title>JavaMail</title>
    </head>
    <body>
    <h2>&#21033;&#29992;JavaMail&#20358;&#20659;&#36865;&#38651;&#23376;&#37109;&#20214; - &#38468;&#21152;&#27284;&#26696;</h2>
    <%
    InternetAddress[] address = null;
    request.setCharacterEncoding("big5");
    // MultipartRequest multi = new MultipartRequest(request , "." , 5*1024*1024 , "big5");
    String mailserver = "mail.dwu.edu.tw";
    String From = request.getParameter("From");
    String to = request.getParameter("To");
    String Subject = request.getParameter("Subject");
    String type = request.getParameter("Type");
    String messageText = request.getParameter("Message");
    String FileName = request.getParameter("FileName");
    boolean sessionDebug = false;
    try {
    // &#35373;&#23450;&#25152;&#35201;&#29992;&#30340;Mail &#20282;&#26381;&#22120;&#21644;&#25152;&#20351;&#29992;&#30340;&#20659;&#36865;&#21332;&#23450;
    java.util.Properties props = System.getProperties();
    props.put("mail.host",mailserver);
    props.put("mail.transport.protocol","smtp");
    // &#29986;&#29983;&#26032;&#30340;Session &#26381;&#21209;
    javax.mail.Session mailSession = javax.mail.Session.getDefaultInstance(props,null);
    mailSession.setDebug(sessionDebug);
    Message msg = new MimeMessage(mailSession);
    // &#35373;&#23450;&#20659;&#36865;&#37109;&#20214;&#30340;&#30332;&#20449;&#20154;
    msg.setFrom(new InternetAddress(From));
    // &#35373;&#23450;&#20659;&#36865;&#37109;&#20214;&#33267;&#25910;&#20449;&#20154;&#30340;&#20449;&#31665;
    address = InternetAddress.parse(to,false);
    msg.setRecipients(Message.RecipientType.TO, address);
    // &#35373;&#23450;&#20449;&#20013;&#30340;&#20027;&#38988;
    msg.setSubject(Subject);
    // &#35373;&#23450;&#36865;&#20449;&#30340;&#26178;&#38291;
    msg.setSentDate(new Date());
    if (FileName != null)
    File file = new File(FileName);
    // &#22914;&#26524;&#26377;&#38468;&#21152;&#27284;&#26696;&#26178;&#65292;&#20808;&#23559;&#37109;&#20214;&#20839;&#23481;&#37096;&#20221;&#20808;&#23384;&#36215;&#20358;
    MimeBodyPart mbp1 = new MimeBodyPart();
    // &#35373;&#23450;&#37109;&#20214;&#20839;&#23481;&#30340;&#22411;&#24907;&#28858; text/plain &#25110; text/html
    mbp1.setContent(messageText, type + ";charset=big5");
    // &#20877;&#20358;&#23565;&#27284;&#26696;&#20316;&#34389;&#29702;
    MimeBodyPart mbp2 = new MimeBodyPart();
    FileDataSource fds = new FileDataSource(FileName);
    mbp2.setDataHandler(new DataHandler(fds));
    mbp2.setFileName(MimeUtility.encodeText(fds.getName(), "big5", "B"));
    // &#26368;&#24460;&#20877;&#23559;&#20108;&#32773;&#25972;&#21512;&#36215;&#20358;&#65292;&#30070;&#20316;&#19968;&#20221;&#37109;&#20214;&#36865;&#20986;
    Multipart mp = new MimeMultipart();
    mp.addBodyPart(mbp1);
    mp.addBodyPart(mbp2);
    msg.setContent(mp);
    else
    // &#33509;&#27794;&#26377;&#27284;&#26696;&#26178;&#65292;&#23601;&#30452;&#25509;&#23384;&#37109;&#20214;&#20839;&#23481;
    msg.setContent(messageText,type + ";charset=big5");
    Transport.send(msg);
    out.println("&#37109;&#20214;&#24049;&#38918;&#21033;&#20659;&#36865;");
    catch (MessagingException mex)
    mex.printStackTrace();
    %>
    </body>
    </html>
    ==================================
    i don't know why i always get the error about the type even i already add the jar file in lib folder:
    InternetAddress cannot be resolved to a type
    javax.mail.Session cannot be resolved to a type

    What server are you using?
    Did you follow the instructions on the JavaMail FAQ for setting up the server?
    Did you restart the server?

  • I am running OS10.6.8 and have a mail box duplication. I use gmail and when I open my mail I have both the Apple Mail and another set of boxes for Gmail. Both get all mail and when I delete from one, it deletes from the other. How can I get rid of the dup

    I am running OS10.6.8 and have a mail box duplication. I use gmail and when I open my mail I have both the Apple Mail and another set of boxes for Gmail. Both get all mail and when I delete from one, it deletes from the other. How can I get rid of the dup

    Hi,
    According to your descriptioin, I don't think this is system problem, it should be Intel driver problem. It would be contact Intel to confirm this issue whether this is their driver problem.
    Roger Lu
    TechNet Community Support

  • How do I use Migration Assistant to get my Mail and Keychain settings from

    How do I use Migration Assistant to get my Mail and Keychain settings from my Power Mac G5 2.3Ghz? I just purchased a new 2.5 MacBook Pro which will be delivered tomorrow, and I want to to know how to transfer Mail and Keychain?
    Thank You in advance for your reading and replying.
    Kindest Regards,
    Sebastian

    Rather than using Migration Assistant, which can cause trouble with the PPC to Intel change, simply boot the G5 in FireWire target disk mode and manually transfer the following:
    /Home/Library/Keychains (copy the whole folder)
    /Home/Library/Mail (copy the whole folder)
    /Home/Library/Preferences/com.apple.mail.plist
    You might want to look over Kappy's helpful guide for migrating, which covers the full process for a manual migration (including the above files).
    Hope this helps...

  • I use since 1 year iTunes match. Do I get a mail from apple to renew my subscription or do I have to renew my subscription for my own? I don't know the exactly date from the end of lifetime?

    I use since 1 year iTunes match. Do I get a mail from apple to renew my subscription or do I have to renew my subscription for my own? I don't know the exactly date from the end of lifetime?
    Kind best regards - sunshine34778

    The subscription will renew automatically (unless you have disabled that) and you will get an email approximately one month before renewal.

  • How do I keep my email password from remaining in Preferences? I want to enter it every time I get my mail. I upgraded to OS M Lion but it won't let me delete it from preferences. It's worked prior to using M. Lion. Any suggestions? Thanks!! Jen

    How do I keep my email password from remaining in Preferences? I want to enter it every time I get my mail. I upgraded to OS M Lion but it won't let me delete it from preferences (the password from Account Info). Once you enter the password, it keeps it permanently. i do not want that.  It's worked prior to using M. Lion. Any suggestions? Also, The other pressing issue i have is, I DO NOT want ANY mail showing in my inboxes when Mail starts UNTIL i enter that password for each account. Instead of creating different user accounts for the MacBook, it's just easier this way. Or is it? If this is a permanent thing, then I may switch back to Lion. I guess I shoud've waited until the kinks were out before installing (**** Mac-head!)
    Thank you all kindly for any suggestions & your time
    Regards,
    JC

    I DO NOT want ANY mail showing in my inboxes when Mail starts UNTIL i enter that password for each account.
    That is simply not possible with Mail, and never has been.  Anyone who uses your account can see all messages stored in Mail.  The only true solution is to not let other people use your account.  Let other people use the guest account, or if you share the machine with someone else, set up a separate user account for that person.  This will also solve the problem of remembering the password.  It will become a non-issue for Mail to remember your password if nobody else has access to your account.

  • Not getting e-mails from wireless cam in Windows 8 Mail App

    Please forgive me if this is not being asked in the correct forum.  I could not find another place that seemed to fit.  Feel free to move it if necessary.
    I have two Linksys Wireless IP Cameras.  Both are configured to detection motion and send an e-mail with 5 pictures to my Live.com e-mail address.
    This configuration has been working for over 1 year and works.  To verify, I get e-mails from the both cameras when I use Internet Explorer and login to http:// mail.live.com  with my live.com (aka Hotmail) email account.
    I upgraded to Windows 8, logged on the very first time with my Microsoft Live account.  From all appearances, it looks like the Windows 8 Mail App was configured to use my live.com e-mail account.  There are message there that I see when I login via
    Internet Explorer.
    The problem is, I never ever get any of the emails that were sent from my Wireless Cameras in the Windows 8 Mail app.
    If I sign in to my live.com email account via Internet Explorer those messages are there.  As a test, while I was looking at one of my emails via Internet Explorer, I forwarded it to myself.  That message with pictures and all did arrive in the Windows
    8 Mail app.
    So, does anyone have any ideas why the Windows 8 Mail app does not get the e-mails sent from my Wireless Cameras?
    Thanks,
    Erik

    Normally I do use IE to check my email.  I want to use the new stuff.  Note that the camera is stand alone and not connected to any computers.  It is a wireless IP camera and is configured to send e-mail when it detects motion.  Linksys
    has told me that in general, the camera is compatible with Windows 8 but there are no drivers to plug it in directly to a computer with Window 8.
    You stated that you suspect that the mail app does not support the function.  I'm not sure what you mean by that.  It is a mail application and should present me with any incoming e-mails to my account regardless of where they come from. 
    I know that the camera is working because I can see the message via IE in Windows 8 and in the Mail App on my Windows Phone 7.
    So, if the Windows 8 Mail app does not support the function, why I can view one of the e-mails from my camera using IE in Windows 8 and then forward it to myself at the same e-mail address and then the forwarded message arrives with all the pictures
    attached and is viewable in Windows 8 mail app.
    I have also setup my camera to send e-mail to my work account.  At work we have Exchange and I use Outlook 2010.  I get the messages from the camera in that program without any problems.
    I also get the message using the Windows Phone 7 Mail App.
    I just can't understand why the Windows 8 mail app is ignoring or blocking message that are coming from my cameras.

Maybe you are looking for

  • Transfer of requirements from sales order to production.

    hi  how are the requirements transfered from sales order to MRP. if a sales order is created how is the reqirement getting tranfered to MD04. is it through requirement class and requirement type.

  • How to open editor in oracle11

    In Oracle8 if we type ed and hit Enter it opens the default editor(notepad) where can write a block or edit a query. How to use this feature in Oracle 11?

  • How to make custom start end shapes for stroke (arrowheads)...

    hello... Indesign cs4 have nice start end stroke shapes like arrowheads, circles, squares...circles is clear, without fill. I need fill in it. How to make custom shapes or edit existings start/end shapes to functioning like original provided with ind

  • Crashed and won't open

    Dreamweaver won't open. tried to set up asp. javascrpt for the server and it crashed. I have reinstalled the software, but still no luck. It starts to open, but shuts down half way. Is it some kind of memory I can earse? here's some of the report it

  • Not enough free disk space for encoding the remaining assets?

    I know this will probably sound dumb, but I burned a dvd with less space this morning and now this is the message I'm getting for the same project and I have a little more than what I had last time. Can someone explain this or tell me what I can do?