Lokachari Paidakula

Greenhorn
+ Follow
since Nov 16, 2001
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Lokachari Paidakula

Hi,
I have an requirement that I should upload more than one file using java mail API and send it to the intended receipients.
Is there any java code available using Java mail API for multiple attachments. Please let me know.
Thanks in Advance
Chari
20 years ago
My actual error message is:
--------------------------------------------------------------
Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/Address
--------------------------------------------------------------
Here is my code:
----------------------------------------------------------------
import java.util.Properties;
import java.util.Date;
import java.text.DateFormat;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
public class sendMailWithAttachment {
public static void main (String args[])
throws Exception {
// String host = args[0]; String from = args[1]; String to = args[2]; String fileAttachment = args[3];
// host and from are customized to amat.
String host = "hostname";
String from = "name1@address1.com";
String fileAttachment = args[0];
InternetAddress allToAddress[] = InternetAddress.parse(args[1]); //comma seperated email addressess
// Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", host);
// Get session
Session session = Session.getInstance(props, null);
// Get current date in the format "Feb 26, 2003"
Date now = new Date();
DateFormat df = DateFormat.getDateInstance();
String currentDate = df.format(now);
// Define message
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipients(Message.RecipientType.TO, allToAddress);
String subjectText = "2x4 User Account Status as of " + currentDate;
message.setSubject(subjectText);
// create the message part
MimeBodyPart messageBodyPart = new MimeBodyPart();
// Fill message
String bodyText = new String();
bodyText = "Hi,\n\n";
bodyText = bodyText + "DO NOT REPLY to this message. This is an automated message.\n";
bodyText = bodyText + "Please find attached DDVvault user Account Status File as of " + currentDate +".\n\n";
bodyText = bodyText + "Regards\n2x4 Support Team\n";
messageBodyPart.setText(bodyText);
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
// Part two is attachment
messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource(fileAttachment);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(fileAttachment);
multipart.addBodyPart(messageBodyPart);
// Put parts in message
message.setContent(multipart);
// Send the message
Transport.send( message );
}
}
----------------------------------------------------------------
do i need to have activation.jar and mail.jar file for this... if yes, where will i get this
21 years ago
Thanks Dirk.. it worked.
But i have this problem..
I am trying to run the file from c: drive as shown below
c:> java d:\report\AttachExample <host> <from> <to> <file>
but it is giving me the following error
"Exception in thread main java.lang.NoClassDefFoundError.
Why is that so?
chari
21 years ago
Hi,
I am trying to compile a program and i am getting arond 19 "cannot resolve symbol" error.
I am using NT. I added C:\jdk1.3.1_02\bin to my path variable.
Also i created CLASSPATH variable which has the value
C:\jdk1.3.1_02\lib\tools.jar;C:\jdk1.3.1_02\lib\dt.jar.
Please let me know what is wrong in this.
Here is my program
-----------------------------------------------
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
import javax.activation.*;
public class AttachExample {
public static void main (String args[])
throws Exception {
String host = args[0];
String from = args[1];
String to = args[2];
String fileAttachment = args[3];
// Get system properties
Properties props = System.getProperties();
// Setup mail server
props.put("mail.smtp.host", host);
// Get session
Session session =
Session.getInstance(props, null);
// Define message
MimeMessage message =
new MimeMessage(session);
message.setFrom(
new InternetAddress(from));
message.addRecipient(
Message.RecipientType.TO,
new InternetAddress(to));
message.setSubject(
"Hello JavaMail Attachment");
// create the message part
MimeBodyPart messageBodyPart =
new MimeBodyPart();
//fill message
messageBodyPart.setText("Hi");
Multipart multipart = new MimeMultipart();
multipart.addBodyPart(messageBodyPart);
// Part two is attachment
messageBodyPart = new MimeBodyPart();
DataSource source =
new FileDataSource(fileAttachment);
messageBodyPart.setDataHandler(
new DataHandler(source));
messageBodyPart.setFileName(fileAttachment);
multipart.addBodyPart(messageBodyPart);
// Put parts in message
message.setContent(multipart);
// Send the message
Transport.send( message );
}
}
-------------------------------------
21 years ago
Hi all,
I have a requirement.
I am doing a reports module.
In the first jsp of this module, the user will select from the form what are the reports he wants. After selection he will submit the form.
Once submitted, my second jsp retrieves the data from the database calculates the reports and displays it to the user. But this process is taking some time.
Hence I would like to add an intermediate loading page i.e..say "Please wait... loading...." or something like this during the process time. Once the process is over it should go to the display jsp
This intermediate loading page should not hit database(performance issues) and also it should have the ability to go back to the previous page when the browser back button is pressed.
Has anybody done this before... please let me know how i should do this?
Thanks in Advance
chari
22 years ago
JSP
I am not able to understand what "XML parser package should support level 2" means. Can anyone of you explain this?
Thank you in Advance
Chari

Originally posted by William Brogden:

java.lang.NoSuchMethodError: org.w3c.dom.Node: method
isSupported(Ljava/lang/String;Ljava/lang/String Z not found
The method isSupported is a DOM level 2 method. You must have an XML parser package that supports level 2. It sounds like your system is finding an earlier parser.
Bill


Hi,
I am creating a snapshot in my application and converting the created xml file to html file. In this process i am using xalan.jar file. My machine is SunOS and I am using Enhydra3.1 as my application server. I get the following error message.

java.lang.NoSuchMethodError: org.w3c.dom.Node: method isSupported(Ljava/lang/String;Ljava/lang/String Z not found
at org.apache.xpath.axes.AxesWalker.getNextNode(AxesWalker.java, Compiled Code)
at org.apache.xpath.axes.AxesWalker.nextNode(AxesWalker.java, Compiled Code)
at org.apache.xpath.axes.LocPathIterator.nextNode(LocPathIterator.java, Compiled Code)
at org.apache.xalan.templates.ElemValueOf.execute(ElemValueOf.java, Compiled Code)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java, Compiled Code)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java, Compiled Code)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java, Compiled Code)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java, Compiled Code)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java, Compiled Code)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java, Compiled Code)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java, Compiled Code)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java, Compiled Code)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java, Compiled Code)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java, Compiled Code)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java, Compiled Code)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java, Compiled Code)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java, Compiled Code)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java, Compiled Code)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java, Compiled Code)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java, Compiled Code)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java, Compiled Code)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java, Compiled Code)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java, Compiled Code)
at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java, Compiled Code)
at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java, Compiled Code)
at org.apache.xalan.transformer.TransformerImpl.applyTemplateToNode(TransformerImpl.java, Compiled Code)
at org.apache.xalan.transformer.TransformerImpl.transformNode(TransformerImpl.java, Compiled Code)
at org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java, Compiled Code)
at java.lang.Thread.run(Thread.java, Compiled Code)
Can anybody help me in this?
Thanks in Advance
Chari