【问题标题】:CQ5(CRX) bookstore application errorCQ5(CRX)书店申请错误
【发布时间】:2013-03-11 07:48:43
【问题描述】:
  1. 我从 http://dev.day.com/docs/en/crx/current/getting_started/first_steps_with_crx.html#Step%20Two:%20Check%20out%20CRX%20Bookstore%20Example 查看了源代码
  2. 当我尝试调用 http://:4502/products.html

  3. 实际结果应该是书店应用中的产品页面

  4. 我收到“无法在 /apps/bookstore/components/ranking/ranking.jsp 中为 /products.html 提供请求:您使用的是什么版本的产品?在什么操作系统上? 我在 Windows 7 上使用 CQ5.5 (CRX 2.3) http://code.google.com/p/crxzon/issues/detail?id=4&thanks=4&ts=1362987616

【问题讨论】:

  • error.log 中是否还有其他条目?另外,请尝试清除 CRX 中 /var/classes 下的缓存 Java 文件。

标签: aem crx


【解决方案1】:

据我所知,RankingServiceImpl:277 中出现 NullPointerException,因为 repository 字段为空。我可以解释的唯一方法是 SCR 注释在构建期间没有触发。

这么说,我真的很惊讶你的包从 CQ 5.5 开始,因为依赖项似乎是早期版本(我猜是 5.4)——我建议在 /system/console/bundles 下仔细检查(搜索 CRX - 示例书店演示)。如果您在那里缺少导入,请尝试使用 /src/impl/com.day.crx.sample.bookshop.bnd 来更新 CQ 5.5 中的版本,或者在 CQ 5.4 上运行它。

【讨论】:

  • CQ5 网站调用这家书店有一个错字,它被列为 http://:7402/products.html。它必须是 http://:7402/products/english.html。这在我调用正确的 URL 后工作正常,但是它没有列出它在中间中断的所有产品,但出现以下异常

    无法在 /apps/bookstore/components/ 中向 /products/english.html 提供请求排名/排名.jsp

    异常:

    org.apache.sling.api.SlingException:在 org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspExceptionInternal
                    
                  
                    
                            
                
【解决方案2】:

RankingServiceImpl 中的注释似乎是针对早期版本的 CQ 和 CRX。以下是我为使其正常工作所做的更改:

import org.apache.felix.scr.annotations.Property;
import org.apache.felix.scr.annotations.Reference;


/**
 * Default implementation of the ranking service.
 * The ranking is updated through observation (based on OSGi events).
 * The service can be used by clients to get the highest ranked products.
 */
@Component(immediate = true)
@Service(value = RankingService.class)
@Property(name = org.osgi.service.event.EventConstants.EVENT_TOPIC, value = SlingConstants.TOPIC_RESOURCE_ADDED)
public class RankingServiceImpl
    implements RankingService, EventHandler, Runnable {

    private Logger logger = LoggerFactory.getLogger(this.getClass());
    // private Logger logger = LoggerFactory.getLogger("RankingServiceImpl");


    private static final String PROPERTY_PREV_RANKING = "lowerRankingRef";
    private static final String PROPERTY_NEXT_RANKING = "higherRankingRef";

    private static final int SHOW_HIGHEST_RANKING = 3;

    /** Flag for stopping the background service. */
    private volatile boolean running = false;

    /** A local queue for handling new orders. */
    protected final BlockingQueue<String> orders = new LinkedBlockingQueue<String>();

    @Reference
    private SlingRepository repository;

    @Reference
    private ResourceResolverFactory resourceResolverFactory;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-03-09
    • 2020-06-24
    • 2016-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多