PredictionIO 0.12.1构建报错:未找到引擎,请求技术解决方案
Hey, let's work through this "No engine found" error you're facing with PredictionIO 0.12.1 and the E-Commerce Recommendation template. Looking at your build log, even though the compilation succeeded, PIO can't locate the engine implementation—here are the most practical fixes to try out:
1. Verify the Engine Class path in engine.json
PredictionIO needs explicit directions to find your Engine class. Open the engine.json file in your MyECommerceRecommendation directory and make sure the engineFactory field points to the correct fully qualified class name. For this template, it should look like:
{ "id": "default", "description": "Default settings", "engineFactory": "org.template.ecommerce.RecommendationEngine" }
You can confirm the correct path by checking the src/main/scala directory—look for the package structure (e.g., org/template/ecommerce) and the RecommendationEngine.scala file inside it.
2. Fix build output settings in build.sbt
Sometimes sbt's default output doesn't align with what PIO expects. Open your build.sbt file and add these configurations to ensure the compiled jar ends up in the right place:
// Ensure the assembly jar excludes Scala libraries (matches PIO's expectations) assemblyOption in assembly := (assemblyOption in assembly).value.copy( includeScala = false ) // Explicitly set the main Engine class mainClass in assembly := Some("org.template.ecommerce.RecommendationEngine")
Also double-check that the name and version fields in build.sbt match the template's metadata—this ensures the generated jar file name is what PIO looks for.
3. Clean and rebuild from scratch
Cached build artifacts can sometimes cause weird issues. Wipe out old files and start fresh with these commands:
# Clean PIO's build cache pio clean # Delete the local target directory to remove all old compiled files rm -rf target/ # Rebuild with verbose logging to track progress pio build --verbose
This ensures you're starting with a clean slate, so no leftover files interfere with the new build.
4. Check directory permissions
If PredictionIO doesn't have read access to your build directory or the generated jar files, it won't be able to find the engine. Fix permissions with:
chmod -R 755 ~/fh_engines/MyECommerceRecommendation
This gives your user full access and read/execute permissions to others (safe for a local development setup).
5. Ensure the required PIO assembly jar is present
Your log mentions "Uber JAR disabled", which means PIO relies on the lib/pio-assembly-0.12.1.jar file in your template directory. If this file is missing, copy it from your PredictionIO installation folder:
cp /home/fh/PredictionIO-0.12.1/lib/pio-assembly-0.12.1.jar ~/fh_engines/MyECommerceRecommendation/lib/
Then re-run the build command.
If none of these steps work, check the target/scala-2.11 directory in your template folder—you should see a jar file named something like template-scala-parallel-ecommercerecommendation-assembly-0.1-SNAPSHOT.jar. If this file isn't there, it means sbt didn't generate the full engine jar (even though the log said "success"), so you may need to dig deeper into sbt's detailed logs for hidden errors.
内容的提问来源于stack exchange,提问作者Nimit

