Hi,

I think you need to write a policy fie for it which grants security
permission to the java files,I faced this problem in RMI implementation.

Regards
Ruchi

-----Original Message-----
From: Paul Smith [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 19, 2008 4:02 PM
To: Log4J Users List
Subject: Re: Logging events in Applet to server using log4j?

This isn't really a log4j question, because it is because your applet is
running in the browser sandbox, and has no permission to create a Socket
to any other host other than the host it was launched from.

You'll need to configure the applet to run out of the sandbox;
effectively granting it access to connect to hosts other than the web
server it was launched from before this will work.

cheers,

Paul
On 19/02/2008, at 9:23 PM, AbelMacAdam wrote:

>
> Hi all,
>
> At the moment I want to enable logging from an Applet to a file on the

> server. If I have interpreted the documentation correctly, I should 
> use the SocketAppender. But my configuration resulted into an
> AccessControlException:
>
> log4j: Setting property [remoteHost] to ["123.45.67.89"].
> log4j:ERROR Could not find address of ["123.45.67.89"].
> java.security.AccessControlException: access denied 
> (java.net.SocketPermission "123.45.67.89" resolve)
>       at java.security.AccessControlContext.checkPermission(Unknown
Source)
>       at java.security.AccessController.checkPermission(Unknown
Source)
>       at java.lang.SecurityManager.checkPermission(Unknown Source)
>       at java.lang.SecurityManager.checkConnect(Unknown Source)
>       at java.net.InetAddress.getAllByName0(Unknown Source)
>       at java.net.InetAddress.getAllByName(Unknown Source)
>       at java.net.InetAddress.getAllByName(Unknown Source)
>       at java.net.InetAddress.getByName(Unknown Source)
>       at
> org
> .apache
> .log4j.net.SocketAppender.getAddressByName(SocketAppender.java:277)
>       at
> org
> .apache.log4j.net.SocketAppender.setRemoteHost(SocketAppender.java: 
> 298)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>       at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
>       at java.lang.reflect.Method.invoke(Unknown Source)
>       at
> org
> .apache.log4j.config.PropertySetter.setProperty(PropertySetter.java: 
> 206)
>       at
> org
> .apache.log4j.config.PropertySetter.setProperty(PropertySetter.java: 
> 165)
>       at
> org
> .apache
> .log4j.config.PropertySetter.setProperties(PropertySetter.java:130)
>       at
> org
> .apache
> .log4j.config.PropertySetter.setProperties(PropertySetter.java:97)
>       at
> org
> .apache
> .log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java: 
> 689)
>       at
> org
> .apache
> .log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java: 
> 647)
>       at
> org
> .apache
> .log4j
> .PropertyConfigurator
> .configureRootCategory(PropertyConfigurator.java:544)
>       at
> org
> .apache
> .log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:440)
>       at
> org
> .apache
> .log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:476)
>       at
> org
> .apache
> .log4j
> .helpers.OptionConverter.selectAndConfigure(OptionConverter.java:471)
>       at org.apache.log4j.LogManager.<clinit>(LogManager.java:125)
>       at org.apache.log4j.Logger.getLogger(Logger.java:118)
>       at foo.bar.MyApplet.init(MyApplet.java:61)
>       at sun.applet.AppletPanel.run(Unknown Source)
>       at java.lang.Thread.run(Unknown Source)
>
> MyApplet is started from:
> http://123.45.67.89/MyApplet/MyApplet.html
>
> The log4j.properties file of the Applet contains:
> log4j.debug=TRUE
> log4j.rootLogger=INFO, R
>
> log4j.appender.R=org.apache.log4j.net.SocketAppender
> log4j.appender.R.RemoteHost="123.45.67.89"
> log4j.appender.R.Port="6000"
>
> log4j.logger.httpclient.wire.header=DEBUG
> log4j.logger.org.apache.commons.httpclient=DEBUG
> log4j.logger.org.apache.commons.httpclient.HttpClient=DEBUG
>
> What is failing in my configuration?
>
> TIA
> Abel
>
> PS:
> Apache version: 2.2.6
> Log4j version: 1.2.15
>
> From the AccessControlException JavaDoc:
> This exception is thrown by the AccessController to indicate that a 
> requested access (to a critical system resource such as the file 
> system or the network) is denied.
>
> "123.45.67.89" is the IP-address of my system
> --
> View this message in context: 
> http://www.nabble.com/Logging-events-in-Applet-to-server-using-log4j--
> tp15560516p15560516.html Sent from the Log4j - Users mailing list 
> archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

Paul Smith
Core Engineering Manager

Aconex
The easy way to save time and money on your project

696 Bourke Street, Melbourne,
VIC 3000, Australia
Tel: +61 3 9240 0200  Fax: +61 3 9240 0299
Email: [EMAIL PROTECTED]  www.aconex.com

This email and any attachments are intended solely for the addressee.  
The contents may be privileged, confidential and/or subject to copyright
or other applicable law. No confidentiality or privilege is lost by an
erroneous transmission. If you have received this e-mail in error,
please let us know by reply e-mail and delete or destroy this mail and
all copies. If you are not the intended recipient of this message you
must not disseminate, copy or take any action in reliance on it. The
sender takes no responsibility for the effect of this message upon the
recipient's computer system.





DISCLAIMER:
This email may contain confidential or privileged information for the intended 
recipient(s) and the views expressed in the same are not necessarily the views 
of Zensar Technologies Ltd. If you are not the intended recipient or have 
received this e-mail by error, its use is strictly prohibited, please delete 
the e-mail and notify the sender. Zensar Technologies Ltd. does not accept any 
liability for virus infected mails. 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to