• Post Reply Bookmark Topic Watch Topic
  • New Topic

JavaMail Errors with Properties object  RSS feed

 
Mike London
Ranch Hand
Posts: 1331
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm having a strange problem where if I use the System.getPropeties() in an email authentication program, as shown below, I get s "SEVERE ERROR" in Tomcat with a problem with PrintWriter.write(...) and a bunch of other Java-internal errors.

The error then results in the home page of the system no longer coming up (-> a blank page until Tomcat restart).

Here's the JavaMail code in question...

Properties props = new Properties();
// props = System.getProperties();
props.put("mail.pop3.host", host);
Session session = Session.getInstance(props, new MyAuthenticator());
.
.
.

In some of the sun (Jguru) sample email code, they say to use props.getProperties(), but in other places in the code, they just use Properties props = new Properties();

This is a bit confusing.

The code runs fine as shown above -- no errors -- working homepage (as long as I don't uncomment the line shown). Even if the props object gets instantiated, it gives the errors and home page doesn't work if I include the System.getProperties().

I found a couple references on the Internet where people had strange errors, exactly like this one, with Properties objects, but no resolution per se.

Any ideas why the commented line, if uncommented, would cause errors?

Thanks in advance.

Mike
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the error you are seeing? Is it a security exception?
[ January 15, 2007: Message edited by: Paul Sturrock ]
 
Mike London
Ranch Hand
Posts: 1331
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Error I was getting was in the tomcat log as a "SEVERE ERROR" with PrintWriter errors and other Java internal ones. I didn't write down the exact error and I've since cleared the log.

Also, I couldn't reproduce it locally. It was just a problem on a Linux server running 5.0.27 of Tomcat.

Thanks for your reply.

Mike
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The Error I was getting was in the tomcat log as a "SEVERE ERROR" with PrintWriter errors and other Java internal ones. I didn't write down the exact error and I've since cleared the log.

"SEVERE ERROR" just sounds like the logging level used to log it, it doesn't have any meaning where the sctual exception is concerned. If you can't give use the exact error, then all we can do is guess.

I asked if it were a security exception because the JavaDocs for System's getProperties method declare that it will throw an exception if the security manage does not allow access to the system properties. If it is still a problem on your Linux server you might want to check that.
 
Mike London
Ranch Hand
Posts: 1331
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul, that's probably it. I'll check into this further.

At least, all is working fine now with just a properties object populated with the pop3 settings.

Thanks again!

M
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!