[Gvsig_desarrolladores] (sin asunto)

Alvaro Zabala azabala en gmail.com
Mie Sep 6 10:25:51 CEST 2006


¿Conseguiste arreglar este problema?

Aquí http://forum.java.sun.com/thread.jspa?forumID=38&threadID=704885

se dice lo siguiente:


Posts:3
Registered: 2/3/06
 * Re: AccessControlException
Feb 8, 2006 7:32 AM (reply 3 of 4) *
  [image: Click to email this
message]<http://forum.java.sun.com/emailmessage%21default.jspa?messageID=4093114>


 Solved the problem by adding some code I found on the net to my plugin.

      Policy.setPolicy(*new* Policy() {
          *public* PermissionCollection getPermissions(CodeSource codesource) {
              Permissions perms = *new* Permissions();
              perms.add(*new* AllPermission());
              *return* (perms);
          }
          *public* *void* refresh() {}
      });



Still don't know why the <security> <all-permissions/> </security> didn't
work, but the above code fixed it.

Florian

  dietz333 <http://forum.java.sun.com/profile.jspa?userID=388004>
Posts:810
Registered: 22/09/03
 * Re: AccessControlException
Feb 10, 2006 6:04 AM (reply 4 of 4) *
  [image: Click to email this
message]<http://forum.java.sun.com/emailmessage%21default.jspa?messageID=4096615>


 The most likely reason is that the code throwing the exception wasn't
loaded by the JNLPClassLoader, but by some other class loader created by the
application.
If an application creates a classloader that dosn't extend
SecureClassLoader, and then runs it with a SecurityManager installed, then
the permissions are determined by the java.policy file in the lib/security
file of the jre. If it does extend SecureClassLoader, then it implements
SecureClassLoader.getPermissions(), and that method is responsible for
assigning the permission set.
The easiest way around this is just to remove the security manager:
System.setSecurityManager(null);

/Andy




Es decir, aunque tu pongas la etiqueta <AllPermissions/> en el fichero JNLP,
si la clase que está intentando acceder al sistema de ficheros no es cargada
por JNLPClassLoader (el class loader de Java Web Start) , y en el caso de
ANDAMI es así (pues se utiliza el PluginClassLoader) si este class loader no
hereda de SecureClassLoader se producirá este tipo de excepción.

Así que en este post se te dan dos alternativas:

a) Policy.setPolicy(....etc.

b) System.setSecurityManager(null)


Saludos.

2006/9/1, mj.gomez en telvent.abengoa.com <mj.gomez en telvent.abengoa.com>:
>
>
> El error completo es este:
>
>
> java.lang.reflect.InvocationTargetException
>         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 com.sun.javaws.Launcher.executeApplication(Unknown Source)
>         at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
>         at com.sun.javaws.Launcher.continueLaunch(Unknown Source)
>         at com.sun.javaws.Launcher.handleApplicationDesc(Unknown Source)
>         at com.sun.javaws.Launcher.handleLaunchFile(Unknown Source)
>         at com.sun.javaws.Launcher.run(Unknown Source)
>         at java.lang.Thread.run(Unknown Source)
> Caused by: java.lang.ExceptionInInitializerError
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>         at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown
> Source)
>         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
> Source)
>         at java.lang.reflect.Constructor.newInstance(Unknown Source)
>         at java.lang.Class.newInstance0(Unknown Source)
>         at java.lang.Class.newInstance(Unknown Source)
>         at com.iver.andami.Launcher.skinPlugin(Launcher.java:480)
>         at com.iver.andami.Launcher.main(Launcher.java:244)
>         ... 11 more
> Caused by: java.security.AccessControlException: access denied (
> java.io.FilePermissionC:\gvSig\extensiones\com.iver.core\classes\javax\swing\DefaultDesktopManager.class
> read)
>         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.checkRead(Unknown Source)
>         at java.io.File.exists(Unknown Source)
>         at com.iver.andami.plugins.PluginClassLoader.singleLoadClass(
> PluginClassLoader.java:178)
>         at com.iver.andami.plugins.PluginClassLoader.loadClass(
> PluginClassLoader.java:227)
>         at java.lang.ClassLoader.loadClass(Unknown Source)
>         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
>         at com.iver.core.mdiManager.NewSkin.<clinit>(NewSkin.java:86)
>         ... 19 more
>
> Por si da alguna pista mas...
>
> _______________________________________________
> gvSIG_desarrolladores mailing list
> gvSIG_desarrolladores en runas.cap.gva.es
> http://runas.cap.gva.es/mailman/listinfo/gvsig_desarrolladores
>
>
>


-- 
Alvaro Zabala Ordóñez

Teléfono: 954939528
Plaza de España, sector II.
SEVILLA
------------ próxima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: http://runas.cap.gva.es/pipermail/gvsig_desarrolladores/attachments/20060906/23ff16f0/attachment-0001.htm


Más información sobre la lista de distribución gvSIG_desarrolladores