Details

      Description

      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)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                michael.han Michael Han
                Reporter:
                dylan.rebelak Dylan Rebelak
                Participants of an Issue:
                Recent user:
                Esther Sanz
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  3 years, 2 weeks, 6 days ago