tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Juan José García Lau <jgar...@cuscatlanguate.com>
Subject RE: AccessControlException
Date Mon, 19 Apr 2004 22:05:29 GMT
Thanks for your answer

Maybe I did not explain me well or I think it was a simple error, but I'm
using rmi, and I have a class of the WEB-INF/classes that creates the
initial context, I think the problem is that it never gets to create the
initial context.  But I don't know why.  I have tried in Tomcat 4 and works
fine.

public InitialContext getContext() {
        InitialContext ctx = null;
        Hashtable env = new Hashtable();
        env.put(Context.INITIAL_CONTEXT_FACTORY,
        "com.sun.jndi.rmi.registry.RegistryContextFactory");
        env.put(Context.PROVIDER_URL,"rmi://190.4.7.52:8000"); 
        
        try{
            if (System.getSecurityManager() == null)
                System.setSecurityManager(new RMISecurityManager());
            ctx = new InitialContext(env);
        } catch (Exception e){
            System.out.println("Error al crear el contexto...!! " +
e.toString());
        }
        return ctx;
    }

The first error in the log file tell me this, 
Error al crear el contexto...!! java.security.AccessControlException: access
denied (java.io.FilePermission
D:\jakarta-tomcat-5.0.19\webapps\tarjetas\WEB-INF\classes\jndi.properties
read)

And this file "jndi.properties" should not be called because I'm using the
env.put.

Any help would be appreciated.

Thanks

Juan




-----Original Message-----
From: Benjamin Armintor [mailto:Ben.Armintor@austin.utexas.edu] 
Sent: Monday, April 19, 2004 2:51 PM
To: Tomcat Users List
Subject: RE: AccessControlException


I don't think that's going to be the codeBase for your compiled JSP classes.
You shouldn't need to put that AllPermission block in at all to get a file
from WEB-INF/classes: Use servletContext.getResource().

Benjamin J. Armintor
Systems Analyst
ITS-Systems: Mainframe Group
University of Texas - Austin
tele: (512) 232-6562
email: b.armintor@its.utexas.edu
 


-----Original Message-----
From: Juan José García Lau [mailto:jgarcia@cuscatlanguate.com] 
Sent: Monday, April 19, 2004 3:48 PM
To: Tomcat Users List
Subject: AccessControlException


Hi, I'm having problems to make jsp to work.  The code of the page call a
bean named myMoneda

d:/jakarta-tomcat-5.0.19/webapps/tarjetas/test.jsp

<%@page contentType="text/html"%>
<%@page errorPage="errorJSP.jsp"%>
<%@page import="Def.*"%>
<%@page import="Interfaz.*"%>

<jsp:useBean id="myMoneda" class="Def.monedaDef" scope="page"/>
<jsp:setProperty name="myMoneda" property="*"/>

<%
myMoneda.useData(1);
%>

When I use the method myMondeda.useData the tomcat gave me the
AccessControlException below.


I already added the AllPermission to the catalina.policy

grant codeBase "file:
d:/jakarta-tomcat-5.0.19/webapps/tarjetas/WEB-INF/classes/-" {
	permission java.security.AllPermission;
};


What can I do to solve my problem?

Thanks,

Juan


Error al crear el contexto...!! java.security.AccessControlException: access
den ied (java.io.FilePermission
D:\jakarta-tomcat-5.0.19\webapps\tarjetas\WEB-INF\cl
asses\jndi.properties read)
Hubo un error al ejecutar el lookup en
capturaMoneda..!java.lang.NullPointerExce
ption
java.security.AccessControlException: access denied (java.io.FilePermission
D:\j
akarta-tomcat-5.0.19\webapps\tarjetas\WEB-INF\classes\org\apache\jasper\Jasp
erEx
ceptionBeanInfo.class read)
        at
java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java:269)
        at
java.security.AccessController.checkPermission(AccessController.java:
401)
        at
java.lang.SecurityManager.checkPermission(SecurityManager.java:524)
        at java.lang.SecurityManager.checkRead(SecurityManager.java:863)
        at java.io.File.exists(File.java:678)
        at
org.apache.naming.resources.FileDirContext.file(FileDirContext.java:8
73)
        at
org.apache.naming.resources.FileDirContext.lookup(FileDirContext.java
:255)
        at
org.apache.naming.resources.ProxyDirContext.lookup(ProxyDirContext.ja
va:334)
        at
org.apache.catalina.loader.WebappClassLoader.findResourceInternal(Web
appClassLoader.java:1750)
        at
org.apache.catalina.loader.WebappClassLoader.findClassInternal(Webapp
ClassLoader.java:1618)
        at
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoa
der.java:900)
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1350)
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoa
der.java:1230)
        at java.beans.Introspector.instantiate(Introspector.java:1322)
        at
.
.
.
.
.
.
.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message