Qustion about weblogic java mail

          hello
          i config a mail session in my weblogic8,when i run following code,the exception
          is thrown:
          Hashtable ht=new Hashtable();
          ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
          ht.put(Context.PROVIDER_URL,"t3://localhost:7001");
          try {
          InitialContext ic = new InitialContext(ht);
          Session session = (Session) ic.lookup("MyMailSession");
          catch (Exception ex) {
          ex.printStackTrace();
          the exception is:
          javax.naming.ConfigurationException. Root exception is java.rmi.MarshalException:
          error marshalling return; nested exception is:
               java.io.NotSerializableException: javax.mail.Session
               at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)
               at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:284)
               at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:244)
               at weblogic.jndi.internal.ServerNamingNode_811_WLStub.lookup(Unknown Source)
               at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338)
               at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:333)
               at javax.naming.InitialContext.lookup(InitialContext.java:347)
               at SendMail.main(SendMail.java:16)
          Caused by: java.io.NotSerializableException: javax.mail.Session
               at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
               at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
               at weblogic.common.internal.ChunkedObjectOutputStream.writeObject(ChunkedObjectOutputStream.java:114)
               at weblogic.rjvm.MsgAbbrevOutputStream.writeObject(MsgAbbrevOutputStream.java:93)
               at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
               at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:466)
               at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:108)
               at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:409)
               at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:353)
               at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
               at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:404)
               at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
               at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
               at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
          why?who can help me?
          thank you
          

Hi,
          This a JMS forum, not a mail forum.
          They are very different animals.
          Try posting to "general", or perhaps "jndi".
          Tom
          zbcong wrote:
          > hello
          > i config a mail session in my weblogic8,when i run following code,the exception
          > is thrown:
          >
          >
          >
          > Hashtable ht=new Hashtable();
          > ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
          > ht.put(Context.PROVIDER_URL,"t3://localhost:7001");
          > try {
          > InitialContext ic = new InitialContext(ht);
          > Session session = (Session) ic.lookup("MyMailSession");
          > }
          > catch (Exception ex) {
          > ex.printStackTrace();
          > }
          >
          >
          >
          >
          >
          > the exception is:
          >
          >
          > javax.naming.ConfigurationException. Root exception is java.rmi.MarshalException:
          > error marshalling return; nested exception is:
          >      java.io.NotSerializableException: javax.mail.Session
          >      at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)
          >      at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:284)
          >      at weblogic.rmi.cluster.ReplicaAwareRemoteRef.invoke(ReplicaAwareRemoteRef.java:244)
          >      at weblogic.jndi.internal.ServerNamingNode_811_WLStub.lookup(Unknown Source)
          >      at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:338)
          >      at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:333)
          >      at javax.naming.InitialContext.lookup(InitialContext.java:347)
          >      at SendMail.main(SendMail.java:16)
          > Caused by: java.io.NotSerializableException: javax.mail.Session
          >      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
          >      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
          >      at weblogic.common.internal.ChunkedObjectOutputStream.writeObject(ChunkedObjectOutputStream.java:114)
          >      at weblogic.rjvm.MsgAbbrevOutputStream.writeObject(MsgAbbrevOutputStream.java:93)
          >      at weblogic.jndi.internal.RootNamingNode_WLSkel.invoke(Unknown Source)
          >      at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:466)
          >      at weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java:108)
          >      at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:409)
          >      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:353)
          >      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
          >      at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:404)
          >      at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
          >      at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
          >      at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
          >
          >
          >
          > why?who can help me?
          > thank you
          

Similar Messages

  • Weblogic Java Mail Session

    Cannot figure out what's the problem?
    I'm trying to send e-mail via Weblogic Mail Session EJB, the code seems pretty right to me, but it's always is throwing an exception.
    For SMTP I'm using personal computer SMTP service (Win XP), smtp.host=my IP address, user=domain name.
    --- begin ---
    javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.SendFailedException: Invalid Addresses; nested exception is: javax.mail.SendFailedException: 550 5.7.1 Unable to relay for [email protected] at javax.mail.Transport.send0(Transport.java:219)
    --- end ---
    Does anyone have an idea what's the glitch?

    This looks like a relay problem. Usually, ISPs have mail locked down so that you cannot send from their SMTP server without being logged in through them. They need to verify that you have an account with them and that you are logged on through that account ... usually done by checking to see if you have done a POP login in the last X number of minutes.
    Hope this helps.
    Paul

  • Workflow Java Mailer - Where is it?

    Hi,
    I have installed Oracle Workflow Server Release 10.1.0.3 for Linux x86 standalone on a on a 10.1.0.4 database run the configuration assistant. The DAD is configured in the 10G Standalone HTTPD which i installed from the 10.1.0.3 companion CD and after sorting out a number of installation issues the installation was successful.
    I have one missing component and that is the Java Mailer which is said to be 'included' with Workflow server 2.6.3 in the install notes:
    Oracle® Workflow Installation Notes for Oracle Database Release 2.6.3 February 2004 Part No. B12169-01
    Quote "Java-based Workflow Notification Mailer: The Notification System includes a Java-based program called a notification mailer, implemented as a service component within the Generic Service Component Framework, which communicates notifications to users via e-mail and interprets responses. Oracle Workflow provides one seeded notification mailer service component called the Workflow Notification Mailer. This program requires an outbound SMTP mail server and an inbound IMAP mail server"
    after chasing my tail for hours trying to find where and how this components needs to be installed I came across 266612.1 which has some references to a. Oracle® Content Management SDK 10g (9.0.4.2.0) and Oracle® Application Server Integration 10g (10.1.2.0.0).
    I have looked at the documentation for these two components and there is nothing specific mentioned about the Java Mailer, although workflow is mentioned amoung other things..
    If someone could point me in the right direction i would be exceedingly grateful. What I thought was a simple exercise in getting workflow installed and being able to send emails using the standard workflow API's and turned into a monumental journey of frustration and utter waste of time which a customer is paying for.
    Reading between the lines it looks like i need yet another installation of Oracle (the 10.1.2) application server along with the two components above.
    Also, Workflow 2.6.4 is included in the 10G Release 2 Database companion CD. Is the Java Mailer included with this version?
    My apologies if this post has come across somewhat indignant, I get annoyed when people flame in posts and then ask for help, but i am genuinely needing advice from someone who done the seemingly impossible.
    regards,
    Brenden

    Sorry, for database installation there is a seperate application to manage workflow (can't remember the name but you can find it in the apache server middle tier or you can view "install" folder a WF***MANAGER.ear file in there, start up your apache and run it in your browser ).
    The parameter you entered in config assistant for mailer isn't enough to get it working because you need some extra bits, for example the password and the path that points to processed folder and discard folder, etc. All of these bit can be set in workflow manager, remember don't keep looking for the JAR file for mailer, even if you found it you can do nothing about it unless you successfully run the workflow manager after installation.
    Once you have the workflow manager up and running you shall be able to config the mailer in there.
    List of steps: (if you go for silent installation you don 't need to do the post config in workflow manager anymore, and mailer shall be ready to run)
    for wf shipped with DB
    1. follow offical installation note
    2. it will ask for a apache home to be used as middle tier
    3. run through all steps
    4. find Wf manager and run the config through the interface.
    5. test the mailer in wf manager
    I would like someone correct if wrong because I have no experience to set up wf server shipped with DB, but for the one shipped with CMSDK I can answer you alot.
    Regards,
    Kun

  • Java Mail with Servlets

    Hello friends ,
    I am using win-2000 OS.I want to know @ mail servers IMAP & SMTP .How I can get these services ?or Can I use my tomcat server ? by configuring it & how to configure .If not possible then how to get these services.

    Can u please explain clearly what u want?
    do u want to know about mail servers or u just want to know about how to use Java Mail Api in your jsp/servlets.
    As far as i am aware there is no such thing as SMTP or IMAP services in Tomcat....SMTP and IMAP are protocols and it can be implemented by a separate servers..u can find lot of free email servers in the net..
    And u can install them in ur environment and use them..
    And about the Java Mail api it is java's client side implementation of SMTP,POP3 email protocols...u can use these api's to send and receive email programmatically...
    If u want more details don't hesitate to contact me.

  • Java Mail/EJB/WebLogic/weblogicSP6 "No Such Provider Exception"

    Hi,
    My application that is coded to send e-mail is not performing at all.
    Application architecture is as follows:
    1)JSP-EJB on Web Logic App server and
    2)SMTP Host is IIS server and its SMTP service.
    3)Using Java Mail API and installed Service Pack 6 of WebLogic that supports Java Mail API
    4)EJB Programs coded as per the Sun JavaMail API documentation.
    5)Send Mail occuring in the EJB.
    Runtime Error: "No such provider exception"
    Could u help me by instructing me about:
    1)weblogic service pack installation.
    2)sample ejb
    PS:Same code on a simple java class fired on command line is executing without any exception. Wheras in an EJB on Weblogic is throwing the exception.

    That error you are seeing typically comes from JavaMail being unable to
    contact the SMTP host. Are you sure that you are a valid user/permitted to
    access the mailer?
    Thanks,
    Michael
    Michael Girdley
    BEA Systems Inc
    "Omm" <[email protected]> wrote in message
    news:3a3cd390$[email protected]..
    >
    Hi,
    My application that is coded to send e-mail is not performing at all.
    Application architecture is as follows:
    1)JSP-EJB on Web Logic App server and
    2)SMTP Host is IIS server and its SMTP service.
    3)Using Java Mail API and installed Service Pack 6 of WebLogic thatsupports Java Mail API
    4)EJB Programs coded as per the Sun JavaMail API documentation.
    5)Send Mail occuring in the EJB.
    Runtime Error: "No such provider exception"
    Could u help me by instructing me about:
    1)weblogic service pack installation.
    2)sample ejb
    PS:Same code on a simple java class fired on command line is executingwithout any exception. Wheras in an EJB on Weblogic is throwing the
    exception.
    >
    >

  • About Java Mail Api ...Please help..?

    Hi,
    I am sending email thruogh java mail api. Email has sent but in console, It is in debug mode as this is the messages:
    DEBUG: JavaMail version 1.4.1*
    DEBUG: not loading file: C:\Program Files\Java\jdk1.6.0_10\jre\lib\javamail.providers*
    DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.6.0_10\jre\lib\javamail.providers (The system cannot find the file specified)*
    DEBUG: !anyLoaded*
    DEBUG: not loading resource: /META-INF/javamail.providers*
    DEBUG: successfully loaded resource: /META-INF/javamail.default.providers*
    DEBUG: Tables of loaded providers*
    +DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]}+*
    +DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]}+*
    DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map*
    DEBUG: !anyLoaded*
    DEBUG: not loading resource: /META-INF/javamail.address.map*
    DEBUG: not loading file: C:\Program Files\Java\jdk1.6.0_10\jre\lib\javamail.address.map*
    DEBUG: java.io.FileNotFoundException: C:\Program Files\Java\jdk1.6.0_10\jre\lib\javamail.address.map (The system cannot find the file specified)*
    it is printing more statements. I just want to remove that can i ? I had tried session.setDebug(false). But still showing me debug messages. please tell me it is really urgent.
    thanks in advance.
    Manveer
    Edited by: Manveer-Singh on Feb 2, 2010 5:25 PM

    Remove the logger statement from your program,
    or
    Check your IDE is in debug mode
    or
    paste your code and tell what environment are you using.

  • Can java mail be used for distributed exchange server?

    H,
    I am trying to connect to MS Exchange Server to read my mails using Java Mail API.
    I have a questions about using it with Exchange server.
    We have 6-7 exchange servers in our company and different users have mailboxes on different servers. My internet mail application will be used by everybody in the company.
    But while connecting to exchange server using java mail I can only cnnnect to one server and port. What happens when user mailbox is not on that server. How can I use javamail in this scenario where user mailboxes are on separate servers??
    Thanks
    [email protected]

    You said that you can connect to Exchange server my you help me with this because i cant connect to Exchange server, mayby you can post me a code example? Thanks

  • This is regarding CBMA in SAP PI 7.3.1. I have set up the alert mail using default java mail client.I do receive the alerts via mail. But my requirement is to direct all the mails to Business workplace inbox in ECC.

    This is regarding CBMA in single stack SAP PI 7.3.1. I have set up the alert mail using default java mail client.I do receive the alerts via mail. But my requirement is to direct all the alert mails to Business workplace inbox in ECC.
    So I need to set up PI to redirect mails to ECC Business workplace user inbox (sbwp). From here rules are set up & routed per distribution list.
    Please guide me how I can achieve this requirement.

    Hi,
    yes, it is a little bit different. This is the issue.....  
    But I am not sure if your links will help:
    1) /people/william.li/blog/2008/02/13/sap-pi-71-mapping-enhancements-series-using-graphical-variable
    is about a different solution. I do not need to count the number of lines of the source message.
    And the second variable is about concat line by line from unbound node to unbound node.
    My issue is:
    Souce:
    Message line (0...unbound) ! ! ! ! ! ! ! !
    .    ResultLine   (1..1)
    Mapping:
    =>   ResultLine1
           ResultLine2
           ResultLine........          => into UDF to an element  (1..1) in one mapping operation.
    So that all "ResultLine"s are included.
    The result is explained in the given link for Mail attachment with UDF.
    So I am not sure how to use this thread for my issue.
    In the comments of that blog Christoph Gerber writes that the new variable feature can only handle single values.
    So it is not suitable for my purposes as I have a list of values here that needs to be moved into the target message field.
    2) http://wiki.sdn.sap.com/wiki/display/Java/UsingEditJavaSectioninMessageMapping
    shows where to find the button "Java section" which is not available here in 7.1
    3) /people/sap.user72/blog/2005/10/01/xi-new-features-in-sp14
    too is about the nice little button for Java Section that is no longer existing on PI 7.1 screen for mappings.  
    So my issue is: How to replace the Java section function with global variables in PI 7.1?
    Best regards
    Dirk

  • Java Mail Madness - Doesn't Work but shows no errors ?

    What's up folks. I am trying to implement the java mail library. Unfortunately, I have a problem and I don't know how to track it down. Here is the code that I run in the Netbeans IDE.
    import java.io.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.activation.*;
    public class SendApp {
    public static void send(String smtpHost, int smtpPort,
    String from, String to,
    String subject, String content)
    throws AddressException, MessagingException {
    // Create a mail session
    java.util.Properties props = new java.util.Properties();
    props.put("mail.smtp.host", smtpHost);
    props.put("mail.smtp.port", ""+smtpPort);
    Session session = Session.getDefaultInstance(props, null);
    // Construct the message
    Message msg = new MimeMessage(session);
    msg.setFrom(new InternetAddress(from));
    msg.setRecipient(Message.RecipientType.TO, new InternetAddress(to));
    msg.setSubject(subject);
    msg.setText(content);
    // Send the message
    Transport.send(msg);
    public static void main(String[] args) throws Exception {
    // Send a test message
    send("kernel", 25, "jd@kernel", "[email protected]",
    "re: dinner", "How about at 7?");
    Where kernel is the domain name of my computer. However, when I check my email at [email protected] (fake address) I don't see anything and the program exits with success. I don't know if this is cause of a problem with my Netbeans, my code, or my postfix smtp system. Any help is greatly appreciated !
    SIncerely,
    Justin Dallas

    Hi,
    Did you checked the log for any errors
    catch (Exception e) {
         System.out.println("Exception while sending mail" + e.getMessage());
         e.printStackTrace();
    Or else add the following line in your exception handler and check whether their is any error or not.
    wdComponentAPI.getMessageManager().reportException(e.getMessage());
    Regards
    Ayyapparaj

  • Java Mail problem

    I want to used java mail api code in sun application server.But i hava a problem with configuration about HOST:
    String from = "[email protected]";
    String host = "http://localhost:4848/";
    Properties props = new Properties();
    props.put("mail.smtp.host", host);

    Nayana,
    host name should be your mail server name
    Eg: mail.google.com

  • How to use a progress bar with java mail?

    Hi, i'm new here.
    I want if someone can recommend me how to show a progress bar with java mail.
    Because, i send a message but the screen freeze, and the progress bar never appear, after the send progress finish.
    Thanks

    So why would the code we post be any different than the code in the tutorial? Why do you think our code would be easier to understand? The tutorial contains explanations about the code.
    Did you download the code and execute it? Did it work? Then customize the code to suit your situation. We can't give you the code because we don't know exactly what you are attempting to do. We don't know how you have changed to demo code so that it no longer works. Its up to you to compare your code with the demo code to see what the difference is.

  • Can't using J2EE java mail?

    hi all,
    Here is a problem that I have with my the usage of Java Mail Session
    that i set up in weblogic. I use weblogic 8.1
    When I do the JNDI lookup to the mail session (set up in the weblogic
    admin interface), it looks that the lookup itself is ok but when i do
    the casting, it doesn't work. Have a look at my code and the trace
    produced :
    writed an external client,follow:
    <myCode>
    Properties h = new Properties();
    h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory
    h.put(Context.PROVIDER_URL,"t3://localhost:7001"); // provider url is
    right
    h.put(Context.SECURITY_PRINCIPAL,"weblogic");
    h.put(Context.SECURITY_CREDENTIALS,"password");
    Context namingContext = new InitialContext(h);
    Session mailSession = (Session) namingContext.lookup("jndi/mail");
    </myCode>
    <trace>
    javax.naming.ConfigurationException. Root exception is
    java.rmi.MarshalExceptio
    n: error marshalling return; nested exception is:
    java.io.NotSerializableException: javax.mail.Session
    java.io.NotSerializableException: javax.mail.Session
    <<no stack trace available>>
    </trace>
    I can understand the exception as javax.mail.Session doesn't implement
    serializble. But How do I have to do to make it work, then? Because what
    I do is just how it's explained in the weblogic doc. Is there a mistake
    in the do? Do I have to cast to somethig else?
    Any help would be very appraciated.
    Thanks.

    Try this on the server side not from external client - that should work fine.
    If you need this from an external client, since the java.mail.Session object is not serializable - you can also implement an EJB and have your client lookup the session bean and send the data to the server and have the serverside session bean implementation create the mail session and interact.
    hth
    sree

  • Problem using Java Mail API with WLS 7.0

    Hi All,
    I am trying to use the Java Mail API provided by WLS 7.0. I have made the
    settings metioned in the WLS 7.0 docs. However when I try to run the program I
    am getting the following error:
    javax.naming.NoInitialContextException: Need to specify class name in environment
    or system property, or as an applet parameter, or in an application resource file:
    java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
    46)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.jav
    a:283)
    at javax.naming.InitialContext.lookup(InitialContext.java:350)
    The code that I have written is as follows
    import java.util.*;
    import javax.activation.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.naming.*;
    import java.io.*;
    import java.net.InetAddress;
    import java.util.Properties;
    import java.util.Date;
    public class MailTo {
         public static void main(String args[])
              try
                   //Context ic = getInitialContext();
                   InitialContext ic = new InitialContext();
    /* My jndi name is "testSession" */
                   Session session = (Session) ic.lookup("testSession"); /* THE PROBLEM IS SHOWN
    IN THIS LINE */
                   Properties props = new Properties();
                   props.put("mail.transport.protocol", "smtp");
                   props.put("mail.smtp.host", "XX.XX.XX.XX");
    /* For security reasons I have written the ip add in this format */
                   props.put("mail.from", "[email protected]"); /* for security reasons i have
    changed the mail address */
                   Session session2 = session.getInstance(props);
                   Message msg = new MimeMessage(session2);
                   msg.setFrom();
                   msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse("[email protected]",
    false));
                   msg.setSubject("Test Message");
                   msg.setSentDate(new Date());
                   MimeBodyPart mbp = new MimeBodyPart();
                   mbp.setText("This is a mail sent to you using JAVA Mail API and Weblogic Server");
                   Multipart mp = new MimeMultipart();
                   mp.addBodyPart(mbp);
                   msg.setContent(mp);
                   Transport.send(msg);
              catch(Exception e)
                   e.printStackTrace();
         }//end of main
    public static Context getInitialContext()
         throws NamingException
              Properties p = new Properties();
              p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
              p.put(Context.PROVIDER_URL, "t3://localhost:7501/testWebApp");
                   p.put(Context.SECURITY_PRINCIPAL, "weblogic");
                   p.put(Context.SECURITY_CREDENTIALS, "weblogic");
              return new InitialContext(p);
    }//end of class
    Can anyone please tell me what is the problem. I thought that we cannot directly
    do
    InitialContext ic = new InitialContext();
    So I had written a method getInitialContext() as shown in the above piece of code,
    but that too did not work.
    Eagerly awaiting a response.
    Jimmy Shah

    You can use InitialContext ic = new InitialContext() only if you are using a startup class, servlet or a JSP i.e
    server side code.
    If you are using a java client you need to use Context ic = getInitialContext();
    Try this code
    import java.util.*;
    import javax.activation.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.naming.*;
    import java.io.*;
    import java.net.InetAddress;
    import java.util.Properties;
    import java.util.Date;
    public class MailTo {
    public static void main(String args[])
    try {
    Properties h = new Properties();
    h.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    h.put(Context.PROVIDER_URL, "t3://localhost:7001");
    Context ic = new InitialContext(h);
    Session session = (Session) ic.lookup("testSession");
    Properties props = new Properties();
    props.put("mail.transport.protocol", "smtp");
    props.put("mail.smtp.host", "XX.XX.XX.XX");
    props.put("mail.from", "[email protected]");
    Session session2 = session.getInstance(props);
    Message msg = new MimeMessage(session2);
    msg.setFrom();
    msg.setRecipients(Message.RecipientType.TO,InternetAddress.parse("[email protected]",false));
    msg.setSubject("Test Message");
    msg.setSentDate(new Date());
    MimeBodyPart mbp = new MimeBodyPart();
    mbp.setText("This is a mail sent to you using JAVA Mail API and Weblogic Server");
    Multipart mp = new MimeMultipart();
    mp.addBodyPart(mbp);
    msg.setContent(mp);
    Transport.send(msg);
    catch(Exception e)
    e.printStackTrace();
    }//end of main
    }//end of class
    We have shipped a javamail example in the samples\server\src\examples\javamail folder.
    Jimmy Shah wrote:
    Hi All,
    I am trying to use the Java Mail API provided by WLS 7.0. I have made the
    settings metioned in the WLS 7.0 docs. However when I try to run the program I
    am getting the following error:
    javax.naming.NoInitialContextException: Need to specify class name in environment
    or system property, or as an applet parameter, or in an application resource file:
    java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:6
    46)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.jav
    a:283)
    at javax.naming.InitialContext.lookup(InitialContext.java:350)
    The code that I have written is as follows
    import java.util.*;
    import javax.activation.*;
    import javax.mail.*;
    import javax.mail.internet.*;
    import javax.naming.*;
    import java.io.*;
    import java.net.InetAddress;
    import java.util.Properties;
    import java.util.Date;
    public class MailTo {
    public static void main(String args[])
    try
    //Context ic = getInitialContext();
    InitialContext ic = new InitialContext();
    /* My jndi name is "testSession" */
    Session session = (Session) ic.lookup("testSession"); /* THE PROBLEM IS SHOWN
    IN THIS LINE */
    Properties props = new Properties();
    props.put("mail.transport.protocol", "smtp");
    props.put("mail.smtp.host", "XX.XX.XX.XX");
    /* For security reasons I have written the ip add in this format */
    props.put("mail.from", "[email protected]"); /* for security reasons i have
    changed the mail address */
    Session session2 = session.getInstance(props);
    Message msg = new MimeMessage(session2);
    msg.setFrom();
    msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse("[email protected]",
    false));
    msg.setSubject("Test Message");
    msg.setSentDate(new Date());
    MimeBodyPart mbp = new MimeBodyPart();
    mbp.setText("This is a mail sent to you using JAVA Mail API and Weblogic Server");
    Multipart mp = new MimeMultipart();
    mp.addBodyPart(mbp);
    msg.setContent(mp);
    Transport.send(msg);
    catch(Exception e)
    e.printStackTrace();
    }//end of main
    public static Context getInitialContext()
    throws NamingException
    Properties p = new Properties();
    p.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    p.put(Context.PROVIDER_URL, "t3://localhost:7501/testWebApp");
    p.put(Context.SECURITY_PRINCIPAL, "weblogic");
    p.put(Context.SECURITY_CREDENTIALS, "weblogic");
    return new InitialContext(p);
    }//end of class
    Can anyone please tell me what is the problem. I thought that we cannot directly
    do
    InitialContext ic = new InitialContext();
    So I had written a method getInitialContext() as shown in the above piece of code,
    but that too did not work.
    Eagerly awaiting a response.
    Jimmy Shah--
    Rajesh Mirchandani
    Developer Relations Engineer
    BEA Support

  • Question about Weblogic

    Hello,
    I have a question about Weblogic and would like someone to help me with it.
    I created a JSP and everything was doing fine while i was testing it in Tomcat. But once I started the tests with Weblogic, it seemed Weblo wasn't accepting a class that i used to call from my JPS ( a sax parser). Instead of using my parser, Weblogic was using his default SAXParser, what causes problems to my JSP. Trying to solve this, I changed the classpath in Weblo and putted the jar of my parser in the beginning of the classpath, but it still didn't work. Does anyone have an idea of why Weblogic don't accept my parser and uses its default parser instead?
    Thanks in advance!!
    M@G

    naveen.g wrote:
    How to get the path of the domain, where my application is running, in a java code?
    For example, my domain path is "D:\bea\user_projects\domains\production". How to get this path dynamically?Please start a new topic instead of resurrecting an old and non-related thread and hijacking others' threads.

  • JSP & Java Mail

    Hai Buddies,
    I don't know about JSP (only little bit), Iwant to create a page in jsp any one plzzz help me i will give the details about the the page ie given below..
    The page containning
    --number, name contacts, comments ,action plan,dre name,lead name
    --when i stores the above details to the database a mail is sent to the dre and the lead respectively
    --Using JSP & Java Mail                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    There is a forum on java database connectivity
    http://forum.java.sun.com/forum.jspa?forumID=48
    A forum on java mail
    http://forum.java.sun.com/forum.jspa?forumID=43
    There are loads of tutorials on the sun site and elsewhere, you need to read these and start coding. No-one is going to write this for you.
    Before posting questions use the search bar to the left, most of the questions you ask have been dealt with MANY times before, you will find code quickly using the search facility, saving you a lot of time.

