Problem when using webservice to call some java application method using resource file
I created one java application that contains the following directory structure in my src java folder ..
Src/ Transcriber.java config.xml digits.gram transcriber.manifest
I successfully created a web service for this java application with a .aar file and placed it in the axis2 service folder
I pack it all into a Transcriber.aar file with the following structure
Transcriber\edu\cmu\sphinx\demo\transcriber
and that all 4 files are higher than I listed.
I have two methods in the Transcriber.java class. The first method is simply processing without any other use of the file (e.g. config.xml, digits.gram and transcriber.manifest). and its performance, and I can easily call this method on android.
but my second method also uses other files (e.g. config.xml, digits.gram and transcriber.manifest) to process some logic that I want.
But some, how do I get an error when I call the second method, and it gives me an error while I call this second method from the Android device.
My error is as follows:
at java.lang.Thread.run(Thread.java:662) Caused by: Property exception component:'jsgfGrammar' property:'grammarLocation' - Can't locate resource:/edu/cmu/sphinx/demo/transcriber edu.cmu.sphinx.util.props.InternalConfigurationException: Can't locate resource: /edu/cmu/sphinx/demo/transcriber
this gives me an error that some of them cannot find the digits.gram grammar file, which I use to add through the config.xml file with this code in the config.xml file
<component name="jsgfGrammar" type="edu.cmu.sphinx.jsgf.JSGFGrammar"> <property name="dictionary" value="dictionary"/> <property name="grammarLocation" value="resource:/edu/cmu/sphinx/demo/transcriber"/> <property name="grammarName" value="digits"/> <property name="logMath" value="logMath"/> </component>
Why do I have such an error? enter code here
My code where I first got CONFIG.XML AND THEN CONFIG.XML WILL RECEIVE ANOTHER RESOURCE FILE .... config.xml successfully finds it, but then the code in config.xml cannot find another resource file
package edu.cmu.sphinx.demo.transcriber; import edu.cmu.sphinx.frontend.util.AudioFileDataSource; import edu.cmu.sphinx.recognizer.Recognizer; import edu.cmu.sphinx.result.Result; import edu.cmu.sphinx.util.props.ConfigurationManager; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; public class TranscribeSimpleGrammar { private static final String PATH = "file:///D:\\Sound\\"; @SuppressWarnings({ "null", "null" }) public String recognize_wave(String wavePath) throws MalformedURLException{ URL audioURL;