Deployed library: Undefined variable "classreg"

3 views (last 30 days)
I have a deployed MATLAB library in Java running on Red Hat linux, in tomcat. I make a prediction with SVM and I get the following error, but on windows it works fine:
Undefined variable "classreg" or class "classreg.learning.svmutils.predict".
Error in classreg.learning.impl.CompactSVMImpl/score (line 62)
Error in classreg.learning.classif.CompactClassificationSVM/score (line 337)
Error in classreg.learning.classif.ClassificationModel/predict (line 347)
Error in classreg.learning.classif.CompactClassificationSVM/predict (line 199)
Error in web_classifySound (line 13)
... Matlab M-code Stack Trace ...
file /home/user/.mcrCache8.5/emotio5/toolbox/stats/classreg/+classreg/+learning/+impl/CompactSVMImpl.m, name CompactSVMImpl.score, line 62.
file /home/user/.mcrCache8.5/emotio5/toolbox/stats/classreg/+classreg/+learning/+classif/CompactClassificationSVM.m, name CompactClassificationSVM.score, line 337.
file /home/user/.mcrCache8.5/emotio5/toolbox/stats/classreg/+classreg/+learning/+classif/ClassificationModel.m, name ClassificationModel.predict, line 347.
file /home/user/.mcrCache8.5/emotio5/toolbox/stats/classreg/+classreg/+learning/+classif/CompactClassificationSVM.m, name CompactClassificationSVM.predict, line 199.
file /home/user/.mcrCache8.5/emotio5/audio_analysis_library/emotionSoundClassificationLib/web_classifySound.m, name web_classifySound, line 13.
com.mathworks.toolbox.javabuilder.MWException: Undefined variable "classreg" or class "classreg.learning.svmutils.predict".
at com.mathworks.toolbox.javabuilder.internal.MWMCR.mclFeval(Native Method)
at com.mathworks.toolbox.javabuilder.internal.MWMCR.access$600(MWMCR.java:30)
at com.mathworks.toolbox.javabuilder.internal.MWMCR$6.mclFeval(MWMCR.java:856)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.mathworks.toolbox.javabuilder.internal.MWMCR$5.invoke(MWMCR.java:754)
at com.sun.proxy.$Proxy123.mclFeval(Unknown Source)
at com.mathworks.toolbox.javabuilder.internal.MWMCR.invoke(MWMCR.java:422)
at emotionSoundClassificationLib.emotionSoundClassification.web_classifySound(emotionSoundClassification.java:420)
at mictest.WebMicServlet.doPost(WebMicServlet.java:108)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Here is my MATLAB code:
%#function classreg.learning.svmutils.predict
[label,~] = predict(SVMModel,features);
I tried to use the
%#function classreg.learning.svmutils.predict
but without success.
How can I solve this problem?
  1 Comment
David Willingham
David Willingham on 8 Jun 2017
Edited: David Willingham on 8 Jun 2017
The function the error refers to is actually a c-mex file under the hood “predict.mexw64”, which is OS dependant. As such, it is one of the exception cases where it can’t be packaged on Windows, and deployed on Linux server.
The work arounds I can suggest are:
1. Compile and package on a Linux machine, if you want to deploy to the current Linux server.
2. Compile and package on a Windows machine, and deploy to a Windows based server.

Sign in to comment.

Answers (0)

Categories

Find more on Package MATLAB Functions in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!