Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Error executing a web application with jar compiled by MATLAB in Tomcat

22 views
Skip to first unread message

cristina

unread,
Sep 4, 2009, 4:49:01 AM9/4/09
to
Dear All,
My problem is a bit fuzzy and I'll try to explain in order to achieve a solution...
I'm sufficiently close to desperation and I hope you can help me...

My target is translate a MATLAB .m application to a java class in order to be bale to include it in a web application. My OS is Linux Debian 5.0.
The MATLAB application simply calculate the triple of a number (triple.m) and i want to create a web page were to enter a number (in a html form) and obtain its triple. After having create the MATLAB application I compiled it with Builder JA toolbox in MATLAB using deploytool, and I obtained a .jar file. Later I installed the MCR package in the server and I transferred there the .jar file, bundling it in a web application. The final target of my here, I modified the environment variables, such as the MATLAB help suggests (LD_Library_path, etc.). The web application is developed in Eclipse and the server (a TOMCAT 5.5 server) is used. When I executed the web app by Eclipse it works properly, but I also need a independent-by-Eclipse framework, such that I loaded the web application (with the .jar included) in the TOMCAT web-apps directory and I run it directly by executing the server in
the shell (not using Eclipse) . When executed by this way I obtain the following error:

java.lang.NullPointerException
com.mathworks.toolbox.javabuilder.MWMCR.restoreLookAndFeel(MWMCR.java:146) com.mathworks.toolbox.javabuilder.MWMCR.mclInitializeComponentInstance(MWMCR.java:179) com.mathworks.toolbox.javabuilder.MWMCR.access$700(MWMCR.java:24) com.mathworks.toolbox.javabuilder.MWMCR$5.mclInitializeComponentInstance(MWMCR.java:893)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:616)
com.mathworks.toolbox.javabuilder.MWMCR$4.invoke(MWMCR.java:787)
$Proxy0.mclInitializeComponentInstance(Unknown Source)
com.mathworks.toolbox.javabuilder.MWMCR.newInstance(MWMCR.java:696)
Triple_java.Triple_javaMCRFactory.newInstance(Triple_javaMCRFactory.java:135)
Triple_java.Triple_javaMCRFactory.newInstance(Triple_javaMCRFactory.java:139)
Triple_java.Triple_javaclass.<init>(Triple_javaclass.java:41)
ServletTriple.doPost(ServletTriple.java:78)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

Hoping to solve my problem...Thanks!

Ed Yu

unread,
Jan 2, 2010, 9:12:05 PM1/2/10
to
Cristina,

It looks like it has something to do with the X windows environment. Depending on the version of MATLAB, you may be able to specify the headless JVM option when starting MATLAB (which starts java).

Ed.

0 new messages