Maybe you are looking for

  • How to populate Adobe LiveCycle Designer generated  PDF Forms with data from Database in Windows app

    Hi I have a PDF template designed in Adobe LiveCycle Designer. This template has form fields which needs to be filled with data programmatically. I am using windows application in C#.Net 2005 in which I want to retrieve data from database and merge t

  • HELP!!! INTERFACE PROBLEMS WITH 8300 :(

    I have a 8300 curve and very recently its been acting very weird by doing the following: 1. trackball click only works occassionally 2. it strangely brings up menus even when i havent selected that option as yet 3. sometimes it automatically activate

  • Halloween Invisibles and Design Mode

    Hmmmmm.....3.1.681 I programatically make a button visible/invisible via: setOldPart_btn.setVisible(false); and this works fine when I run the application. ( The default is invisible on instantiation of the frame ) But... SURPRISE... when I am in the

  • Midnight openings?

    Since you guys aren't doing or planning any future midnight releases in the west coast, why not follow suit to gamestop and do a 9 o clock release? Kind of disappointed with some of these great releases and no events happening. At least do it for gam

  • Master-Detail1-Detail2 w/o showing

    Hi OTN, let's say, we have 3 ADF BC View Objects: Master, Detail1, Detail2. Detail2 is a child of Detail1, not Master. DataModel is: Master -- Detail1 -- -- Detail2 It's working fine, while I show all 3 View Objects on a page. But on my JSF page I wa