Deployment troubleshooting » History » Version 10

Chris Cannam, 2014-03-13 09:22 AM

1 1 Chris Cannam
h1. Deployment troubleshooting
2 1 Chris Cannam
3 3 Chris Cannam
h4. What versions of Java and Tomcat do I need?
4 3 Chris Cannam
5 10 Chris Cannam
The current MATLAB Compiler Runtime needs Java 7. The MCR version needs to match the MATLAB version used to compile the MATLAB code, so this ultimately depends on what version of MATLAB you have a licence for. We have MATLAB R2013b and that's what these instructions are based on.
6 6 Chris Cannam
7 7 Chris Cannam
We also used Tomcat 7 in our testing. You'll need to make sure that Tomcat is using Java 7 if there is more than one version installed -- e.g. on Ubuntu that means editing JAVA_HOME in /etc/default/tomcat7.
8 3 Chris Cannam
9 1 Chris Cannam
h4. Can't find servlet-api.jar
10 1 Chris Cannam
11 1 Chris Cannam
This should appear in a Tomcat installation directory -- you need to make sure you build the webapp against the same version of the servlet API as you will be deploying it against (i.e the same Tomcat installation).
12 1 Chris Cannam
13 2 Chris Cannam
Sometimes this file is installed with a different name, e.g. on Ubuntu you may find it in /usr/share/java/tomcat-servlet-api-3.0.jar. You should rename it when you copy it.
14 3 Chris Cannam
15 3 Chris Cannam
h4. Tomcat manager URL asks for username and password, but I don't know what they are
16 3 Chris Cannam
17 3 Chris Cannam
The default roles are set up in a Tomcat config file, something like /etc/tomcat7/tomcat-users.xml. If no user is defined with the manager-gui role, you will need to add one, e.g. by adding to the middle of the file:
18 3 Chris Cannam
19 3 Chris Cannam
<pre>
20 4 Chris Cannam
 <role rolename="manager-gui"/>
21 4 Chris Cannam
 <role rolename="manager-script"/>
22 4 Chris Cannam
 <user username="admin" password="admin" roles="manager-gui,manager-script"/>
23 3 Chris Cannam
</pre>
24 3 Chris Cannam
25 3 Chris Cannam
But note that you should give the role a sensible password, not just admin.
26 5 Chris Cannam
27 5 Chris Cannam
h4. Tomcat manager refuses to start application
28 5 Chris Cannam
29 5 Chris Cannam
Showing a message such as
30 5 Chris Cannam
31 5 Chris Cannam
<pre>
32 5 Chris Cannam
FAIL - Application at context path /echoapp could not be started
33 5 Chris Cannam
</pre>
34 5 Chris Cannam
35 5 Chris Cannam
with very little extra information. Try searching the Tomcat log (catalina.out) for the text "Unsupported major.minor version" -- if you see this, then that means your application was compiled with a newer version of Java than the one Tomcat is using. Best to make sure you have only one version of Java (6 or 7) installed.
36 8 Chris Cannam
37 8 Chris Cannam
h4. Could not initialize class com.mathworks.toolbox.javabuilder.internal.MWMCR
38 8 Chris Cannam
39 8 Chris Cannam
This message in the Tomcat logs probably means that the LD_LIBRARY_PATH variable hasn't been set correctly. You need to copy the LD_LIBRARY_PATH as shown at the end of the MCR installation process into the Tomcat initialisation scripts.
40 8 Chris Cannam
41 8 Chris Cannam
On Linux this usually means you will have a file called setenv.sh in the same directory as the Tomcat startup.sh, catalina.sh and so on, and it will contain
42 8 Chris Cannam
43 9 Chris Cannam
<pre>
44 8 Chris Cannam
export LD_LIBRARY_PATH=<the full path as indicated by the MCR installer>
45 8 Chris Cannam
</pre>
46 8 Chris Cannam
47 8 Chris Cannam
h4. Could not access the MCR component cache
48 8 Chris Cannam
49 8 Chris Cannam
This error in the Tomcat logs means that the MATLAB compiler runtime is trying to write to a cache directory it doesn't have access to. This may mean that the MCR was installed for use by a different user from the Tomcat one rather than in a global installation.
50 8 Chris Cannam
51 8 Chris Cannam
To fix this, you can set a dedicated cache directory: add a line to the Tomcat setenv.sh script saying something like
52 8 Chris Cannam
53 8 Chris Cannam
<pre>
54 8 Chris Cannam
export MCR_CACHE_ROOT=/tmp/mcr-cache
55 8 Chris Cannam
</pre>
56 8 Chris Cannam
57 8 Chris Cannam
Make sure the path you specify exists and is writable by the Tomcat user.