首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CQ5书店应用程序错误

CQ5书店应用程序错误
EN

Stack Overflow用户
提问于 2013-03-11 07:48:43
回答 2查看 251关注 0票数 0
  1. 我从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 http://code.google.com/p/crxzon/issues/detail?id=4&thanks=4&ts=1362987616上使用CQ5.5 (CRX2.3)。
EN

回答 2

Stack Overflow用户

发布于 2013-03-11 08:18:18

据我所见,您可以在NullPointerException中获得RankingServiceImpl:277,因为repository字段为null。我唯一能解释的方法是SCR注释在构建过程中没有触发。

说到这一点,我很惊讶您的包是从CQ5.5开始的,因为依赖项似乎是早期版本(我猜是5.4) --我建议在/system/console/bundles (搜索CRX示例书店演示)下对此进行反复检查。如果缺少导入,请尝试使用/src/impl/com.day.crx.sample.bookshop.bnd更新版本,如CQ5.5,或在CQ5.4上运行。

票数 0
EN

Stack Overflow用户

发布于 2013-12-20 05:33:00

RankingServiceImpl中的注释似乎适用于早期版本的CQ和CRX。以下是我为使其发挥作用所做的修改:

代码语言:javascript
复制
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;
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15333547

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档