ODE15 problem in java web deployment

1 view (last 30 days)
I am producing a java web with a library compiled from Matlab Builder JA containing ODE15s. I have no problem running it in MATLAB. But when I try to run the project on server, there is an error as follows:
com.mathworks.toolbox.javabuilder.MWException: PK_MODEL_V1 returns a vector of length 4, but the length of initial conditions vector is 7. The vector returned by PK_MODEL_V1 and the initial conditions vector must have the same number of elements.
Can someone please help on how to solve this? Here is the files containing my project should you need to refer the problems of my project in detail. Really appreciate your help. Thanks.

Accepted Answer

Titus Edelhofer
Titus Edelhofer on 6 Jul 2014
Hi Zetty,
a trick that often helps debugging such issues is to save the input data of your deployed function into a .mat file, run the deployed component, load the .mat and debug in MATLAB. Something like
function mylibrary(someInput, anotherInput)
if isdeployed
save c:\temp\inputdata.mat
end
When you run you component, debug:
debug stop if error
load c:\temp\inputdata.mat
mylibrary(someInput, anotherInput);
You might see that the input data are not exactly as you expected them to be.
Titus
  3 Comments
Titus Edelhofer
Titus Edelhofer on 7 Jul 2014
Hi Zetty,
when you compile your code with the Builder JA, you specify the function that becomes the method in your java class. Copy the lines 2-4 from above (the "if") at the beginning of your existing .m file. The second code you execute in MATLAB after running the java code (replacing the call to "mylibrary" and the input variables by your existing code (with it's own variables).
Hope this helps,
Titus

Sign in to comment.

More Answers (1)

Image Analyst
Image Analyst on 6 Jul 2014
Could it be a permission thing, like you tried to write something out the server and it didn't let you. Do you write anything out to a file? If so, where?
  1 Comment
Zetty  Zakaria
Zetty Zakaria on 6 Jul 2014
Edited: Zetty Zakaria on 6 Jul 2014
Hi Image Analyst. I don't write anything out the server. I just make a simple html web page, with 2 variables. Time (integer) and Dose (string array for the ode function). These inputs will then be used to form a graph using matlab library, which will be displayed under jsp file. I attach all the related files Here should you need more details. Thanks in advance!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!