aspose file tools*
The moose likes Applets and the fly likes Suppressing Applet alerts when using mail API Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Suppressing Applet alerts when using mail API" Watch "Suppressing Applet alerts when using mail API" New topic
Author

Suppressing Applet alerts when using mail API

Swaminathan Natarajan
Greenhorn

Joined: Aug 04, 2009
Posts: 10
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
Marshal

Joined: Mar 22, 2005
Posts: 42612
    
  65
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.


Ping & DNS - my free Android networking tools app
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19761
    
  20

Although I was going to move this to the Spring forum, the Applet forum is a better place. Moving.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Swaminathan Natarajan
Greenhorn

Joined: Aug 04, 2009
Posts: 10
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
Marshal

Joined: Mar 22, 2005
Posts: 42612
    
  65
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

Joined: Aug 04, 2009
Posts: 10
Hi,
Please find attached the screen shots containing the applet alerts i get, in order in which they appear.

Thank you..


[Thumbnail for Applet alerts.gif]

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42612
    
  65
You forgot to attach the screenshots.
Swaminathan Natarajan
Greenhorn

Joined: Aug 04, 2009
Posts: 10
Hi,
Sorry for missing out the screen shots.. some problems

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

Thanks..
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42612
    
  65
That is really odd. Are you running the server on the same machine where you are getting these warnings?
Swaminathan Natarajan
Greenhorn

Joined: Aug 04, 2009
Posts: 10
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Suppressing Applet alerts when using mail API