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
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.
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.
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.
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
The glass is neither half full or half empty. It is too big. But this tiny ad is just right: