• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Suppressing Applet alerts when using mail API

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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..
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 22848
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You forgot to attach the screenshots.
 
Swaminathan Natarajan
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic