Vista Combinata Vista Piatta Vista ad Albero
toggle
Florencia Gadea
PACL: java.lang.SecurityException: Attempted to reflect
21 febbraio 2013 7.13
Risposta

Florencia Gadea

Punteggio: Regular Member

Messaggi: 146

Data di Iscrizione: 27 marzo 2012

Messaggi recenti

Hi Everyone,

I developed a portlet for Liferay 6.1.1 GA2, and I'm having problems enabling the security manager. I used the service builder with spring. Here is the exception I get:

 114:56:18,915 INFO  [DispatcherPortlet:98] Initializing portlet 'i18neditor'
 214:56:19,008 INFO  [DispatcherPortlet:263] FrameworkPortlet 'i18neditor': initialization started
 314:56:19,050 INFO  [XmlPortletApplicationContext:500] Refreshing PortletApplicationContext for namespace 'i18neditor-portlet': startup date [Thu Feb 21 14:56:19 GMT 2013]; root of context hierarchy
 414:56:19,128 INFO  [XmlBeanDefinitionReader:315] Loading XML bean definitions from PortletContext resource [/WEB-INF/i18neditor-portlet.xml]
 514:56:19,431 WARN  [pool-2-thread-2][ReflectChecker:256] Attempted to reflect
 614:56:19,433 INFO  [DefaultListableBeanFactory:433] Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@cc995c: defining beans [ResourceEditorController,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
 714:56:19,435 ERROR [DispatcherPortlet:276] Context initialization failed
 8org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0': Instantiation of bean failed; nested exception is java.lang.SecurityException: Attempted to reflect
 9        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:997)
10        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:943)
11        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
12        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
13        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
14        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
15        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
16        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
17        at org.springframework.context.support.AbstractApplicationContext.registerBeanPostProcessors(AbstractApplicationContext.java:712)
18        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:454)
19        at org.springframework.web.portlet.FrameworkPortlet.createPortletApplicationContext(FrameworkPortlet.java:356)
20        at org.springframework.web.portlet.FrameworkPortlet.initPortletApplicationContext(FrameworkPortlet.java:294)
21        at org.springframework.web.portlet.FrameworkPortlet.initPortletBean(FrameworkPortlet.java:268)
22        at org.springframework.web.portlet.GenericPortletBean.init(GenericPortletBean.java:116)
23        at javax.portlet.GenericPortlet.init(GenericPortlet.java:107)
24        at com.liferay.portlet.InvokerPortletImpl.init(InvokerPortletImpl.java:256)
25        at com.liferay.portlet.PortletInstanceFactoryImpl.init(PortletInstanceFactoryImpl.java:221)
26        at com.liferay.portlet.PortletInstanceFactoryImpl.create(PortletInstanceFactoryImpl.java:140)
27        at com.liferay.portlet.PortletInstanceFactoryUtil.create(PortletInstanceFactoryUtil.java:41)
28        at com.liferay.portlet.PortletBagFactory.create(PortletBagFactory.java:310)
29        at com.liferay.portal.deploy.hot.PortletHotDeployListener.initPortlet(PortletHotDeployListener.java:546)
30        at com.liferay.portal.deploy.hot.PortletHotDeployListener.doInvokeDeploy(PortletHotDeployListener.java:321)
31        at com.liferay.portal.deploy.hot.PortletHotDeployListener.invokeDeploy(PortletHotDeployListener.java:120)
32        at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:188)
33        at com.liferay.portal.deploy.hot.HotDeployImpl.fireDeployEvent(HotDeployImpl.java:96)
34        at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:27)
35        at com.liferay.portal.kernel.servlet.PluginContextListener.fireDeployEvent(PluginContextListener.java:151)
36        at com.liferay.portal.kernel.servlet.SecurePluginContextListener.fireDeployEvent(SecurePluginContextListener.java:233)
37        at com.liferay.portal.kernel.servlet.PluginContextListener.doPortalInit(PluginContextListener.java:141)
38        at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:42)
39        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:64)
40        at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:56)
41        at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:52)
42        at com.liferay.portal.kernel.servlet.PluginContextListener.contextInitialized(PluginContextListener.java:103)
43        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4779)
44        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5273)
45        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
46        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:895)
47        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:871)
48        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:615)
49        at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1099)
50        at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1621)
51        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
52        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
53        at java.util.concurrent.FutureTask.run(FutureTask.java:166)
54        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
55        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
56        at java.lang.Thread.run(Thread.java:679)
57Caused by: java.lang.SecurityException: Attempted to reflect
58        at com.liferay.portal.security.pacl.checker.BaseChecker.throwSecurityException(BaseChecker.java:259)
59        at com.liferay.portal.security.pacl.checker.ReflectChecker.checkPermission(ReflectChecker.java:32)
60        at com.liferay.portal.security.pacl.ActivePACLPolicy.checkPermission(ActivePACLPolicy.java:55)
61        at com.liferay.portal.security.lang.PortalSecurityManager.checkPermission(PortalSecurityManager.java:162)
62        at com.liferay.portal.security.lang.PortalSecurityManager.checkPermission(PortalSecurityManager.java:133)
63        at java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:125)
64        at org.springframework.util.ReflectionUtils.makeAccessible(ReflectionUtils.java:437)
65        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:146)
66        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:76)
67        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$4.run(AbstractAutowireCapableBeanFactory.java:985)
68        at java.security.AccessController.doPrivileged(Native Method)
69        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:983)
70        ... 47 more
7114:56:19,438 ERROR [pool-2-thread-2][PortletBagFactory:313] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0': Instantiation of bean failed; nested exception is java.lang.SecurityException: Attempted to reflect


