-
Type:
Bug
-
Status: Closed
-
Resolution: Duplicate
-
Affects Version/s: 7.0.1 CE GA2
-
Fix Version/s: 7.0.1 CE GA2
-
Component/s: Portal Services, Portal Services > Scripting
-
Labels:None
If a module has scripts in the resources/META-INF/resources/scripts folder that get runs by the portal scripting executor, these run before a portal instance is created. This happens on server startup if the module is already deployed. If the server is already running, and then the module is deployed, the scripts run without exceptions.
This is a problem because if a GroovyScriptingContext is created for example, it fails to get the default companyId and throws one of the following two exceptions.
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0
at com.liferay.portal.util.PortalInstances._getDefaultCompanyId(PortalInstances.java:314)
at com.liferay.portal.util.PortalInstances.getDefaultCompanyId(PortalInstances.java:82)
at com.liferay.portal.util.PortalImpl.getDefaultCompanyId(PortalImpl.java:2061)
at com.liferay.portal.kernel.util.PortalUtil.getDefaultCompanyId(PortalUtil.java:839)
at com.liferay.portal.kernel.util.PortalUtil$getDefaultCompanyId.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
at com.liferay.portal.scripting.executor.groovy.GroovyScriptingContext.<init>(GroovyScriptingContext.groovy:38)
Caused by: java.lang.NullPointerException
at com.liferay.portal.kernel.util.PortalUtil.getDefaultCompanyId(PortalUtil.java:839)
at com.liferay.portal.kernel.util.PortalUtil$getDefaultCompanyId.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
at com.liferay.portal.scripting.executor.groovy.GroovyScriptingContext.<init>(GroovyScriptingContext.groovy:38)
- is duplicated by
-
LPS-66457 ScriptingExecutor may execute scripts before their dependent components are deployed.
- Closed