Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Suppressing Applet alerts when using mail API

 
Swaminathan Natarajan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Im using the following code to send email from my application. Im using JSF (tomahawk), Spring and hibernate in my application. I'm using spring email API classes to send email. This code works perfectly fine in the sense its parsing template and sending emails to the configured email id.


I have defined this class as a managed bean and i have a commanButton is UI which is bound to this sendEmail() method








The problem i have is when i try to invoke the function sendEmail() from my UI it is throwing a series of applet alerts (some 10 of them) . The following are the alerts that i get

1. The applet is attempting to invoke the java/lang/System.getProperty() operation on java.home
2. The applet is attempting to perform a read operation on the file C:\Program Files\java\jre1.5.0_14\javamail.providers
3. The applet is attempting to perform a read operation on the file C:\Program Files\java\jre1.5.0_14\javamail.address.map etc....

For ever applet alert i had to click on 'allow' for it to proceed. But there is no problem in sending mail after that. One more interesting this is i DONT get this alert when i try to execute this java class directly instead of calling the method from another class or from UI.

Can someone please let me know the reason for this applet alert and the way to suppress it?
Its really urgent .. please help

Thank you..
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a number of things applets are not allowed to do for security reasons; accessing local files and reading some of the system properties are in that list of things. See HowCanAnAppletReadFilesOnTheLocalFileSystem for the two principal ways around that.
 
Rob Spoor
Sheriff
Pie
Posts: 20495
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Although I was going to move this to the Spring forum, the Applet forum is a better place. Moving.
 
Swaminathan Natarajan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm working on a web based application . I'm not sure what is the need for applet and why the mail API is executing applets to send mail.

One more question is why do i NOT get such alerts when i run this as a standalone class( i have a main() method)

I'm looking for a solution which will prevent execution of applet rather than changing permission to allow it to access the system files. I need to deploy the application in production environment where i doubt i would be able to change or grant permissions to make applet work.

Can someone please help me out here..

Thanks,
Swami.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh, I see - this is not actually an applet. In that case, I think you had describe what you mean by "applet alert" - can you attach a screenshot?

Standalone applications are generally run without any security managers - so the code can do anything it wants to. But web apps frequently are run with security managers, which -although more permissive than those used for applets- may prevent access to files in the JDK and some other things.

Also, please act on the private message I sent you prior to your next post. Accounts with invalid display names will be closed quickly.
 
Swaminathan Natarajan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Please find attached the screen shots containing the applet alerts i get, in order in which they appear.

Thank you..
Applet alerts.gif
[Thumbnail for Applet alerts.gif]
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You forgot to attach the screenshots.
 
Swaminathan Natarajan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Sorry for missing out the screen shots.. some problems

I have attached it now.Please have a look at it.

Thanks..
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is really odd. Are you running the server on the same machine where you are getting these warnings?
 
Swaminathan Natarajan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Ulf... im running the server on the same machine where you are getting these warnings...

Its basically trying access the JVM properties and system properties of the server machine .When i try running this application using a browser from a different machine also (any other machine than the server) the browser waits for me to click on allow applet in the server machine... which is certainly unacceptable in a web app scenario
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic