6 Replies Latest reply on Nov 13, 2017 10:53 AM by smacdonald2008

    org.apache.sling.scripting.sightly.SightlyException: Identifier XXXX cannot be correctly instantiated by the Use API

    sukumard57505132 Level 1

      Hi,

       

      I am trying install my AEM 6.1 project on AEM 6.3. After installation and update of all POM, related code, i am able to open my project webpages. However when trying to drag and drop any component on to a sample page using my project template its failing with below exception.

       

      13.11.2017 09:45:46.050 *ERROR* [0:0:0:0:0:0:0:1 [1510537544955] GET /content/singtel/en/Test6_3/jcr:content/par/sd_component_dualima.html HTTP/1.1] com.day.cq.wcm.core.impl.WCMDebugFilter Error during include of SlingRequestPathInfo: path='/content/singtel/en/Test6_3/jcr:content/par/sd_component_dualima', selectorString='null', extension='html', suffix='null'

      org.apache.sling.scripting.sightly.SightlyException: Identifier com.singtel.springd.aem.components.singtel.dualimagecomponent.DualImageComponentControlle r cannot be correctly instantiated by the Use API

      at org.apache.sling.scripting.sightly.impl.engine.extension.use.UseRuntimeExtension.call(Use RuntimeExtension.java:77)

      at org.apache.sling.scripting.sightly.impl.engine.runtime.RenderContextImpl.call(RenderConte xtImpl.java:75)

      at org.apache.sling.scripting.sightly.apps.springd.components.global.componentTemplate_html$ 1.render(componentTemplate_html.java:83)

      at org.apache.sling.scripting.sightly.java.compiler.RenderUnit.render(RenderUnit.java:48)

      at org.apache.sling.scripting.sightly.java.compiler.RenderUnit.callUnit(RenderUnit.java:85)

      at org.apache.sling.scripting.sightly.apps.springd.components.global.singtel.sd__002d__compo nent__002d__dualimage__002d__singtel.html_html.render(html_html.java:46)

      at org.apache.sling.scripting.sightly.java.compiler.RenderUnit.render(RenderUnit.java:48)

      at org.apache.sling.scripting.sightly.impl.engine.SightlyCompiledScript.eval(SightlyCompiled Script.java:61)

      at org.apache.sling.scripting.core.impl.DefaultSlingScript.call(DefaultSlingScript.java:386)

      at org.apache.sling.scripting.core.impl.DefaultSlingScript.eval(DefaultSlingScript.java:184)

      at org.apache.sling.scripting.core.impl.DefaultSlingScript.service(DefaultSlingScript.java:4 91)

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

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

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

      at com.day.cq.wcm.core.impl.WCMDebugFilter.doFilterWithErrorHandling(WCMDebugFilter.java:192 )

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

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

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

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

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

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

      at com.day.cq.personalization.impl.TargetComponentFilter.doFilter(TargetComponentFilter.java :96)

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

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

      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:71)

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

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

      at com.adobe.cq.social.ugcbase.security.impl.SaferSlingPostServlet.doFilter(SaferSlingPostSe rvlet.java:114)

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

      at com.day.cq.dam.core.impl.assetlinkshare.AdhocAssetShareAuthHandler.doFilter(AdhocAssetSha reAuthHandler.java:436)

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

      at com.day.cq.dam.core.impl.servlet.ActivityRecordHandler.doFilter(ActivityRecordHandler.jav a:154)

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

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

      at com.adobe.granite.rest.impl.servlet.ApiResourceFilter.doFilter(ApiResourceFilter.java:70)

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

      at com.adobe.granite.requests.logging.impl.RequestLoggerImpl.doFilter(RequestLoggerImpl.java :126)

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

      at com.adobe.granite.rest.assets.impl.AssetContentDispositionFilter.doFilter(AssetContentDis positionFilter.java:96)

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

      at com.adobe.granite.csrf.impl.CSRFFilter.doFilter(CSRFFilter.java:217)

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

      at org.apache.sling.security.impl.ContentDispositionFilter.doFilter(ContentDispositionFilter .java:180)

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

      at com.day.cq.wcm.core.impl.AuthoringUIModeServiceImpl.doFilter(AuthoringUIModeServiceImpl.j ava:367)

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

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

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

      at com.singtel.springd.aem.filters.LoggingFilter.doFilter(LoggingFilter.java:36)

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

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

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

      at com.adobe.cq.social.commons.cors.CORSAuthenticationFilter.doFilter(CORSAuthenticationFilt er.java:91)

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

      at com.day.cq.wcm.foundation.forms.FormsHandlingServletHelper.handleFilter(FormsHandlingServ letHelper.java:221)

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

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

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

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

      at com.day.cq.wcm.foundation.forms.FormsHandlingServletHelper.handleFilter(FormsHandlingServ letHelper.java:221)

      at com.adobe.cq.wcm.core.components.internal.servlets.CoreFormHandlingServlet.doFilter(CoreF ormHandlingServlet.java:131)

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

      at com.singtel.springd.aem.servlets.filter.ServletAuthenticationFilter.doFilter(ServletAuthe nticationFilter.java:149)

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

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

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

      at com.adobe.cq.history.impl.HistoryRequestFilter.doFilter(HistoryRequestFilter.java:122)

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

      at com.adobe.cq.mcm.campaign.servlets.CampaignCopyTracker.doFilter(CampaignCopyTracker.java: 100)

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

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

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

      at com.adobe.granite.httpcache.impl.InnerCacheFilter.doFilter(InnerCacheFilter.java:81)

      at com.adobe.granite.httpcache.impl.InnerCacheFilter.doFilter(InnerCacheFilter.java:60)

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

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

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

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

      at com.adobe.granite.resourceresolverhelper.impl.ResourceResolverHelperImpl.doFilter(Resourc eResolverHelperImpl.java:83)

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

      at org.apache.sling.engine.impl.SlingRequestProcessorImpl.doProcessRequest(SlingRequestProce ssorImpl.java:151)

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

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

      at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.jav a:79)

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

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

      at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.jav a:74)

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

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

      at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.jav a:74)

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

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

      at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.jav a:74)

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

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

      at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.jav a:74)

      at org.apache.sling.featureflags.impl.FeatureManager.doFilter(FeatureManager.java:116)

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

      at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.jav a:74)

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

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

      at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.jav a:74)

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

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

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

      at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)

      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:499)

      at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)

      at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)

      at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)

      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(Thread.java:745)

      Caused by: org.apache.sling.models.factory.MissingElementsException: Could not inject all required fields into class com.singtel.springd.aem.components.singtel.dualimagecomponent.DualImageComponentControlle r

      at org.apache.sling.models.impl.ModelAdapterFactory.createObject(ModelAdapterFactory.java:59 3)

      at org.apache.sling.models.impl.ModelAdapterFactory.internalCreateModel(ModelAdapterFactory. java:335)

      at org.apache.sling.models.impl.ModelAdapterFactory.createModel(ModelAdapterFactory.java:223 )

      at org.apache.sling.scripting.sightly.models.impl.SlingModelsUseProvider.provide(SlingModels UseProvider.java:126)

      at org.apache.sling.scripting.sightly.impl.engine.extension.use.UseRuntimeExtension.call(Use RuntimeExtension.java:72)

      ... 122 common frames omitted

      Suppressed: org.apache.sling.models.factory.MissingElementException: Could not inject private org.apache.sling.api.resource.Resource com.singtel.springd.aem.components.singtel.dualimagecomponent.DualImageComponentControlle r.imageDesktop

      at org.apache.sling.models.impl.ModelAdapterFactory.createObject(ModelAdapterFactory.java:59 8)

      ... 126 common frames omitted

      Caused by: org.apache.sling.models.factory.ModelClassException: No injector returned a non-null value!

      at org.apache.sling.models.impl.ModelAdapterFactory.injectElement(ModelAdapterFactory.java:5 13)

      at org.apache.sling.models.impl.ModelAdapterFactory.createObject(ModelAdapterFactory.java:59 6)

      ... 126 common frames omitted

      Suppressed: org.apache.sling.models.factory.MissingElementException: Could not inject private org.apache.sling.api.resource.Resource com.singtel.springd.aem.components.singtel.dualimagecomponent.DualImageComponentControlle r.imageMobile

      at org.apache.sling.models.impl.ModelAdapterFactory.createObject(ModelAdapterFactory.java:59 8)

      ... 126 common frames omitted

      Caused by: org.apache.sling.models.factory.ModelClassException: No injector returned a non-null value!

      at org.apache.sling.models.impl.ModelAdapterFactory.injectElement(ModelAdapterFactory.java:5 13)

      at org.apache.sling.models.impl.ModelAdapterFactory.createObject(ModelAdapterFactory.java:59 6)

      ... 126 common frames omitted

       

       

      Below is my core POM.xml file

       

      <?xml version="1.0" encoding="UTF-8"?>

      <!--

      |  Copyright 2015 Adobe Systems Incorporated

      |

      |  Licensed under the Apache License, Version 2.0 (the "License");

      |  you may not use this file except in compliance with the License.

      |  You may obtain a copy of the License at

      |

      |      http://www.apache.org/licenses/LICENSE-2.0

      |

      |  Unless required by applicable law or agreed to in writing, software

      |  distributed under the License is distributed on an "AS IS" BASIS,

      |  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

      |  See the License for the specific language governing permissions and

      |  limitations under the License.

      -->

      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

          <modelVersion>4.0.0</modelVersion>

          <parent>

              <groupId>com.singtel.springd.aem</groupId>

              <artifactId>aem-parent</artifactId>

              <version>1.14.49-SNAPSHOT</version>

              <relativePath>../pom.xml</relativePath>

          </parent>

          <artifactId>aem-parent.core</artifactId>

          <packaging>bundle</packaging>

          <name>SpringDigital - AEM - Core</name>

          <description>Core bundle for SpringDigital - AEM</description>

          <build>

              <testResources>

                  <testResource>

                      <directory>${project.basedir}/src/test/resource</directory>

                  </testResource>

       

       

              </testResources>

              <plugins>

      <plugin>

                      <groupId>org.apache.sling</groupId>

                      <artifactId>maven-sling-plugin</artifactId>

                  </plugin>

                  <plugin>

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

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

                  </plugin>

                  <plugin>

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

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

                      <extensions>true</extensions>

      <executions>

                          <execution>

                              <id>bundle-manifest</id>

                              <phase>process-classes</phase>

                              <goals>

                                  <goal>manifest</goal>

                              </goals>

                          </execution>

                      </executions>

      <configuration>

                          <instructions>

                          <Embed-Dependency>

                                  commons-lang3,jsoup,jackson-core,poi,jackson-databind,jackson-annotations,aws-java-sdk-dy namodb,

                                  aws-java-sdk-s3,aws-java-sdk-core,commons-logging,httpclient,httpcore,joda-time,json-simp le,commons-httpclient,geronimo-atinject_1.0_spec

                              </Embed-Dependency>

                              <!-- Import any version of javax.inject, to allow running on multiple versions of AEM -->

                              <Import-Package>javax.inject;version=1.0.0,com.adobe.cq.sightly,*;resolution:=optional

                              </Import-Package>

                              <Require-Bundle>org.apache.sling.models.api</Require-Bundle>

                              <Sling-Model-Packages>

                                  com.singtel.springd.aem,

                                  com.singtel.springd.aem.datasource.impl

                              </Sling-Model-Packages>

                          </instructions>

                      </configuration>

                  </plugin>

              </plugins>

          </build>

          <profiles>

              <!-- Development profile: install only the bundle -->

              <profile>

                  <id>autoInstallBundle</id>

                  <activation>

                      <activeByDefault>false</activeByDefault>

                  </activation>

                  <build>

                      <plugins>

                          <plugin>

                              <groupId>org.apache.sling</groupId>

                              <artifactId>maven-sling-plugin</artifactId>

                              <configuration>

                                  <!-- Note that this requires /apps/springd/install to exist!!       -->

                                  <!-- This is typically the case when ui.apps is deployed first      -->

                                  <!-- Otherwise, create /apps/springd/install manually (CRXDE|Lite)  -->

                                  <slingUrlSuffix>/apps/springd/install/</slingUrlSuffix>

                                  <failOnError>true</failOnError>

                              </configuration>

                          </plugin>

                      </plugins>

                  </build>

              </profile>

          </profiles>

          <dependencies>

              <!-- OSGi Dependencies -->

              <dependency>

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

                  <artifactId>org.apache.felix.scr</artifactId>

              </dependency>

              <dependency>

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

                  <artifactId>org.apache.felix.scr.annotations</artifactId>

              </dependency>

              <dependency>

                  <groupId>biz.aQute</groupId>

                  <artifactId>bndlib</artifactId>

              </dependency>

              <dependency>

                  <groupId>org.osgi</groupId>

                  <artifactId>osgi.core</artifactId>

              </dependency>

              <dependency>

                  <groupId>org.osgi</groupId>

                  <artifactId>osgi.cmpn</artifactId>

              </dependency>

      <dependency>

                  <groupId>org.osgi</groupId>

                  <artifactId>osgi.annotation</artifactId>

              </dependency>

              <!-- Other Dependencies -->

              <dependency>

                  <groupId>org.slf4j</groupId>

                  <artifactId>slf4j-api</artifactId>

              </dependency>

       

       

              <dependency>

                  <groupId>org.slf4j</groupId>

                  <artifactId>slf4j-simple</artifactId>

              </dependency>

              <dependency>

                  <groupId>javax.jcr</groupId>

                  <artifactId>jcr</artifactId>

              </dependency>

              <dependency>

                  <groupId>javax.servlet</groupId>

                  <artifactId>servlet-api</artifactId>

              </dependency>

       

       

              <dependency>

                  <groupId>org.apache.sling</groupId>

                  <artifactId>org.apache.sling.api</artifactId>

              </dependency>

       

       

              <dependency>

                  <groupId>org.apache.sling</groupId>

                  <artifactId>org.apache.sling.models.api</artifactId>

              </dependency>

       

       

              <dependency>

                  <groupId>org.apache.sling</groupId>

                  <artifactId>org.apache.sling.models.impl</artifactId>

              </dependency>

      <dependency>

              <groupId>org.apache.geronimo.specs</groupId>

              <artifactId>geronimo-atinject_1.0_spec</artifactId>

          </dependency>

       

              <dependency>

                  <groupId>com.adobe.aem</groupId>

                  <artifactId>uber-jar</artifactId>

                  <classifier>apis</classifier>

              </dependency>

       

       

              <dependency>

                  <groupId>javax.mail</groupId>

                  <artifactId>mail</artifactId>

              </dependency>

              <!-- dependency>

                  <groupId>javax.inject</groupId>

                  <artifactId>javax.inject</artifactId>

              </dependency-->

       

       

              <dependency>

                  <groupId>junit</groupId>

                  <artifactId>junit</artifactId>

              </dependency>

      <dependency>

                  <groupId>org.mockito</groupId>

                  <artifactId>mockito-core</artifactId>

              </dependency>

              <dependency>

                  <groupId>org.mockito</groupId>

                  <artifactId>mockito-all</artifactId>

              </dependency>

       

       

              <dependency>

                  <groupId>junit-addons</groupId>

                  <artifactId>junit-addons</artifactId>

              </dependency>

       

       

              <dependency>

                  <groupId>com.adobe.acs</groupId>

                  <artifactId>acs-aem-commons-bundle</artifactId>

              </dependency>

       

       

              <dependency>

                  <groupId>org.apache.commons</groupId>

                  <artifactId>commons-lang3</artifactId>

              </dependency>

              <dependency>

                  <groupId>org.jsoup</groupId>

                  <artifactId>jsoup</artifactId>

              </dependency>

              <dependency>

                  <groupId>org.apache.httpcomponents</groupId>

                  <artifactId>httpclient</artifactId>

              </dependency>

              <dependency>

                  <groupId>org.apache.sling</groupId>

                  <artifactId>org.apache.sling.testing.sling-mock</artifactId>

              </dependency>

       

       

       

       

       

       

              <dependency>

                  <groupId>org.apache.jackrabbit</groupId>

                  <artifactId>jackrabbit-jcr-commons</artifactId>

                  <version>2.11.0</version>

                  <scope>test</scope>

              </dependency>

       

       

              <dependency>

                  <groupId>org.apache.jackrabbit</groupId>

                  <artifactId>jackrabbit-jcr2dav</artifactId>

                  <version>2.5.1</version>

                  <scope>test</scope>

              </dependency>

              <dependency>

                  <groupId>org.apache.jackrabbit</groupId>

                  <artifactId>jackrabbit-webdav</artifactId>

                  <version>2.2.8</version>

                  <scope>test</scope>

              </dependency>

       

       

              <dependency>

                  <groupId>org.powermock</groupId>

                  <artifactId>powermock-module-junit4</artifactId>

              </dependency>

              <dependency>

                  <groupId>org.powermock</groupId>

                  <artifactId>powermock-api-mockito</artifactId>

              </dependency>

              <dependency>

                  <groupId>org.powermock</groupId>

                  <artifactId>powermock-core</artifactId>

              </dependency>

              <dependency>

                  <groupId>org.apache.commons</groupId>

                  <artifactId>commons-email</artifactId>

              </dependency>

              <dependency>

                  <groupId>commons-collections</groupId>

                  <artifactId>commons-collections</artifactId>

              </dependency>

       

       

              <dependency>

                  <groupId>commons-io</groupId>

                  <artifactId>commons-io</artifactId>

              </dependency>

       

       

              <dependency>

                  <groupId>com.fasterxml.jackson.core</groupId>

                  <artifactId>jackson-annotations</artifactId>

              </dependency>

              <dependency>

                  <groupId>com.fasterxml.jackson.core</groupId>

                  <artifactId>jackson-core</artifactId>

              </dependency>

              <dependency>

                  <groupId>com.fasterxml.jackson.core</groupId>

                  <artifactId>jackson-databind</artifactId>

              </dependency>

              <dependency>

                  <groupId>org.apache.httpcomponents</groupId>

                  <artifactId>httpcore</artifactId>

              </dependency>

              <dependency>

                  <groupId>com.amazonaws</groupId>

                  <artifactId>aws-java-sdk-s3</artifactId>

              </dependency>

              <dependency>

                  <groupId>com.amazonaws</groupId>

                  <artifactId>aws-java-sdk-dynamodb</artifactId>

              </dependency>

              <dependency>

                  <groupId>com.amazonaws</groupId>

                  <artifactId>aws-java-sdk-core</artifactId>

              </dependency>

              <dependency>

                  <groupId>commons-logging</groupId>

                  <artifactId>commons-logging</artifactId>

              </dependency>

              <dependency>

                  <groupId>joda-time</groupId>

                  <artifactId>joda-time</artifactId>

              </dependency>

              <dependency>

                  <groupId>commons-fileupload</groupId>

                  <artifactId>commons-fileupload</artifactId>

              </dependency>

              <dependency>

                  <groupId>org.apache.poi</groupId>

                  <artifactId>poi</artifactId>

              </dependency>

              <dependency>

                  <groupId>commons-lang</groupId>

                  <artifactId>commons-lang</artifactId>

              </dependency>

              <dependency>

                  <groupId>com.googlecode.json-simple</groupId>

                  <artifactId>json-simple</artifactId>

                  <version>1.1</version>

              </dependency>

      <dependency>

          <groupId>commons-httpclient</groupId>

          <artifactId>commons-httpclient</artifactId>

      </dependency>

          </dependencies>

      </project>

       

       

      My Sling Model, in BaseController, i am adding few padding to each component:-

       

       

      @Model(adaptables = SlingHttpServletRequest.class)

      public class DualImageComponentController extends BaseController {   

         

        

          private static final Integer DEFAULT_DESKTOP_IMG_HEIGHT = 300;

         

          private static final Integer DEFAULT_MOBILE_IMG_HEIGHT = 100;

         

          /**

           *  Full Width property.

           */

          @Inject @Via(ModelConstants.RESOURCE)

          @Optional

          private String fullWidth;

         

          /**

           * Image Desktop Resource.

           */

          @Inject @Via(ModelConstants.RESOURCE)

          private Resource imageDesktop;

         

          /**

           * Mobile Desktop Resource.

           */

          @Inject @Via(ModelConstants.RESOURCE)

          private Resource imageMobile;

         

          /**

           * Returns the model for this component.

           *

           * @return ImageComponentModel.

           */

          public BaseContentModel getModel() {

              final ImageModel largeImage = getDesktopImage();

              final ImageModel smallImage = getMobileImage();

              return ComponentModelBuilder.build(new ImageComponentModel(),

                  icm -> icm.setMobile(smallImage),

                  icm -> icm.setDesktop(largeImage),

                  icm -> icm.setFullWidth(null == fullWidth

                      ? false : Boolean.valueOf(fullWidth)));

       

       

          }

       

       

          /**

           * Returns the image model for Desktop image.

           *

           * @return ImageModel.

           */

          private ImageModel getDesktopImage() {

              final ImageModel largeImage = new ImageModel();

              final ValueMap vm = imageDesktop.getValueMap();

              if (vm != null) {

                  largeImage.setAltText(vm.get(ModelConstants.ALT, ""));

                  largeImage.setImageSrc(vm.get(ModelConstants.FILE_REFERENCE, ""));

                  largeImage.setHeight(((null != vm.get(ModelConstants.IMG_HEIGHT)

                          ? vm.get(ModelConstants.IMG_HEIGHT, Integer.class)

                          : DEFAULT_DESKTOP_IMG_HEIGHT)));

                  largeImage.setImagePosition(ModelConstants.EXTRA_CLASS + vm.get(ModelConstants.IMG_POSITION, ""));

              }

              return largeImage;

          }

         

          /**

           * Returns the image model for Mobile image.

           *

           * @return ImageModel.

           */

          private ImageModel getMobileImage() {

              final ImageModel smallImage = new ImageModel();

              final ValueMap vm = imageMobile.getValueMap();

              if (vm != null) {

                  smallImage.setAltText(vm.get(ModelConstants.ALT, ""));

                  smallImage.setImageSrc(vm.get(ModelConstants.FILE_REFERENCE, ""));

                  smallImage.setHeight(((null != vm.get(ModelConstants.IMG_HEIGHT)

                          ? vm.get(ModelConstants.IMG_HEIGHT, Integer.class)

                          : DEFAULT_MOBILE_IMG_HEIGHT)));

                  smallImage.setImagePosition(ModelConstants.EXTRA_CLASS + vm.get(ModelConstants.IMG_POSITION, ""));

              }

              return smallImage;

          }

       

       

      }

       

       

      Please help.