When I first enabled the SM, I got the exception "Attempted to get environment name *", that I solved with the patch for this: http://issues.liferay.com/browse/LPS-32137

Then, I got the exception "Attempted to access declared members", that I solved with the patch for this: https://jira.portletfaces.org/browse/LPS-30769

I also patched this: http://issues.liferay.com/browse/LPS-32235

And now I'm getting the exception I explained above.

Here is my liferay-plugin-package.properties:

 1name=I18N Editor
 2module-group-id=rotterdam
 3module-incremental-version=1
 4tags=
 5short-description=
 6change-log=
 7page-url=http://www.rotterdam-cs.com
 8author=Rotterdam CS
 9licenses=LGPL
10liferay-versions=6.1.1
11
12portal.dependency.jars=\       
13    jstl-impl.jar,\
14        util-java.jar,\
15        slf4j-api.jar,\
16        slf4j-log4j12.jar,\       
17        commons-collections.jar,\
18        commons-fileupload.jar,\
19        commons-httpclient.jar,\       
20        commons-io.jar
21       
22security-manager-enabled=true
23
24security-manager-class-loader-reference-ids=\ lr-i18n-editor-portlet
25
26security-manager-files-read=\
27${java.io.tmpdir}${file.separator}-,\
28${liferay.web.portal.dir}${file.separator}html${file.separator}taglib${file.separator}-,\
29${liferay.web.portal.dir}${file.separator}html${file.separator}themes${file.separator}-,\
30..${file.separator}webapps${file.separator}lr-i18n-editor-portlet${file.separator}WEB-INF${file.separator}classes${file.separator}service.properties,\
31..${file.separator}webapps${file.separator}lr-i18n-editor-portlet${file.separator}WEB-INF${file.separator}classes${file.separator}portlet.properties,\
32..${file.separator}webapps${file.separator}lr-i18n-editor-portlet${file.separator}WEB-INF${file.separator}classes${file.separator}portal-ext.properties,\
33../webapps/lr-i18n-editor-portlet/WEB-INF/*,\
34../-
35
36security-manager-files-write=${java.io.tmpdir}${file.separator}-
37
38#
39# To support simple calls to System.getenv(String name); declare comma delimited list of env variables.
40#
41security-manager-get-environment-variable=\
42LD_LIBRARY_PATH,\
43PATH
44
45#
46# To support calls to System.getenv(); one must declare accessing any env variables using '*'.
47#
48security-manager-get-environment-variable=*
49
50security-manager-sockets-connect=*
51
52security-manager-get-bean-property=\
53    com.liferay.portal.kernel.language.LanguageUtil,\
54    com.liferay.portal.kernel.configuration.ConfigurationFactoryUtil,\
55    com.liferay.portal.kernel.spring.util.SpringFactoryUtil,\
56    com.liferay.portal.kernel.util.InfrastructureUtil,\
57    com.liferay.portal.kernel.dao.db.DBFactoryUtil,\
58    com.liferay.portal.kernel.cache.CacheRegistryUtil,\
59    com.liferay.portal.kernel.dao.orm.FinderCacheUtil,\
60    com.liferay.portal.kernel.dao.shard.ShardUtil,\
61    com.liferay.portal.security.permission.PermissionChecker,\
62    org.springframework.beans.BeanUtils,\
63    org.springframework.util.ReflectionUtils


Can anyone help me with this? Am I missing something? Should I raise a JIRA ticket?

TIA,

Flor.
Anonimo
RE: PACL: java.lang.SecurityException: Attempted to reflect
22 febbraio 2013 3.18
Risposta

Anonimo

Hi Flor,

It is very likely that this ticket will be the solution to the issue you encounter:
http://issues.liferay.com/browse/LPS-33047

Best Regards,
Gábor
Florencia Gadea
RE: PACL: java.lang.SecurityException: Attempted to reflect
22 febbraio 2013 5.41
Risposta

Florencia Gadea

Punteggio: Regular Member

Messaggi: 146

Data di Iscrizione: 27 marzo 2012

Messaggi recenti

Hi Gabor,

Thanks, I hope that's the solution. I'll watch it.

Regards,

Flor.