1

I created a dummy Maven project that wraps CMU Sphinx4 in a servlet. The dependencies are sphinx4-core:1.0-SNAPSHOT and sphinx4-data:1.0-SNAPSHOT. When running locally (Eclipse) it works great, but then I deploy it to AWS Elastic Beanstalk and I get the following exception:

Property exception component:'null' property:'null' - java.io.FileNotFoundException: JAR entry edu/cmu/sphinx/models/en-us/en-us//means not found in /var/lib/tomcat8/webapps/ROOT/WEB-INF/lib/sphinx4-data-1.0-SNAPSHOT.jar 
edu.cmu.sphinx.util.props.PropertyException: java.io.FileNotFoundException: JAR entry edu/cmu/sphinx/models/en-us/en-us//means not found in /var/lib/tomcat8/webapps/ROOT/WEB-INF/lib/sphinx4-data-1.0-SNAPSHOT.jar

Caused by: java.io.FileNotFoundException: JAR entry edu/cmu/sphinx/models/en-us/en-us//means not found in /var/lib/tomcat8/webapps/ROOT/WEB-INF/lib/sphinx4-data-1.0-SNAPSHOT.jar

I suspect it's that double slash in there but I cannot explain why it doesn't happen on my dev machine (OSX).

thanks!

Edit:

My dev machine: OSX running Eclipse Luna with AWS plugin. I am using a J2EE project with a single servlet, and getting Sphinx JARs (core & data) through Maven. When I run the server in my dev machine (port 8080) I feed it a WAV file through a POST message, the file gets loaded correctly and I get the analysis as a textual response.

My prod machine: AWS Elastic Beanstalk. I deploy using AWS plugin. When I comment out the Sphinx part of the code, the server works (i.e. gets the file, and returns it to me, etc.)

If the problem is not the double slash, then the JARs are not being cooked right. This would make sense since the file it's looking for is not a class so the JAR cooking part of Maven should be told how to include resource files in the JAR it makes when it deploys.

Any idea how to do this ?

thanks again!

Dan
  • 1,163
  • 14
  • 34
  • When you say, "works locally" what do you mean? How did you run it locally? How did you deploy it to beanstalk? – Nick Humrich Jun 13 '15 at 02:45
  • The double slash most likely isn't the problem as anything POSIX treats two slashes as one. – Nick Humrich Jun 13 '15 at 02:46
  • FYI, Make sure when you package the application as a jar in Eclipse that you use the ***Copy Required Libraries into a sub-folder next to the egnerated jar*** option. Otherwise, you will get the resource cannot be found/File not found error. – Paul Nichols Jul 05 '17 at 15:10

2 Answers2

1

Double slash seems to be a problem on some JVMs, on other JVMs it works.

I've just committed an update to avoid double slashes. Please update sphinx4 and try again.

Nikolay Shmyrev
  • 24,897
  • 5
  • 43
  • 87
  • Thanks! My problem surfaced on Sphix3Loader; there was a concatenation of location + slash + path. Hope this helps. – Dan Jun 15 '15 at 07:22
0

Turns out the problem was I was developing (OSX) on Java 7 and deploying to AWS to Tomcat/Java 8. Once I deployed to Tomcat/Java 7, everything worked as expected.

Dan
  • 1,163
  • 14
  • 34