You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by Daniel Mühlbachler <da...@muehlbachler.org> on 2011/02/16 14:32:00 UTC
Taste-Web MySQLDataModel recommender example needed!
Hello,
has anyone configured a taste-web recommender with a MySQLDataModel? I
tried to implement a dataSource based on mysql-connector (provided by
MySQL) but that doesn't work because if I try "mvn compile" errors occur
with the mysql connector class.
What I need is just an example of a working recommender based on
taste-web and a MySQLDataModel. (I am working about 2 weeks to get
something run as it should!)
Thanks in advance!
Best regards,
Daniel Mühlbachler
Re: Taste-Web MySQLDataModel recommender example needed!
Posted by Daniel Mühlbachler <da...@muehlbachler.org>.
edit: sry, tomcat is already installed because otherwise the taste-web
examples wouldn't work... :)
Am 16.02.2011 15:49, schrieb Daniel Mühlbachler:
> 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<da...@muehlbachler.org>:
>>> 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 :) )?
>>>
>
Re: Taste-Web MySQLDataModel recommender example needed!
Posted by Daniel Mühlbachler <da...@muehlbachler.org>.
yep, I'm sorry for my bad way of expressing but I meant that. I give the
connection details to my container through a ressource file and fetch a
dataSource from there which will be given to my constructor/recommender.
The point is that the fetched thing has a type and I meant that this
type would be of the abstract class DataSource.
Am 16.02.2011 16:39, schrieb Sean Owen:
> No. You don't make any DataSource. Your container does, once you've
> configured it. You look it up with JNDI (or just use the constructor
> that takes the JNDI name -- the Mahout implementation will look it
> up.)
>
> There is no workaround here. It all works as intended, as-is. You do
> have to understand how to configure a J2EE container to use the output
> of taste-web, which is a J2EE .war file.
>
> 2011/2/16 Daniel Mühlbachler<da...@muehlbachler.org>:
>> OK, so I must deploy my container a ressource file where all needed data is
>> specified to connect to my MySQL server/database. Then I make a dataSource
>> with an abstract type DataSource which is fetched via JNDI from my ressource
>> file (I don't know which type it has - e.g. MySQL/PostgreSQL/... because I'm
>> using an abstract type). This dataSource is given to my constructor and it
>> should work? (so, it's something like a "workaround" :D )
>> In fact, I can use the Maven Jetty WebServer too if am able to deploy a
>> valid ressource file and can include the MySQL Connector/J or I can make mvn
>> package in the taste-web folder and copy the war file to an other container
>> (e.g. Tomcat) to work with this file.
>>
Re: Taste-Web MySQLDataModel recommender example needed!
Posted by Daniel Mühlbachler <da...@muehlbachler.org>.
btw... Thank you very very very much for your help! I would have never
made it that way! ;)
Am 16.02.2011 16:39, schrieb Sean Owen:
> No. You don't make any DataSource. Your container does, once you've
> configured it. You look it up with JNDI (or just use the constructor
> that takes the JNDI name -- the Mahout implementation will look it
> up.)
>
> There is no workaround here. It all works as intended, as-is. You do
> have to understand how to configure a J2EE container to use the output
> of taste-web, which is a J2EE .war file.
>
> 2011/2/16 Daniel Mühlbachler<da...@muehlbachler.org>:
>> OK, so I must deploy my container a ressource file where all needed data is
>> specified to connect to my MySQL server/database. Then I make a dataSource
>> with an abstract type DataSource which is fetched via JNDI from my ressource
>> file (I don't know which type it has - e.g. MySQL/PostgreSQL/... because I'm
>> using an abstract type). This dataSource is given to my constructor and it
>> should work? (so, it's something like a "workaround" :D )
>> In fact, I can use the Maven Jetty WebServer too if am able to deploy a
>> valid ressource file and can include the MySQL Connector/J or I can make mvn
>> package in the taste-web folder and copy the war file to an other container
>> (e.g. Tomcat) to work with this file.
>>
Re: Taste-Web MySQLDataModel recommender example needed!
Posted by Sean Owen <sr...@gmail.com>.
No. You don't make any DataSource. Your container does, once you've
configured it. You look it up with JNDI (or just use the constructor
that takes the JNDI name -- the Mahout implementation will look it
up.)
There is no workaround here. It all works as intended, as-is. You do
have to understand how to configure a J2EE container to use the output
of taste-web, which is a J2EE .war file.
2011/2/16 Daniel Mühlbachler <da...@muehlbachler.org>:
> OK, so I must deploy my container a ressource file where all needed data is
> specified to connect to my MySQL server/database. Then I make a dataSource
> with an abstract type DataSource which is fetched via JNDI from my ressource
> file (I don't know which type it has - e.g. MySQL/PostgreSQL/... because I'm
> using an abstract type). This dataSource is given to my constructor and it
> should work? (so, it's something like a "workaround" :D )
> In fact, I can use the Maven Jetty WebServer too if am able to deploy a
> valid ressource file and can include the MySQL Connector/J or I can make mvn
> package in the taste-web folder and copy the war file to an other container
> (e.g. Tomcat) to work with this file.
>
Re: Taste-Web MySQLDataModel recommender example needed!
Posted by Daniel Mühlbachler <da...@muehlbachler.org>.
OK, so I must deploy my container a ressource file where all needed data
is specified to connect to my MySQL server/database. Then I make a
dataSource with an abstract type DataSource which is fetched via JNDI
from my ressource file (I don't know which type it has - e.g.
MySQL/PostgreSQL/... because I'm using an abstract type). This
dataSource is given to my constructor and it should work? (so, it's
something like a "workaround" :D )
In fact, I can use the Maven Jetty WebServer too if am able to deploy a
valid ressource file and can include the MySQL Connector/J or I can make
mvn package in the taste-web folder and copy the war file to an other
container (e.g. Tomcat) to work with this file.
Am 16.02.2011 16:27, schrieb Sean Owen:
> You do not need to use the Connector/J classes directly, and shouldn't.
>
> Yes, you need a DataSource. If you're inside a web container, then you
> can and should already have configured the database connection in the
> container's configuration file. It makes the DataSource available for
> lookup via JNDI.
>
> At no point do you need to know that the DataSource is actually a
> MysqlDataSource in your code, no.
>
> I think you need to read that Tomcat page and understand how J2EE
> containers deal with DataSources via JNDI. It will be clearer. This is
> not specific to Mahout.
>
> 2011/2/16 Daniel Mühlbachler<da...@muehlbachler.org>:
>> yeah, that's what I meant. My problem is that I am importing the MySQL
>> Connector/J directly in my source file.
>> So all my source files are not allowed to use such a class? But the
>> MySQLJDBCDataModel has a constructor like ...(DataSource ds, ...) and
>> DataSource is provided by the MySQL Connector/J but how can I give my
>> constructor a dataSource if I can't use the classes I need - deps that
>> shouldn't be there?
>>
>> Moreover, if I can configure the jetty server that it can handle MySQL
>> connections it's also ok but how can I compile a java source file that needs
>> a dataSource which is declared in a class I can't use directly? (something
>> paradox...)
>>
>>
>> Am 16.02.2011 16:13, schrieb Sean Owen:
>>> No. As I've said, you never import the driver / connector classes
>>> directly. You have a complete working example: Mahout. As you can see
>>> it doesn't depend on this.
>>>
>>> As I've also said, please read the documentation for Tomcat (or your
>>> container). Here you go:
>>>
>>> http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html#JDBC_Data_Sources
>>>
>>> This is where MySQL Connector/J is involved.
>>>
>>> 2011/2/16 Daniel Mühlbachler<da...@muehlbachler.org>:
>>>> ok, thanks for your detailed answer - now I understand! :)
>>>>
>>>> So my problem is that I must import the MySQL Connector/J into my source
>>>> files because I need them. The nasty thing about that is that I just need
>>>> "import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;" in my dataSource
>>>> but
>>>> that won't work because there shouldn't be any dependencies on that
>>>> because
>>>> I must configure the web application to use/provide the connector.
>>>> omg... Is there any example round here that shows such a configuration?
>>>>
Re: Taste-Web MySQLDataModel recommender example needed!
Posted by Sean Owen <sr...@gmail.com>.
You do not need to use the Connector/J classes directly, and shouldn't.
Yes, you need a DataSource. If you're inside a web container, then you
can and should already have configured the database connection in the
container's configuration file. It makes the DataSource available for
lookup via JNDI.
At no point do you need to know that the DataSource is actually a
MysqlDataSource in your code, no.
I think you need to read that Tomcat page and understand how J2EE
containers deal with DataSources via JNDI. It will be clearer. This is
not specific to Mahout.
2011/2/16 Daniel Mühlbachler <da...@muehlbachler.org>:
> yeah, that's what I meant. My problem is that I am importing the MySQL
> Connector/J directly in my source file.
> So all my source files are not allowed to use such a class? But the
> MySQLJDBCDataModel has a constructor like ...(DataSource ds, ...) and
> DataSource is provided by the MySQL Connector/J but how can I give my
> constructor a dataSource if I can't use the classes I need - deps that
> shouldn't be there?
>
> Moreover, if I can configure the jetty server that it can handle MySQL
> connections it's also ok but how can I compile a java source file that needs
> a dataSource which is declared in a class I can't use directly? (something
> paradox...)
>
>
> Am 16.02.2011 16:13, schrieb Sean Owen:
>>
>> No. As I've said, you never import the driver / connector classes
>> directly. You have a complete working example: Mahout. As you can see
>> it doesn't depend on this.
>>
>> As I've also said, please read the documentation for Tomcat (or your
>> container). Here you go:
>>
>> http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html#JDBC_Data_Sources
>>
>> This is where MySQL Connector/J is involved.
>>
>> 2011/2/16 Daniel Mühlbachler<da...@muehlbachler.org>:
>>>
>>> ok, thanks for your detailed answer - now I understand! :)
>>>
>>> So my problem is that I must import the MySQL Connector/J into my source
>>> files because I need them. The nasty thing about that is that I just need
>>> "import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;" in my dataSource
>>> but
>>> that won't work because there shouldn't be any dependencies on that
>>> because
>>> I must configure the web application to use/provide the connector.
>>> omg... Is there any example round here that shows such a configuration?
>>>
>
Re: Taste-Web MySQLDataModel recommender example needed!
Posted by Daniel Mühlbachler <da...@muehlbachler.org>.
yeah, that's what I meant. My problem is that I am importing the MySQL
Connector/J directly in my source file.
So all my source files are not allowed to use such a class? But the
MySQLJDBCDataModel has a constructor like ...(DataSource ds, ...) and
DataSource is provided by the MySQL Connector/J but how can I give my
constructor a dataSource if I can't use the classes I need - deps that
shouldn't be there?
Moreover, if I can configure the jetty server that it can handle MySQL
connections it's also ok but how can I compile a java source file that
needs a dataSource which is declared in a class I can't use directly?
(something paradox...)
Am 16.02.2011 16:13, schrieb Sean Owen:
> No. As I've said, you never import the driver / connector classes
> directly. You have a complete working example: Mahout. As you can see
> it doesn't depend on this.
>
> As I've also said, please read the documentation for Tomcat (or your
> container). Here you go:
> http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html#JDBC_Data_Sources
>
> This is where MySQL Connector/J is involved.
>
> 2011/2/16 Daniel Mühlbachler<da...@muehlbachler.org>:
>> ok, thanks for your detailed answer - now I understand! :)
>>
>> So my problem is that I must import the MySQL Connector/J into my source
>> files because I need them. The nasty thing about that is that I just need
>> "import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;" in my dataSource but
>> that won't work because there shouldn't be any dependencies on that because
>> I must configure the web application to use/provide the connector.
>> omg... Is there any example round here that shows such a configuration?
>>
Re: Taste-Web MySQLDataModel recommender example needed!
Posted by Sean Owen <sr...@gmail.com>.
No. As I've said, you never import the driver / connector classes
directly. You have a complete working example: Mahout. As you can see
it doesn't depend on this.
As I've also said, please read the documentation for Tomcat (or your
container). Here you go:
http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html#JDBC_Data_Sources
This is where MySQL Connector/J is involved.
2011/2/16 Daniel Mühlbachler <da...@muehlbachler.org>:
> ok, thanks for your detailed answer - now I understand! :)
>
> So my problem is that I must import the MySQL Connector/J into my source
> files because I need them. The nasty thing about that is that I just need
> "import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;" in my dataSource but
> that won't work because there shouldn't be any dependencies on that because
> I must configure the web application to use/provide the connector.
> omg... Is there any example round here that shows such a configuration?
>
Re: Taste-Web MySQLDataModel recommender example needed!
Posted by Daniel Mühlbachler <da...@muehlbachler.org>.
ok, thanks for your detailed answer - now I understand! :)
So my problem is that I must import the MySQL Connector/J into my source
files because I need them. The nasty thing about that is that I just
need "import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;" in my
dataSource but that won't work because there shouldn't be any
dependencies on that because I must configure the web application to
use/provide the connector.
omg... Is there any example round here that shows such a configuration?
Am 16.02.2011 16:02, schrieb Sean Owen:
> 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<da...@muehlbachler.org>:
>> 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<da...@muehlbachler.org>:
>>>> 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 :) )?
>>>>
Re: Taste-Web MySQLDataModel recommender example needed!
Posted by Sean Owen <sr...@gmail.com>.
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 <da...@muehlbachler.org>:
> 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<da...@muehlbachler.org>:
>>>
>>> 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 :) )?
>>>
>
Re: Taste-Web MySQLDataModel recommender example needed!
Posted by Daniel Mühlbachler <da...@muehlbachler.org>.
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<da...@muehlbachler.org>:
>> 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 :) )?
>>
Re: Taste-Web MySQLDataModel recommender example needed!
Posted by Sean Owen <sr...@gmail.com>.
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 <da...@muehlbachler.org>:
> 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 :) )?
>
Re: Taste-Web MySQLDataModel recommender example needed!
Posted by Daniel Mühlbachler <da...@muehlbachler.org>.
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 :) )?
Am 16.02.2011 15:02, schrieb Sean Owen:
> This pretty much says it all:
>
> https://cwiki.apache.org/MAHOUT/recommender-documentation.html
>
> To be clear: you have to use MySQL Connector/J. It's just used in your
> container (Tomcat), not at compile-time in your web app.
>
> 2011/2/16 Daniel Mühlbachler<da...@muehlbachler.org>:
>> Ok, thanks and what should I do to get a taste-web recommender with
>> MySQLDataModel running?
>> The purpose of this recommender is that I can connect to them via SOAP web
>> service with my web application. Moreover, I am using the same table used
>> for this recommender for my own purposes too. So there is a need for me to
>> get such a recommender working properly.
>> However, it's not really necessary to use the MySQL Connector as a
>> dataSource for my MySQLDataModel if there is an easier possibility.
>>
Re: Taste-Web MySQLDataModel recommender example needed!
Posted by Sean Owen <sr...@gmail.com>.
This pretty much says it all:
https://cwiki.apache.org/MAHOUT/recommender-documentation.html
To be clear: you have to use MySQL Connector/J. It's just used in your
container (Tomcat), not at compile-time in your web app.
2011/2/16 Daniel Mühlbachler <da...@muehlbachler.org>:
> Ok, thanks and what should I do to get a taste-web recommender with
> MySQLDataModel running?
> The purpose of this recommender is that I can connect to them via SOAP web
> service with my web application. Moreover, I am using the same table used
> for this recommender for my own purposes too. So there is a need for me to
> get such a recommender working properly.
> However, it's not really necessary to use the MySQL Connector as a
> dataSource for my MySQLDataModel if there is an easier possibility.
>
Re: Taste-Web MySQLDataModel recommender example needed!
Posted by Daniel Mühlbachler <da...@muehlbachler.org>.
Ok, thanks and what should I do to get a taste-web recommender with
MySQLDataModel running?
The purpose of this recommender is that I can connect to them via SOAP
web service with my web application. Moreover, I am using the same table
used for this recommender for my own purposes too. So there is a need
for me to get such a recommender working properly.
However, it's not really necessary to use the MySQL Connector as a
dataSource for my MySQLDataModel if there is an easier possibility.
Am 16.02.2011 14:42, schrieb Sean Owen:
> There is no compile-time dependency in Apache Mahout on MySQL
> Connector/J. If you use the driver classes directly in your project,
> you need to add a dependency on those libraries. That's more an issue
> for your project. You can and should avoid compiling against those
> drivers directly as you usually don't need to. In an enterprise (Java)
> app, the container manages the drivers themselves and the calling code
> (Mahout) operates in terms of a generic DataSource it looks up from
> JNDI. It doesn't need to depend on the driver directly.
>
> 2011/2/16 Daniel Mühlbachler<da...@muehlbachler.org>:
>> Hello,
>>
>> has anyone configured a taste-web recommender with a MySQLDataModel? I
>> tried to implement a dataSource based on mysql-connector (provided by
>> MySQL) but that doesn't work because if I try "mvn compile" errors occur
>> with the mysql connector class.
>> What I need is just an example of a working recommender based on
>> taste-web and a MySQLDataModel. (I am working about 2 weeks to get
>> something run as it should!)
>>
>> Thanks in advance!
>> Best regards,
>> Daniel Mühlbachler
>>
>>
Re: Taste-Web MySQLDataModel recommender example needed!
Posted by Sean Owen <sr...@gmail.com>.
There is no compile-time dependency in Apache Mahout on MySQL
Connector/J. If you use the driver classes directly in your project,
you need to add a dependency on those libraries. That's more an issue
for your project. You can and should avoid compiling against those
drivers directly as you usually don't need to. In an enterprise (Java)
app, the container manages the drivers themselves and the calling code
(Mahout) operates in terms of a generic DataSource it looks up from
JNDI. It doesn't need to depend on the driver directly.
2011/2/16 Daniel Mühlbachler <da...@muehlbachler.org>:
> Hello,
>
> has anyone configured a taste-web recommender with a MySQLDataModel? I
> tried to implement a dataSource based on mysql-connector (provided by
> MySQL) but that doesn't work because if I try "mvn compile" errors occur
> with the mysql connector class.
> What I need is just an example of a working recommender based on
> taste-web and a MySQLDataModel. (I am working about 2 weeks to get
> something run as it should!)
>
> Thanks in advance!
> Best regards,
> Daniel Mühlbachler
>
>