geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Mulder <ammul...@alumni.princeton.edu>
Subject Re: javamail issue
Date Fri, 16 Dec 2005 18:15:20 GMT
On 12/16/05, Arun Venugopal <Arun.Venugopal@cognizant.com> wrote:
>            Hi,
>
>  I am sorry if i have made my question more complicated that it really is. My question
was simply that why that piece of code (that i had given in my original mail) does not seem
to work when used with geronimo although it works fine as a standalone java class.

The answer to that is that Geronimo does not include our JavaMail
transports on the class path for your application unless the
application depends on the JavaMail configuration I declared above. 
It's possible we don't even include the interfaces unless you depend
on the JavaMail configuration, I'm not sure about that.  In any case,
bottom line, you won't have the classes you need on your application's
class path without the <import> line I gave you above.

I assume that in your standalone application you added JavaMail to the
class path for the application when you ran it.

Aaron

>  On Thu, 2005-12-15 at 10:44 -0800, Dain Sundstrom wrote:
>  I'm not sure what you are asking.  JavaMail is a specification
> published by the Java Community Process.  We provide a clean room
> implementation of this specification with the Geronimo server
> starting with version 1.0.  If you would like to use the
> implementation published by Sun Microsystems, that is also possible,
> but you will have to acquire that implementation from Sun (it is
> free) since licensing restrictions prevent us from shipping it with
> our server.
>
> -dain
>
> On Dec 15, 2005, at 12:11 AM, Arun Venugopal wrote:
>
> > Hi Aaaron,
> >
> > Does that mean that I cannot use the plain javamail implementation
> > in Geronimo and that I have to use the APIs provided by Geronimo
> >
> > Thanks and regards
> > Arun
> >
> > On Wed, 2005-12-14 at 14:27 -0500, Aaron Mulder wrote:
> >> If you're planning to use Geronimo's JavaMail features, you should
> >> be on a very current version (built from source or the 1.0 release
> >> candidate). Then you want to add a line like this to your Geronimo
> >> deployment plan: <import>geronimo/javamail/1.0/car</import> That
> >> way, you should be sure to get our JavaMail code on the classpath
> >> of your application. The JavaMail configuration is not started by
> >> default, though it should be started when you deploy an
> >> application that depends on it. If you want to start it by hand,
> >> you can always use java -jar bin/deployer.jar start geronimo/
> >> javamail/1.0/car Thanks, Aaron On 12/14/05, Arun Venugopal
> >> <Arun.Venugopal@cognizant.com> wrote: > Hi, > > I have this piece
> >> of code that uses javamail . This code works fine when i try it as
> >> a standalone java application (ie when i put it in java file,
> >> compile it and run it). But when i put this code in an war (and
> >> call it from a servlet) and then deploy the war in geronimo, it
> >> does not work. I am pretty sure that this code is being called as
> >> any System.out.println that i give in between the code gets
> >> displayed in the console. Also i tried out the same code in JBoss
> >> and it seems to work there also. > > I have seen many discussions
> >> in the dev list regarding the JavaMail implementation. But i think
> >> all that is with regards to creating a new API for geronimo in the
> >> lines of the mail API's present in JBoss. And that since i am
> >> using plain java mail it should work irrespective of the
> >> application server. > > Can any one give me any pointers on why i
> >> am having this issue in geronimo and if i can solve it ... > > >
> >> ---------------------------------------------------------------------
> >> -------------------------------------------------- > > //
> >> substitute your mail address here > String from = "a@b.c"; >
> >> String to = "a@b.c"; > //substitute the host name or ip of your
> >> smtp server here > String host = "1.2.3.4"; > Properties props =
> >> new Properties(); > props.put("mail.smtp.host", host); > props.put
> >> ("mail.debug", "true"); > Session session = Session.getInstance
> >> (props); > try { > > Message msg = new MimeMessage(session); >
> >> msg.setFrom(new InternetAddress(from)); > InternetAddress[]
> >> address = {new InternetAddress(to)}; > msg.setRecipients
> >> (Message.RecipientType.TO, address); > msg.setSubject("Test E-Mail
> >> through Java"); > msg.setContent(msg, "text/plain"); >
> >> msg.setSentDate(new Date()); > msg.setText("Test Message"); >
> >> Transport.send(msg); > >
> >> ---------------------------------------------------------------------
> >> ---------------------------------------------------- > > > >
> >> Thanks in advance > > Regards > Arun > > > This e-mail and
any
> >> files transmitted with it are for the sole use of the intended
> >> recipient(s) and may contain confidential and privileged
> >> information. > If you are not the intended recipient, please
> >> contact the sender by reply e-mail and destroy all copies of the
> >> original message. > Any unauthorized review, use, disclosure,
> >> dissemination, forwarding, printing or copying of this email or
> >> any action taken in reliance on this e-mail is strictly >
> >> prohibited and may be unlawful. > > Visit us at http://
> >> www.cognizant.com >
> > This e-mail and any files transmitted with it are for the sole use
> > of the intended recipient(s) and may contain confidential and
> > privileged information.
> > If you are not the intended recipient, please contact the sender by
> > reply e-mail and destroy all copies of the original message.
> > Any unauthorized review, use, disclosure, dissemination,
> > forwarding, printing or copying of this email or any action taken
> > in reliance on this e-mail is strictly
> > prohibited and may be unlawful.
> >
> > Visit us at http://www.cognizant.com
>
>
>
> This e-mail and any files transmitted with it are for the sole use of the intended recipient(s)
and may contain confidential and privileged information.
>  If you are not the intended recipient, please contact the sender by reply e-mail and
destroy all copies of the original message.
>  Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying
of this email or any action taken in reliance on this e-mail is strictly
>  prohibited and may be unlawful.
>
>    Visit us at http://www.cognizant.com
>

Mime
View raw message