Has anyone created a .bat file to run this on the recommendation server in windows? I have a server setup for doing this (been doing it on the old D6 version), but am not sure how to setup the .bat file to kickoff the java call.

Any help would be very appreciated.

Cheers!

Comments

angusmccloud’s picture

I am getting the following error when trying to run recommender on windows:

Exception in thread "main" java.lang.NoClassDefFoundError: org/drupal/project/async_command/AbstractDrupalApp
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.drupal.project.async_command.AbstractDrupalApp
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 12 more
Could not find the main class: org.drupal.project.recommender.RecommenderApp. Program will exit

I have confirmed that the classpath is correct and includes drupal-app.jar where AbstractDrupalApp is defined.
Any ideas?

danithaca’s picture

can you please post the CLASSPATH settings, or the .bat file?

angusmccloud’s picture

Posting this from the .bat file from my java guy...

@echo off
SET MAINPATH=c:\wamp\www\sites\all\modules
SET ASYNC_COMMAND_HOME=%MAINPATH%\async_command
SET RECOMMENDER_HOME=%MAINPATH%\recommender
SET MAHOUT_HOME=c:\wamp\www\mahout-distribution-0.5

REM NO EXISTING CLASSPATH DEFINED, ADDED MAHOUT, ASYNC, AND DRUPAL-APP DIRECTLY
SET CLASSPATH=%MAINPATH%\recommender;%ASYNC_COMMAND_HOME%;%ASYNC_COMMAND_HOME%\lib;%ASYNC_COMMAND_HOME%\lib\drupal-app.jar;%MAHOUT_HOME%;%MAHOUT_HOME%\lib
echo USING CLASSPATH: %CLASSPATH%
echo.
REM FOR GOOD MEASURE TRIED THE CLASSPATH PARAMETER AS WELL
java.exe -classpath %CLASSPATH% -jar %MAINPATH%\recommender\recommender.jar
REM %RECOMMENDER_HOME%\java -jar recommender.jar -c %MAINPATH%\async_command

YOU CAN POST THIS ERROR TOO:

C:\wamp\www\sites\all\modules\recommender>run
USING CLASSPATH: c:\wamp\www\sites\all\modules\recommender;c:\wamp\www\sites\all\modules\async_command;c:\wamp\www\sites\all\modules\async_command\lib;c:\wamp\www\sites\all\modules\async_command\lib\drupal-app.jar;c:\wamp\www\mahout-distribution-0.5;c:\wamp\www\mahout-distribution-0.5\lib

Exception in thread "main" java.lang.NoClassDefFoundError: org/drupal/project/async_command/AbstractDrupalApp
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.drupal.project.async_command.AbstractDrupalApp
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 12 more
Could not find the main class: org.drupal.project.recommender.RecommenderApp. Program will exit.

danithaca’s picture

Thanks Connor.

I have created "run.bat.example". You can find it in alpha4. But I haven't tested it.

The problem the code you posted is that CLASSPATH needs to be set to point to each *.jar file under a path. It cannot simply be the lib path. run.bat.example has some code to add all jar files to CLASSPATH.

Another simple approach to set CLASSPATH is just to copy MAHOUT_HOME and ASYNC_COMMAND_HOME\lib to JRE\lib\ext.

Let me know if the bat file works.

angusmccloud’s picture

Still the same issue with that run.bat. I reinstalled async and ctools just in case either was outdated (I see you updated async today) -- but same thing...

I'm gonna try it out on a mac and see if it works (not a long-term solution, but it'd get me something).

danithaca’s picture

Version: 7.x-3.0-alpha3 » 7.x-3.0-alpha9
Status: Active » Fixed

run.bat file is added for windows. You can simply run 'run.bat' under 'site/all/modules/recommender' to compute the recommendations. Note that you need to install java/php and put the executables under PATH. Also check out the "out-of-the-box installation" section in README.

This is fixed in recommender 7.x-3.0-alpha9 and async_command 7.x-1.0-alpha9.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.