- I checked out source code fromhttp://dev.day.com/docs/en/crx/current/getting_started/first_steps_with_crx.html#Step%20Two:%20Check%20out%20CRX%20Bookstore%20Example
When I tried to invoke http://:4502/products.html
Actual result should list the products page from bookstore app
- I got "Cannot serve request to /products.html in /apps/bookstore/components/ranking/ranking.jsp: What version of the product are you using? On what operating system? I am using CQ5.5 (CRX 2.3) on windows 7 http://code.google.com/p/crxzon/issues/detail?id=4&thanks=4&ts=1362987616

- 101
- 4
- 16
-
Is there any other entry in error.log? Also, try clearing the cached Java files in CRX under /var/classes. – anotherdave Mar 11 '13 at 08:08
2 Answers
From what I see, you get NullPointerException in RankingServiceImpl:277
, because the repository
field is null. And the only way I can explain that is that SCR annotations didn't fire during the build.
Said that, I'm actually surprised your bundle started on CQ 5.5, as the dependencies seem to be to earlier versions (5.4 I guess) -- I suggest double checking that under /system/console/bundles
(search for CRX - Sample Bookstore Demo). If you're missing imports there, try playing with /src/impl/com.day.crx.sample.bookshop.bnd
to update versions as in CQ 5.5, or running it on CQ 5.4.

- 308
- 1
- 4
-
There is a typo on CQ5 site for invoking this bookstore, it is listed as http://
:7402/products.html. It must be http:// – user1130906 Mar 11 '13 at 15:19:7402/products/english.html. This is working fine after I invoke correct URL, however it is not listing all the product somewhere it is breaking in the middle with the following exception Cannot serve request to /products/english.html in /apps/bookstore/components/ranking/ranking.jsp
Exception:
org.apache.sling.api.SlingException: at org.apache.sling.scripting.jsp.jasper.servlet.JspServletWrapper.handleJspExceptionInternal
The annotations in RankingServiceImpl seem to be for an earlier version of CQ and CRX. Here are the changes that I made to get this to work:
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;

- 3,467
- 2
- 29
- 20