The output of taste-web is a .war file, a deployable web application.
By itself it does nothing; it has to be deployed in a servlet
container like Tomcat (or Glassfish, or Resin...)

The Maven script should also be able to run the example via a built-in
web container, inside Maven, which is based on yet another project
(Jetty, if I recall correctly).

If you change that example to use MySQLDataModel, that's fine. It
still compiles. There is no way it depends on MySQL Connector/J
directly. If you get such compile errors it's due to dependencies in
your project, not Mahout, so I couldn't really help with that.

To be clear: in general, you *never* use MySQL Connector/J directly in
your app. You configure your container to use it. So if you are having
compile-time problems with the connector, that's following the wrong
approach, and not one that Mahout uses.

The built-in Jetty container wouldn't run such a modification, even
though the result compiles, because the built-in Jetty container would
have no MySQL database connection configured. I suppose you could
manage to "fix" this by depending directly on MySQL Connector/J in the
Maven build, so that the classes are added to the web app instead of
container, but that's generally the wrong way to do it so I wouldn't
want to help you down that road.


To keep it simple I recommend you just look up how to configure a JDBC
data source in Tomcat and try deploying the .war in Tomcat. That's the
normal usage. I think if you read up on J2EE containers a bit it will
make a lot more sense.


2011/2/16 Daniel Mühlbachler <[email protected]>:
> ok, so I must install tomcat too and write an extra application for tomcat
> to realise a standalone server to handle SOAP request handling? Wouldn't
> that be nonsense because "taste-web" does the same?
> I'm sorry but maybe I have a simple problem understanding the purpose of the
> "taste-web" thing because the provided grouplens example works too if I copy
> the compiled jar file into the lib directory and so on. Because of that I
> thought it would be the same - just edit the grouplens example to use
> MySQLDataModel instead of FileDataModel, compile it, make a jar, copy it
> into the same directory and run mvn package; then run mvn jetty:run-war and
> everything should work. In fact, I can't compile my source files because
> they need mahout core and MySQL Connector/J (to provide a dataSource).
> I'm really confused now...
> Quote from the source you provided me - that's what I meant that I want:
> "
>
>
>     Standalone server
>
> A Mahout recommender can also be run as an external server, which may be the
> only option for non-Java applications. It can be exposed as a web
> application via{{org.apach.mahout.cf.taste.web.RecommenderServlet}}, and
> your application can then access recommendations via simple HTTP requests
> and response, or as a full-fledged SOAP web service. See above, and see the
> javadoc for details.
>
> To deploy your Recommender as an external server:
>
>   * Obtain a copy of the Mahout distribution, either from SVN or as a
>     downloaded archive.
>   * Create an implementation of
>     org.apache.mahout.cf.taste.recommender.Recommender (must have a
>     no-arg constructor).
>   * Compile it and create a JAR file containing your implementation.
>   * Navigate to the directory where you unpacked the Mahout
>     distribution, and navigate to{{trunk}}.
>   * Run{{mvn install}}, which builds and installs Mahout core to your
>     local repository
>   * cd taste-web
>   * Copy your .jar file: cp [your .jar file] ./lib
>   * Edit recommender.properties and fill in the recommender.class with
>     your Recommender clas: recommender.class=[your recommender class]
>   * mvn package
>   * Your .war file is now available in the build directory as
>     mahout-taste-webapp.war (which can be renamed).
>
> ", but as I told you before, I can't compile my implementation - or better
> my variation of the grouplens example - of the taste recommender...
>
>
> Am 16.02.2011 15:38, schrieb Sean Owen:
>>
>> Nope, it is something you deploy in your container like Tomcat. It's
>> nothing to do with Mahout or your web app directly.
>>
>> MySQLDataModel does not depend on MySQL Connector directly, so you do
>> not need this dependency. It is simply an implementation which uses
>> MySQL-friendly SQL syntax.
>>
>> 2011/2/16 Daniel Mühlbachler<[email protected]>:
>>>
>>> Ok, so if I understand that correctly, I must copy the MySQL Connector/J
>>> into<mahout>/taste-web/lib, then make a mvn package and the connector
>>> should work? But the problem is my recommender class. For test purposes I
>>> just edited the grouplens example to make a MySQLDataModel instead of a
>>> FileDataModel but I can't compile this file because of the unsolved
>>> dependencies (mahout deps on my local environment via Eclipse, or MySQL
>>> Connector deps on my server (e.g. with overwriting the grouplens examples
>>> and compile the examples again)). Do you know a way to compile those
>>> source
>>> files without the need of those deps (it's a never ending circle :) )?
>>>
>

Reply via email to