5 Replies Latest reply on Jul 8, 2013 3:50 PM by Naveeth_J

    ExceptionInInitializerError in CQ 5.6

    Naveeth_J

      After CQ upgrade, we have been encountering this initializerError ssue for sometime now. It happens after we deploy a package to CQ instance. Currently, we restart the bundle to get rid of this issue. Could someone help us in resolving this issue?

       

       

      *ERROR* [172.20.24.145 [1365703757457] GET /bin/generatestylexml/json HTTP/1.1] org.apache.sling.engine.impl.SlingRequestProcessorImpl service: Uncaught Throwable java.lang.ExceptionInInitializerError

      at org.jibx.runtime.impl.BindingFactoryBase.createUnmarshallingContext(BindingFactoryBase.ja va:269)

      at com.company.content.dashboard.content.export.util.XMLGenerationUtil.unmarshallInputStream ToObject(XMLGenerationUtil.java:53)

      at com.company.content.dashboard.content.export.services.ColorFontFrameGeneration.generateCf fFromXML(ColorFontFrameGeneration.java:34)

      at com.company.content.dashboard.content.export.model.dao.ColorFontFrameDAO.getCffForStyle(C olorFontFrameDAO.java:79)

      at com.company.content.dashboard.content.export.model.dao.StyleDefinitionDAO.getStyleDefinit ion(StyleDefinitionDAO.java:133)

      at com.company.content.dashboard.content.export.services.StyleDefinitionGeneration.generateX ml(StyleDefinitionGeneration.java:26)

      at com.company.content.dashboard.content.export.servlets.styleeditor.GenerateStyleXmlServlet .createStyleXML(GenerateStyleXmlServlet.java:167)

      at com.company.content.dashboard.content.export.servlets.styleeditor.GenerateStyleXmlServlet .createXML(GenerateStyleXmlServlet.java:157)

      at com.company.content.dashboard.content.export.servlets.styleeditor.GenerateStyleXmlServlet .generateXMLFiles(GenerateStyleXmlServlet.java:134)

      at com.company.content.dashboard.content.export.servlets.styleeditor.GenerateStyleXmlServlet .doGet(GenerateStyleXmlServlet.java:117)

      at org.apache.sling.api.servlets.SlingSafeMethodsServlet.mayService(SlingSafeMethodsServlet. java:268)

      at org.apache.sling.api.servlets.SlingAllMethodsServlet.mayService(SlingAllMethodsServlet.ja va:139)

      at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.jav a:344)

      at org.apache.sling.api.servlets.SlingSafeMethodsServlet.service(SlingSafeMethodsServlet.jav a:375)

      at org.apache.sling.engine.impl.request.RequestData.service(RequestData.java:508)

      at org.apache.sling.engine.impl.filter.SlingComponentFilterChain.render(SlingComponentFilter Chain.java:45)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:64)

      at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilter(WCMDebugFilter.java:148)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at com.day.cq.wcm.core.impl.WCMComponentFilter.filterRootInclude(WCMComponentFilter.java:333 )

      at com.day.cq.wcm.core.impl.WCMComponentFilter.doFilter(WCMComponentFilter.java:160)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processComponent(SlingRequestProce ssorImpl.java:254)

      at org.apache.sling.engine.impl.filter.RequestSlingFilterChain.render(RequestSlingFilterChai n.java:49)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:64)

      at com.day.cq.wcm.core.impl.warp.TimeWarpFilter.doFilter(TimeWarpFilter.java:106)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at com.day.cq.wcm.mobile.core.impl.redirect.RedirectFilter.doFilter(RedirectFilter.java:290)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at org.apache.sling.engine.impl.debug.RequestProgressTrackerLogFilter.doFilter(RequestProgre ssTrackerLogFilter.java:59)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at com.day.cq.theme.impl.ThemeResolverFilter.doFilter(ThemeResolverFilter.java:76)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at com.adobe.granite.optout.impl.OptOutFilter.doFilter(OptOutFilter.java:74)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at com.day.cq.wcm.foundation.forms.impl.FormsHandlingServlet.doFilter(FormsHandlingServlet.j ava:220)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at com.day.cq.wcm.core.impl.WCMRequestFilter.doFilter(WCMRequestFilter.java:90)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at com.day.cq.wcm.designimporter.CanvasPageDeleteRequestFilter.doFilter(CanvasPageDeleteRequ estFilter.java:87)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at org.apache.sling.rewriter.impl.RewriterFilter.doFilter(RewriterFilter.java:83)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:127)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at org.apache.sling.bgservlets.impl.BackgroundServletStarterFilter.doFilter(BackgroundServle tStarterFilter.java:135)

      at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilter Chain.java:60)

      at org.apache.sling.engine.impl.SlingRequestProcessorImpl.processRequest(SlingRequestProcess orImpl.java:151)

      at org.apache.sling.engine.impl.SlingMainServlet.service(SlingMainServlet.java:206)

      at org.apache.felix.http.base.internal.handler.ServletHandler.doHandle(ServletHandler.java:9 6)

      at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:79)

      at org.apache.felix.http.base.internal.dispatch.ServletPipeline.handle(ServletPipeline.java: 42)

      at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFil terChain.java:49)

      at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.jav a:33)

      at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:127)

      at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:88)

      at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:76)

      at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFil terChain.java:47)

      at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.jav a:33)

      at org.apache.sling.security.impl.ReferrerFilter.doFilter(ReferrerFilter.java:259)

      at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:88)

      at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:76)

      at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFil terChain.java:47)

      at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.jav a:33)

      at com.adobe.granite.license.impl.LicenseCheckFilter.doFilter(LicenseCheckFilter.java:179)

      at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:88)

      at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:76)

      at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFil terChain.java:47)

      at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.jav a:33)

      at org.apache.felix.http.sslfilter.internal.SslFilter.doFilter(SslFilter.java:55)

      at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:88)

      at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:76)

      at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFil terChain.java:47)

      at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.jav a:33)

      at org.apache.sling.engine.impl.log.RequestLoggerFilter.doFilter(RequestLoggerFilter.java:75 )

      at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:88)

      at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:76)

      at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFil terChain.java:47)

      at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.jav a:33)

      at org.apache.felix.http.base.internal.dispatch.FilterPipeline.dispatch(FilterPipeline.java: 48)

      at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:39)

      at org.apache.felix.http.base.internal.DispatcherServlet.service(DispatcherServlet.java:67)

      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

      at com.day.j2ee.servletengine.ServletRuntimeEnvironment.service(ServletRuntimeEnvironment.ja va:250)

      at com.day.j2ee.servletengine.RequestDispatcherImpl.doFilter(RequestDispatcherImpl.java:321)

      at com.day.j2ee.servletengine.RequestDispatcherImpl.service(RequestDispatcherImpl.java:340)

      at com.day.j2ee.servletengine.RequestDispatcherImpl.service(RequestDispatcherImpl.java:383)

      at com.day.j2ee.servletengine.ServletHandlerImpl.process(ServletHandlerImpl.java:360)

      at com.day.j2ee.servletengine.HttpListener$Worker.run(HttpListener.java:644)

      at java.lang.Thread.run(Thread.java:619)

      Caused by: java.lang.RuntimeException: Unable to load either XMLPull or StAX parser - check classpath for interface and implementation jars

      XMLPull error java.lang.RuntimeException: Specified parser factory class org.jibx.runtime.impl.XMLPullReaderFactory does not implement IXMLReaderFactory interface

      StAX error java.lang.RuntimeException: Specified parser factory class org.jibx.runtime.impl.StAXReaderFactory does not implement IXMLReaderFactory interface

      at org.jibx.runtime.impl.RuntimeSupport.loadFactory(RuntimeSupport.java:269)

      at org.jibx.runtime.impl.UnmarshallingContext.<clinit>(UnmarshallingContext.java:61)

        • 1. Re: ExceptionInInitializerError in CQ 5.6
          Sham HC Level 7

          The stacktrace indicates it is linkage error. On the bundles you might be referring to a class which would be calling in a static block & is no up yet. The problem might be at custom implementation.  Can you provide simple steps with sample code to reproduce it at vanilla instance?

          • 2. Re: ExceptionInInitializerError in CQ 5.6
            Naveeth_J Level 1

                      A class under the package com.company.content.dashboard.content.export.* uses JibxBinding to convert object to xml. We are getting this exception initializer error during this

                      XML conversion in JibxBinding jar. This is what we have in our pom file to form a osgi bundle.

             

                      <build>

                    <plugins>

                                          <plugin>

                                                    <groupId>org.apache.felix</groupId>

                                                    <artifactId>maven-bundle-plugin</artifactId>

                                                    <extensions>true</extensions>

                                                    <configuration>

                                                              <instructions>

                                                                        <Export-Package>

                                                                                  com.company.content.content.export.*,

                                    </Export-Package>

                                                                        <Import-Package>

                                                                                  javax.jcr;version="2.0",

                                                                                  javax.jcr.nodetype;version="2.0",

                                                                                  *;resolution:=optional,

                                    </Import-Package>

                                    <Embed-Dependency>jibx-run,joda-time,xpp3,jxl</Embed-Dependency>

                                                              </instructions>

                                                    </configuration>

                                          </plugin>

                                          <!-- Generate OSGi components based on Felix annotations -->

                                          <plugin>

                                                    <groupId>org.apache.felix</groupId>

                                                    <artifactId>maven-scr-plugin</artifactId>

                                                    <executions>

                                                              <execution>

                                                                        <id>generate-scr-scrdescriptor</id>

                                                                        <goals>

                                                                                  <goal>scr</goal>

                                                                        </goals>

                                                              </execution>

                                                    </executions>

                                          </plugin>

                                          <plugin>

                                            <groupId>org.jibx</groupId>

                                            <artifactId>jibx-maven-plugin</artifactId>

                                            <executions>

                                              <execution>

                                                <goals>

                                                  <goal>bind</goal>

                                                </goals>

                                              </execution>

                                            </executions>

                                          </plugin>

                                          <plugin>

                            <groupId>org.ops4j.pax.exam</groupId>

                            <artifactId>maven-paxexam-plugin</artifactId>

                            <executions>

                                <execution>

                                    <id>generate-config</id>

                                    <phase>pre-integration-test</phase>

                                    <goals>

                                        <goal>generate-config</goal>

                                    </goals>

                                </execution>

                            </executions>

                        </plugin>

                                </plugins>

                </build>

             

                However, this error is not being thrown in our local machines. The test servers gets restarted daily after capturing the daily backup. We would like to know why this started happening only after the upgrade. Please, let me know if you need more details.

             

             

            More Information on how we install the package, We use gmaven-plugin to do installation and we use the following snippet to do a http post

             

            <source>

                                                    import org.apache.commons.httpclient.*

                                                    import org.apache.commons.httpclient.methods.*

                                                    import org.apache.commons.httpclient.auth.*

                                                    import org.apache.commons.httpclient.methods.multipart.*

             

             

                                                    def executePost(httpclient, httppost, outputResponse){

             

             

                                                    def success = false

             

             

                                                    try {

                                                    def responseCode = httpclient.executeMethod(httppost);

             

             

                                                    if (responseCode != 200) {

                                                    println("CQ server returned a ${responseCode} response code")

                                                    } else {

                                                    success = true

                                                    if (outputResponse){

                                                    println httppost.responseBodyAsString

                                                    }

                                                    }

                                                    } catch (Exception e) {

                                                    println("Exception: " + e)

                                                    } finally {

                                                    httppost.releaseConnection()

                                                    }

             

             

                                                    return success

                                                    }

             

             

                                                    def uploadAndInstall(hostname, port, packageName, packageLocation, httpclient){

             

             

                                                    def httppost = new PostMethod("http://${hostname}:${port}/crx/packmgr/service.jsp")

                                                    def file = new File("${packageLocation}/${packageName}.jar")

             

             

                                                    println("Installing package to ${hostname}:${port}")

             

             

                                                    if(file.exists()){

             

             

                                                    def parts = [new FilePart("file", file)] as Part[]

                                                    httppost.setRequestEntity(new MultipartRequestEntity(parts, httppost.getParams()))

             

             

                                                    def success = executePost(httpclient, httppost, true)

             

             

                                                    if (success) {

                                                    //install package

                                                    httppost = new PostMethod("http://${hostname}:${port}/crx/packmgr/service/.json/etc/packages/${packageName}.zip")

                                                    httppost.addParameter("cmd", "install")

             

             

             

             

                                                    success = executePost(httpclient, httppost, true)

             

             

                                                    if (!success) {

                                                    fail("Failed to install package")

                                                    }

                                                    } else {

                                                    fail ("Failed to upload package")

                                                    }

                                                    } else {

                                                    println("File does not exist for " + packageName + ". Not Deploying.")

                                                    }

                                                    }

             

             

                                                    def hostname = project.properties['dam.host']

                                                    def port = project.properties['dam.port']

                                                    def packageName = project.properties.packageName

                                                    def user = project.properties.cquser

                                                    def pass = project.properties.cqpassword

                                                    def packageLocation = project.build.directory

             

             

                                                    def filterFile = new File(project.basedir.path + "/src/main/content/META-INF/vault/filter.xml")

             

             

                                                    if(filterFile.exists()) {

             

             

                                                    def httpclient = new HttpClient()

                                                    def defaultcreds = new UsernamePasswordCredentials(user, pass)

                                                    httpclient.getState().setCredentials(AuthScope.ANY, defaultcreds)

                                                    httpclient.getParams().setAuthenticationPreemptive(true)

             

             

                                                    uploadAndInstall(hostname, port, packageName, packageLocation,

                                                    httpclient)

                                                    }

                                                </source>

            • 3. Re: ExceptionInInitializerError in CQ 5.6
              Naveeth_J Level 1

              We also get this error

               

              java.lang.NoClassDefFoundError: Could not initialize class org.jibx.runtime.impl.UnmarshallingContext

              at org.jibx.runtime.impl.BindingFactoryBase.createUnmarshallingContext(BindingFactoryBase.ja va:269)

              at com.company.content.dashboard.content.export.util.XMLGenerationUtil.unmarshallInputStream ToObject(XMLGenerationUtil.java:53)

               

              We use jibx-run-1.2.3.jar in our application

              • 4. Re: ExceptionInInitializerError in CQ 5.6
                Sham HC Level 7

                Try with adding

                sling.properties add the property [0], restart the system & verify

                [0]  sling.bootdelegation.org.jibx = org.jibx

                 

                OR  In case you are using TransformerFactory.  change class loader before loading TransformerFactory and revert back to original once it is done. Ex:- [1]

                 

                 

                [1]

                final ClassLoader oldLoader =

                Thread.currentThread().getContextClassLoader();

                try {

                ....

                Thread.currentThread().setContextClassLoader(javax.xml.transform.TransformerFactory.class. getClassLoader());

                 

                XPathFactory factory=XPathFactory.newInstance();

                 

                ...

                 

                } finally {

                Thread.currentThread().setContextClassLoader(oldLoader);

                }

                • 5. Re: ExceptionInInitializerError in CQ 5.6
                  Naveeth_J Level 1

                  We tried both of your approach to resolve this. However, this issue doesn't seems to get fixed, it keeps on coming everyday after nightly backup restart.