Trifork Blog

Axon Framework, DDD, Microservices

Mahout – Taste :: Part Two – Getting started

April 15th, 2010 by
|
This blog is a ‘getting started’ article and shows you how to build a simple web-based movie recommender with Mahout / Taste, Wicket and the Movielens dataset from Grouplens research group at the University of Minnesota. I will discuss which components you need, how to wire them up in Spring, and how to create a Wicket frontend for displaying movies and their recommendations. Along the way I give some tips and pointers about developing a recommender. Additionally I show the ResourceDataModel, a Mahout DataModel implementation which reads preferences from a Spring Resource.

Online movie store

Our running example for this post is an online DVD shop in which you can view and rent movies. Visitors go to a movie’s page to check out the plot description and will be shown a list of similar movies. These are other movies that were watched by people who also rented that specific movie. Because of space- and time-constraints, this application only provides a view on the dataset and the recommended movies. Other features expected of an online movie rental service, such as registration and payment are left out.

Movielens Dataset

The movies and their ratings originate from the Movielens dataset of the Grouplens research group from the University of Minnesota. There are datasets contains 100.000, 1 million and 10 million ratings. Note that these ratings are explicit, ranging from 1 to 5. This is different from the example in my earlier blog, which featured implicit ratings. Implicit ratings only indicate if a user purchased or liked an item but not how much someone liked it. In this example I used the 100.000 ratings file.

Item-based or user-based algorithms

For this application we use an item-based recommender, which is a good choice performance-wise if the number of items is less than the number of users. This is likely to be the case for an online movie rental store. Item-based recommendation is different from user-based recommendation, which works by identifying a user neighbourhood of similar users and recommending items from the user neighbourhood to other users. User-based recommendations are personalized while with item-based recommendations each user will get the same recommendations for a given item. In our case, all users that visit a specific movie page will see the same recommended movies for that movie. An example of user-based recommendation is Stumbleupon, which provides personalized website recommendations. Stumbleupon requires that you to login first so that it can perform its user-based recommendation based on your profile of likes and dislikes of certain sites.

EuclidianDistanceSimilarity

Now we need to select an item-based algorithm that fits our dataset. The EuclidianDistanceSimilarity is one of Taste’s algorithms that is suitable for explicit ratings and will be used for our demonstration. Before we construct our recommender we introduce the euclidian distance similarity in more detail. The algorithm computes the euclidian distance between each item’s preference vector. The shorter the distance between these vectors, the greater the similarity. For instance, suppose we have users u1, u2 and u3 and item i1. Let’s say these preferences for these users are 2, 4 and 5 respectively. We now have a preference vector [2,4,5] for item i1. The euclidian distance between two of such vectors can now be computed and used as a measure of their similarity. The formula for computing the euclidian distance between two vectors i and j equals the root of the sum of squared differences between coordinates of a pair of vectors. See the formula below:
$$!d_{ij}=\sqrt{\sum\limits_{k=1}^n \left(x_{ik} – x_{jk}\right)^2}$$

The EuclidianDistanceSimilarity calculates this similarity for each pair of items and then returns

$$!\frac{1}{1 + d_{ij}}$$

which results in a value between 0 and 1. The EuclidianDistanceSimilarity can also be weighted. If you pass in the Weighting.WEIGHTED enum to the constructor of EuclidianDistanceSimilarity then the algorithm will weight the values based on the number of users and the number of co-occurring preferences.

Creating a web-based recommender

Below is a list of components we need to create a small web-based recommendation engine, using Taste, Wicket and JPA/Hibernate. I won’t cover all the details of building this webapp, just the main building blocks. You can download the code for this example here and look at the specific details. We need the following components:

  • Datamodel
    A FileDataModel that reads movie ids, user ids and ratings from the Movielens dataset directly into memory.
  • EuclidianDistanceSimilarity
    Computes item similarities for each pair of items in the datset.
  • GenericItemBasedRecommender
    Uses both the datamodel and the similarity algorithm to compute similar items in memory.
  • MovieRepository
    JPA repository for retrieving Movie objects
  • MovieService
    Uses the recommender and the MovieRepository to retrieve most similar movies for a given movie id.
  • Wicket MoviePage, HTML + CSS
    This includes a page for viewing a movie along with similar movies, a few model classes, some HTML and CSS, and a few code tweaks to the original wicket quickstart project.

Note that Taste ships with a preconfigured MovielensRecommender. For the purpose of this article however, I wanted to show you how to build a recommender from the ground up.

Configuring the ResourceDataModel, EuclidianDistanceSimilarity and GenericItemBasedRecommender

Because of license restrictions the movielens data cannot be shipped with this demo, so you need to download it here. Place the u.data file under src/main/resources/grouplens/100K/ratings/ and place the u.item file under src/main/resources/grouplens/100K/data/. Now that you have the ratings data setup you need to feed it into a DataModel class. You can use a FileDataModel for this but for this you need to use an absolute path. Instead I implement a ResourceDataModel which reads ratings files from the classpath. Below is the implementation of the ResourceDataModel, which is a wrapper around a FileDataModel. More on how to wire this below.

package nl.jteam.mahout.gettingstarted.datamodel;

// Imports omitted.

/**
 * DataModel implementation which reads a Spring {@link org.springframework.core.io.Resource} into a
 * {@link org.apache.mahout.cf.taste.impl.model.file.FileDataModel} delegate.
 *
 * @author Frank Scholten
 */
public class ResourceDataModel implements DataModel {
    FileDataModel delegate;

    ResourceDataModel() { // For testing
    }

    /**
     * Reads the preferences from the given {@link org.springframework.core.io.Resource}
     *
     * @param resource with user IDs, items IDs and preferences
     */
    public ResourceDataModel(Resource resource) {
        try {
            this.delegate = new FileDataModel(resource.getFile());
        } catch (IOException e) {
            throw new RuntimeException("Could not read resource " + resource.getDescription(), e);
        }
    }

    @Override
    public LongPrimitiveIterator getUserIDs() throws TasteException {
        return delegate.getUserIDs();
    }

    @Override
    public PreferenceArray getPreferencesFromUser(long userID) throws TasteException {
        return delegate.getPreferencesFromUser(userID);
    }

    @Override
    public FastIDSet getItemIDsFromUser(long userID) throws TasteException {
        return delegate.getItemIDsFromUser(userID);
    }

    @Override
    public LongPrimitiveIterator getItemIDs() throws TasteException {
        return delegate.getItemIDs();
    }

    @Override
    public PreferenceArray getPreferencesForItem(long itemID) throws TasteException {
        return delegate.getPreferencesForItem(itemID);
    }

    @Override
    public Float getPreferenceValue(long userID, long itemID) throws TasteException {
        return delegate.getPreferenceValue(userID, itemID);
    }

    @Override
    public int getNumItems() throws TasteException {
        return delegate.getNumItems();
    }

    @Override
    public int getNumUsers() throws TasteException {
        return delegate.getNumUsers();
    }

    @Override
    public int getNumUsersWithPreferenceFor(long... itemIDs) throws TasteException {
        return delegate.getNumUsersWithPreferenceFor(itemIDs);
    }

    @Override
    public void setPreference(long userID, long itemID, float value) throws TasteException {
        delegate.setPreference(userID, itemID, value);            
    }

    @Override
    public void removePreference(long userID, long itemID) throws TasteException {
        delegate.removePreference(userID, itemID);
    }

    @Override
    public boolean hasPreferenceValues() {
        return delegate.hasPreferenceValues();
    }

    @Override
    public void refresh(Collection<Refreshable> alreadyRefreshed) {
        delegate.refresh(alreadyRefreshed);
    }
}

Next you need to initialize the movie database. Run the initialize_movielens_db.sql from the src/main/resources/sql folder. This will create the movielens database and a user with username and password movielens. Additionally, it creates the movie database and loads it with the movie titles from the u.item file.

Now we wire up the GenericItemBasedRecommender and its dependencies, the EuclidianDistanceSimilarity and the ResourceDataModel in the following spring context:

 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <!-- Recommender -->

    <bean id="euclidianDistanceRecommender" class="org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender">
        <constructor-arg index="0" ref="movielensDataModel100K"/>
        <constructor-arg index="1" ref="euclidianDistanceSimilarity"/>
    </bean>

    <!-- DataModel -->

    <bean id="movielensDataModel100K" class="nl.jteam.mahout.gettingstarted.datamodel.ResourceDataModel">
        <constructor-arg value="classpath:/grouplens/100K/ratings/u.data"/>
    </bean>

    <!-- Similarity -->

    <bean id="euclidianDistanceSimilarity" class="org.apache.mahout.cf.taste.impl.similarity.EuclideanDistanceSimilarity">
        <constructor-arg ref="movielensDataModel100K"/>
        <constructor-arg value="WEIGHTED"/>
    </bean>

</beans>

MovieRepository, MovieService & MoviePage

Our recommender is now ready to determine similar movies for a given movie ID. However, the GenericItemBasedRecommender interface only returns movie IDs of the type long. In order to display the actual movie information to users we need to create a MovieRepository which fetches recommended Movie objects. Additionally, we need a MovieService which coordinates the MovieRepository and the GenericItemBasedRecommender so that we can retrieve recommended Movie objects for a given movie ID. Below is a snippet of a JPA implementation of a MovieRepository.

package nl.jteam.mahout.gettingstarted.repository;

// Imports omitted.

/**
 * Repository for retrieving {@link Movie}s
 *
 * @author Frank Scholten
 */
@Repository
public class JpaMovieRepository implements MovieRepository {

    @PersistenceContext
    private EntityManager entityManager;

    /** {@inheritDoc} */
    @Override
    public Movie getMovieById(long id) {
        return entityManager.find(Movie.class, id);
    }

    /** {@inheritDoc} */
    @Override
    @SuppressWarnings("unchecked")
    public List<Movie> getMoviesById(List<Long> movieIds) {
        return (List<Movie>) entityManager.createQuery("SELECT m FROM movie m WHERE m.id IN (:movieIds)")
                .setParameter("movieIds", movieIds)
                .getResultList();
    }
}

Below is a code snippet of a default implementation of the MovieService.

package nl.jteam.mahout.gettingstarted.service;

// Imports omitted.

/**
 * Service for retrieving and recommending {@link Movie}s.
 *
 * @author Frank Scholten
 */
@Transactional
@Service
public class DefaultMovieService implements MovieService {

    @Autowired
    private MovieRepository movieRepository;

    @Autowired
    private ItemBasedRecommender movieRecommender;

    public Movie getMovieById(long id) {
        return movieRepository.getMovieById(id);
    }

    @SuppressWarnings("unchecked")
    public List<Movie> moreLikeThis(long movieId) {
        try {
            List<RecommendedItem> recommendedItems = movieRecommender.mostSimilarItems(movieId, 5);

            List<Long> ids = new ArrayList();
            for (RecommendedItem r : recommendedItems) {
                ids.add(r.getItemID());
            }

            return movieRepository.getMoviesById(ids);

        } catch (TasteException e) {
            return (List<Movie>) Collections.EMPTY_LIST;
        }
    }
}

Finally, below is the snippet of the Wicket MoviePage which displays the current movie and similar movies fetched through specially created Wickets models.

package nl.jteam.mahout.gettingstarted.web.page;

// Imports omitted.

/**
 * Page for showing a single {@link Movie} from the Movielens dataset along
 * with recommended movies i.e. 'more like this'.
 *
 * @author Frank Scholten
 */
public class MoviePage extends WebPage {

    private static final String MOVIE_ID = "0";

    public MoviePage(PageParameters pageParameters) {
        final long movieId = pageParameters.getLong(MOVIE_ID, 1);

        MovieModel model = new MovieModel(movieId);
        add(new Label("title", model.getObject().getTitle()));

        PropertyListView<Movie> recommendedMovies = new PropertyListView<Movie>("moreLikeThis", new RecommendedMoviesModel(movieId)) {
            @Override
            protected void populateItem(ListItem listItem) {
                Movie movie = (Movie) listItem.getModelObject();
                PageParameters pageParameters = new PageParameters();
                pageParameters.put(MOVIE_ID, movie.getId());

                BookmarkablePageLink<MoviePage> movieLink = new BookmarkablePageLink<MoviePage>("link", MoviePage.class, pageParameters);
                listItem.add(movieLink);
                Label movieTitle = new Label("title");
                movieTitle.setRenderBodyOnly(true);
                movieLink.add(movieTitle);
            }
        };
        add(recommendedMovies);
    }
}

Running the web application

First you need to download the Movielens dataset and add the ratings file on the classpath under grouplens/100K/ratings. See the spring context above. Since this example is based on the Wicket quickstart project you can start the application via Jetty through the Start class and run it in your favourite IDE. Go to http://localhost:9090/ and you can browse through movies via recommendations. Alternatively you can build the WAR and drop it into tomcat.

Performance tweaks

  • If you like to experiment with the larger datasets you need to add -Xmx512m as a VM parameter if you want to run this application with the 10 million ratings dataset. Also, Tastes FileDataModel uses commas and tabs as delimiter. You may need to run the Movielens files through sed before feeding them into a FileDataModel
  • The FileDataModel reads everything in memory before computation. This is way faster than using a MySQLJDBCDataModel, since this requires around O(n2) database queries to compute similarities between all pairs. Reading all data in memory is not always feasible however. An alternative is to precompute the similarities for the item pairs and store the results in the database and read them via the MySQLJDBCItemSimilarity.
  • You can also sample the dataset and/or remove noise elements to speed things up a little more

These performance aspects are an interesting topic for a later blogpost. If any of you reading this has experience with these type of issues please post a comment and we’ll discuss them.

Conclusions

This concludes the getting started post on Mahout / Taste. What we didn’t cover was how to update the recommender and how to customize your recommender with boosting of items. These are all subjects for future blog posts.

References

  • Getting started demo – source code
  • You can download the source code of this example here.

  • Grouplens datasets
  • The Grouplens research group of the University of Minnesota have made a few datasets publicly available for research purposes.

  • Mahout in Action EAP
  • This is a great resource on Mahout and explains a lot about performance issues and details how the algorithms stack up against eachother. Also it provides a lot of examples and case studies on how to use Mahout in practice.

8 Responses

  1. […] I used the movielens dataset as an example in the presentation and based the code on my earlier ‘getting started’ […]

  2. […] library. It also ships with examples for movie recommendations [2].[1] http://mahout.apache.org/%5B2%5D http://blog.jteam.nl/2010/04/15/…Insert a dynamic date hereCannot add comment at this […]

  3. March 10, 2011 at 11:41 by Rahul Sharma

    Thank you for such a great tutorial.
    Can this tutorial be run with MS SQL???

    Thank You again

  4. March 18, 2011 at 07:48 by Rahul Sharma

    Hi Frank,

    finally i’ve been able to run the tutorial, i’m able to see the results while in debug mode in eclipse. But when I run it in normal mode it gives me exception, following is the stack trace of it:

    WicketMessage: Exception in rendering component: [MarkupContainer [Component id = 0, page = main.java.nl.jteam.mahout.gettingstarted.web.page.MoviePage, path = 7:moreLikeThis:0.ListItem, isVisible = true, isVersioned = true]]

    Root cause:

    java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.String
    at org.apache.wicket.request.target.coding.IndexedParamUrlCodingStrategy.appendParameters(IndexedParamUrlCodingStrategy.java:77)
    at org.apache.wicket.request.target.coding.BookmarkablePageRequestTargetUrlCodingStrategy.encode(BookmarkablePageRequestTargetUrlCodingStrategy.java:149)
    at org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.pathForTarget(WebRequestCodingStrategy.java:469)
    at org.apache.wicket.protocol.http.request.WebRequestCodingStrategy.encode(WebRequestCodingStrategy.java:239)
    at org.apache.wicket.RequestCycle.encodeUrlFor(RequestCycle.java:760)
    at org.apache.wicket.RequestCycle.urlFor(RequestCycle.java:944)
    at org.apache.wicket.Component.urlFor(Component.java:3253)
    at org.apache.wicket.markup.html.link.BookmarkablePageLink.getURL(BookmarkablePageLink.java:274)
    at org.apache.wicket.markup.html.link.Link.onComponentTag(Link.java:401)
    at org.apache.wicket.Component.renderComponent(Component.java:2532)
    at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1494)
    at org.apache.wicket.Component.render(Component.java:2398)
    at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1377)
    at org.apache.wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:1559)
    at org.apache.wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:1483)
    at org.apache.wicket.Component.renderComponent(Component.java:2561)
    at org.apache.wicket.MarkupContainer.onRender(MarkupContainer.java:1494)
    at org.apache.wicket.Component.render(Component.java:2398)
    at org.apache.wicket.markup.html.list.ListView.renderItem(ListView.java:634)
    at org.apache.wicket.markup.html.list.ListView.renderChild(ListView.java:622)
    at org.apache.wicket.markup.repeater.AbstractRepeater.onRender(AbstractRepeater.java:103)
    at org.apache.wicket.Component.render(Component.java:2398)
    at org.apache.wicket.MarkupContainer.renderNext(MarkupContainer.java:1377)
    at org.apache.wicket.MarkupContainer.renderAll(MarkupContainer.java:1510)
    at org.apache.wicket.Page.onRender(Page.java:1479)
    at org.apache.wicket.Component.render(Component.java:2398)
    at org.apache.wicket.Page.renderPage(Page.java:895)
    at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.respond(BookmarkablePageRequestTarget.java:245)
    at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequestCycleProcessor.java:104)
    at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1175)
    at org.apache.wicket.RequestCycle.step(RequestCycle.java:1246)
    at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1347)
    at org.apache.wicket.RequestCycle.request(RequestCycle.java:497)
    at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:387)
    at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:199)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:712)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139)
    at org.mortbay.jetty.Server.handle(Server.java:313)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:506)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:830)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:514)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:381)
    at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:227)
    at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:451)

    In would be very thankful if you can help me out

    Thanks,
    Rahul Sharma

  5. April 28, 2011 at 18:13 by Shem Cristobal

    Why is the EuclideanDistanceSimilarity formula stated here as 1 / (1-dij)? Mahout code says it’s 1 / (1 + dij).

  6. May 3, 2011 at 12:57 by Frank Scholten

    @Shem You’re right, I updated the formula

  7. May 19, 2011 at 16:33 by Frank Scholten

    @Rahul I just installed and ran the example and I can’t reproduce your exception. What happens if you go to http://localhost:9090/movies/23 for instance? You should see ‘Taxi Driver’ along with similar items

  8. September 24, 2011 at 21:23 by Aksy

    I was trying to run this on Netbeans and I keep getting this error when I access http://localhost:8080/

    Error 404 – Not Found.
    No context on this server matched or handled this request.
    Contexts known to this server are:

    /taste-getting-started —> org.mortbay.jetty.plugin.Jetty6PluginWebAppContext@1931a2d{/taste-getting-started,C:\Users\akshaya\Documents\AKS CSE Stuff\mahout\core\src\main\java\taste-getting-started\src\main\webapp}

    I tried accessing this URL: http://127.0.0.1:8080/taste-getting-started/movies and it still kept giving me the error below:

    Unexpected RuntimeException

    WicketMessage: Can’t instantiate page using constructor public nl.jteam.mahout.gettingstarted.web.page.MoviePage(org.apache.wicket.PageParameters) and argument

    Root cause:

    java.lang.ClassNotFoundException: org.springframework.orm.ObjectRetrievalFailureException
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:401)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:392)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)
    at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:167)
    at $Proxy19.find(Unknown Source)
    at nl.jteam.mahout.gettingstarted.repository.JpaMovieRepository.getMovieById(JpaMovieRepository.java:24)
    at nl.jteam.mahout.gettingstarted.service.DefaultMovieService.getMovieById(DefaultMovieService.java:32)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    at $Proxy24.getMovieById(Unknown Source)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:416)
    at org.apache.wicket.proxy.$Proxy26.getMovieById(Unknown Source)
    at nl.jteam.mahout.gettingstarted.web.model.MovieModel.load(MovieModel.java:26)
    at nl.jteam.mahout.gettingstarted.web.model.MovieModel.load(MovieModel.java:12)
    at org.apache.wicket.model.LoadableDetachableModel.getObject(LoadableDetachableModel.java:120)
    at nl.jteam.mahout.gettingstarted.web.page.MoviePage.(MoviePage.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:188)
    at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:65)
    at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:298)
    at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:320)
    at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:234)
    at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
    at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
    at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
    at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428)
    at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
    at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:479)
    at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:312)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1148)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:387)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
    at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
    at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:324)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:535)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:865)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:539)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)

    Complete stack:

    org.apache.wicket.WicketRuntimeException: Can’t instantiate page using constructor public nl.jteam.mahout.gettingstarted.web.page.MoviePage(org.apache.wicket.PageParameters) and argument
    at org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:212)
    at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:65)
    at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:298)
    at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:320)
    at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:234)
    at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
    at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
    at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
    at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428)
    at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
    at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:479)

    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:188)
    at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:65)
    at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:298)
    at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:320)
    at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:234)
    at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
    at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
    at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
    at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428)
    at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
    at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:479)

    java.lang.NoClassDefFoundError: org/springframework/orm/ObjectRetrievalFailureException
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:392)
    at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:363)
    at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:167)
    at $Proxy19.find(Unknown Source)
    at nl.jteam.mahout.gettingstarted.repository.JpaMovieRepository.getMovieById(JpaMovieRepository.java:24)
    at nl.jteam.mahout.gettingstarted.service.DefaultMovieService.getMovieById(DefaultMovieService.java:32)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:107)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    at $Proxy24.getMovieById(Unknown Source)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.apache.wicket.proxy.LazyInitProxyFactory$JdkHandler.invoke(LazyInitProxyFactory.java:416)
    at org.apache.wicket.proxy.$Proxy26.getMovieById(Unknown Source)
    at nl.jteam.mahout.gettingstarted.web.model.MovieModel.load(MovieModel.java:26)
    at nl.jteam.mahout.gettingstarted.web.model.MovieModel.load(MovieModel.java:12)
    at org.apache.wicket.model.LoadableDetachableModel.getObject(LoadableDetachableModel.java:120)
    at nl.jteam.mahout.gettingstarted.web.page.MoviePage.(MoviePage.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
    at org.apache.wicket.session.DefaultPageFactory.createPage(DefaultPageFactory.java:188)
    at org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory.java:65)
    at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.newPage(BookmarkablePageRequestTarget.java:298)
    at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.getPage(BookmarkablePageRequestTarget.java:320)
    at org.apache.wicket.request.target.component.BookmarkablePageRequestTarget.processEvents(BookmarkablePageRequestTarget.java:234)
    at org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(AbstractRequestCycleProcessor.java:92)
    at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:1250)
    at org.apache.wicket.RequestCycle.step(RequestCycle.java:1329)
    at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1428)
    at org.apache.wicket.RequestCycle.request(RequestCycle.java:545)
    at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:479)

    PLEASE HELP!!!

    Thanks in advance!