Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

ACS Commons errorpage handler exception

Avatar

Level 3

Hi All,

I am implementing error redirection functionality in AEM6.1 by using acs-commons package.I am getting below error when i am accessing invalid page in AEM6.1, Can any one help me how to resolve this issue. I amusing acs-commons 2.0.8 version

 

Caused by: java.lang.Error: Unresolved compilation problems: 
    Only a type can be imported. com.adobe.acs.commons.errorpagehandler.ErrorPageHandlerService resolves to a package
    ErrorPageHandlerService cannot be resolved to a type
    ErrorPageHandlerService cannot be resolved to a type

1 Accepted Solution

Avatar

Correct answer by
Level 9

@Balu,

Try re-compiling jsp's from OSGI Felix console. There is a bundle added to jsp compilation. Go to Sling tab -> jsp

View solution in original post

7 Replies

Avatar

Level 10

I will try and reproduce your results - can you post me to the exact URL where you got this code from. I wonder if there is a config issue or a bug somewhere. 

Avatar

Employee

Hi Balu,

as you have no doubt done, if you search google there seems to be many reasons for this type of error. Recently I came across this when I migrated some AEM5.6.1 code to AEM6.1

The issue was resolved for me by making sure the import was for the actual class, rather than the package. In your case  com.adobe.acs.commons.errorpagehandler.ErrorPageHandlerService rather than com.adobe.acs.commons.errorpagehandler.*

I would identify the JSP file that is causing the issue, or is the code in the OSGI bundle?

What version of Java are you compiling against? Is it the same version that is being used to run AEM?

Regards,

Opkar

Avatar

Level 3

HI,

I have downloaded 2.0.8 package from this location https://github.com/Adobe-Consulting-Services/acs-aem-commons/releases

I am using below config files for AEM 6.1 as per below link.

apps/mysite/components/config

com.adobe.acs.commons.errorpagehandler.impl.ErrorPageHandlerImpl.xml

com.adobe.acs.commons.wcm.impl.ComponentErrorHandlerImpl.xml

apps/mysite/components/config.author and config.publish

com.day.cq.wcm.core.impl.WCMDeveloperModeFilter.xml

 

https://github.com/Adobe-Consulting-Services/acs-aem-commons/issues/378

Error details:

java.io.IOException: Error handler failed: java.lang.Error
    at org.apache.sling.servlets.resolver.internal.SlingServletResolver.handleError(SlingServletResolver.java:771)
    at org.apache.sling.servlets.resolver.internal.SlingServletResolver.handleError(SlingServletResolver.java:442)
    at org.apache.sling.engine.impl.DefaultErrorHandler.handleError(DefaultErrorHandler.java:96)
    at org.apache.sling.engine.impl.SlingRequestProcessorImpl$1.render(SlingRequestProcessorImpl.java:345)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:77)
    at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:129)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at org.apache.sling.rewriter.impl.RewriterFilter.doFilter(RewriterFilter.java:83)
    at org.apache.sling.engine.impl.filter.AbstractSlingFilterChain.doFilter(AbstractSlingFilterChain.java:68)
    at org.apache.sling.engine.impl.SlingRequestProcessorImpl.handleError(SlingRequestProcessorImpl.java:352)
    at org.apache.sling.engine.impl.SlingRequestProcessorImpl.doProcessRequest(SlingRequestProcessorImpl.java:167)
    at org.apache.sling.engine.impl.SlingMainServlet.service(SlingMainServlet.java:217)
    at org.apache.felix.http.base.internal.handler.ServletHandler.doHandle(ServletHandler.java:336)
    at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:297)
    at org.apache.felix.http.base.internal.dispatch.ServletPipeline.handle(ServletPipeline.java:93)
    at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:50)
    at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:31)
    at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:129)
    at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:108)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:80)
    at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:46)
    at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:31)
    at org.apache.sling.security.impl.ReferrerFilter.doFilter(ReferrerFilter.java:290)
    at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:108)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:80)
    at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:46)
    at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:31)
    at com.adobe.granite.license.impl.LicenseCheckFilter.doFilter(LicenseCheckFilter.java:308)
    at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:108)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:80)
    at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:46)
    at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:31)
    at org.apache.felix.http.sslfilter.internal.SslFilter.doFilter(SslFilter.java:89)
    at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:108)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:80)
    at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:46)
    at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:31)
    at org.apache.sling.featureflags.impl.FeatureManager.doFilter(FeatureManager.java:115)
    at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:108)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:80)
    at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:46)
    at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:31)
    at org.apache.sling.engine.impl.log.RequestLoggerFilter.doFilter(RequestLoggerFilter.java:75)
    at org.apache.felix.http.base.internal.handler.FilterHandler.doHandle(FilterHandler.java:108)
    at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:80)
    at org.apache.felix.http.base.internal.dispatch.InvocationFilterChain.doFilter(InvocationFilterChain.java:46)
    at org.apache.felix.http.base.internal.dispatch.HttpFilterChain.doFilter(HttpFilterChain.java:31)
    at org.apache.felix.http.base.internal.dispatch.FilterPipeline.dispatch(FilterPipeline.java:76)
    at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:49)
    at org.apache.felix.http.base.internal.DispatcherServlet.service(DispatcherServlet.java:67)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:497)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.Error: Unresolved compilation problems: 
    Only a type can be imported. com.adobe.acs.commons.errorpagehandler.ErrorPageHandlerService resolves to a package
    ErrorPageHandlerService cannot be resolved to a type
    ErrorPageHandlerService cannot be resolved to a type

    at org.apache.jsp.apps.sling.servlet.errorhandler._404_jsp.<init>(_404_jsp.java:6)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.loadServlet(JspServletWrapper.java:165)
    at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.prepareServlet(JspServletWrapper.java:434)
    at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:486)
    at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:449)
    at org.apache.sling.scripting.jsp.JspScriptEngineFactory.callJsp(JspScriptEngineFactory.java:284)
    at org.apache.sling.scripting.jsp.JspScriptEngineFactory.access$100(JspScriptEngineFactory.java:102)
    at org.apache.sling.scripting.jsp.JspScriptEngineFactory$JspScriptEngine.eval(JspScriptEngineFactory.java:536)
    at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:361)
    at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:171)
    at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:463)
    at org.apache.sling.servlets.resolver.internal.SlingServletResolver.handleError(SlingServletResolver.java:762)
    ... 67 common frames omitted

Avatar

Level 3

Hi, 

I am using java 1.7 , AEM 6.1.

I am not creating any new files i am using existing 404.jsp in acs-commons package. but when i upload package it not installing jar files available under /acs-commons/install . i installed these two jar files manually through console, is this caused any problem?

acs-aem-commons-bundle-2.0.8.jar -- status of this jar is active

acs-aem-commons-bundle-twitter-2.0.8.jar -- Status is installed

Avatar

Correct answer by
Level 9

@Balu,

Try re-compiling jsp's from OSGI Felix console. There is a bundle added to jsp compilation. Go to Sling tab -> jsp

Avatar

Level 3

Hi Tomar,

Thanks for your help , this issue resolved after compiling the jsp files.