-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: AccessControlException & CGLIB & Hibernate
PostPosted: Fri Jul 15, 2005 1:45 pm 
Newbie

Joined: Tue Jan 25, 2005 5:05 pm
Posts: 17
Hibernate version: 3

I am using Hibernate 3 in EJB. When I trying to create session factory exception thrown:

com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:128) ... 33 more Caused by: java.security.AccessControlException: access denied (java.lang.reflect.ReflectPermission suppressAccessChecks) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:264) at java.security.AccessController.checkPermission(AccessController.java:427) at java.lang.SecurityManager.checkPermission(SecurityManager.java:532) at java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:107) at net.sf.cglib.core.ReflectUtils.getConstructor(ReflectUtils.java:245) at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:220) at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:216) at net.sf.cglib.core.KeyFactory$Generator.firstInstance(KeyFactory.java:157) at net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:220) at net.sf.cglib.core.KeyFactory$Generator.create(KeyFactory.java:145) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:117) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:108) at net.sf.cglib.core.KeyFactory.create(KeyFactory.java:104) at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:321) ... 41 more

in java.security I enable this library:
grant codeBase "file:/home/work/lib/hibernate-3.0/lib/cglib-2.1.jar" {
permission java.security.AllPermission;
};

path to cglib defined in app server classpath (I am using Sun JS AppServer).


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 1:55 pm 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Cglib does not wrapp security sensetive calls in "doPrivileged", wrapp it yourself and grant permissions for your code.
see http://java.sun.com/j2se/1.4.2/docs/api ... ction.html


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 2:18 pm 
Newbie

Joined: Tue Jan 25, 2005 5:05 pm
Posts: 17
baliukas wrote:
Cglib does not wrapp security sensetive calls in "doPrivileged", wrapp it yourself and grant permissions for your code.
see http://java.sun.com/j2se/1.4.2/docs/api ... ction.html


Sorry, but what i should do? Maybe some example can help me...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 15, 2005 4:00 pm 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Code:
public static SessionFactory create() {
         AccessController.doPrivileged(new PrivilegedAction() {
              public Object run() {
                 
                    return buildSessionFactory();

              }
         });
     }

And grant permissions for caller code, jar with "buildSessionFactory" inside:

Code:
grant codeBase "file:/home/work/lib/my.jar" {
permission java.security.AllPermission;
};


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.