If you installed MATLAB 2006b on OS X and encountered this error when Matlab starts up:
java.lang.IllegalArgumentException: http://java.sun.com/xml/jaxp/properties/schemaSource at org.apache.xerces.jaxp.DocumentBuilderFactoryImpl.setAttribute(DocumentBuilderFactoryImpl.java:118) at com.mathworks.xml.XMLValidator.validateFile(XMLValidator.java:54) at com.mathworks.mlwidgets.util.productinfo.Product.getItems(Product.java:310) at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.pathChanged(ProductInfoUtils.java:160) at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.<init>(ProductInfoUtils.java:67) at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.getAllProductsInfo(ProductInfoUtils.java:910) at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.<clinit>(ProductInfoUtils.java:53) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:164) at com.mathworks.mde.desk.StartupClassLoader.callClassForName(StartupClassLoader.java:304) at com.mathworks.mde.desk.StartupClassLoader.access$000(StartupClassLoader.java:27) at com.mathworks.mde.desk.StartupClassLoader$LoadInfo.<init>(StartupClassLoader.java:80) at com.mathworks.mde.desk.StartupClassLoader.addLoadInfo(StartupClassLoader.java:219) at com.mathworks.mde.desk.StartupClassLoader.createLoadInfos(StartupClassLoader.java:195) at com.mathworks.mde.desk.StartupClassLoader.access$500(StartupClassLoader.java:27) at com.mathworks.mde.desk.StartupClassLoader$2.run(StartupClassLoader.java:147) at java.util.TimerThread.mainLoop(Timer.java:512) at java.util.TimerThread.run(Timer.java:462) Exception in thread "Timer-2" java.lang.ExceptionInInitializerError at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:164) at com.mathworks.mde.desk.StartupClassLoader.callClassForName(StartupClassLoader.java:304) at com.mathworks.mde.desk.StartupClassLoader.access$000(StartupClassLoader.java:27) at com.mathworks.mde.desk.StartupClassLoader$LoadInfo.<init>(StartupClassLoader.java:80) at com.mathworks.mde.desk.StartupClassLoader.addLoadInfo(StartupClassLoader.java:219) at com.mathworks.mde.desk.StartupClassLoader.createLoadInfos(StartupClassLoader.java:195) at com.mathworks.mde.desk.StartupClassLoader.access$500(StartupClassLoader.java:27) at com.mathworks.mde.desk.StartupClassLoader$2.run(StartupClassLoader.java:147) at java.util.TimerThread.mainLoop(Timer.java:512) at java.util.TimerThread.run(Timer.java:462) Caused by: java.lang.NullPointerException at com.mathworks.mlwidgets.util.productinfo.Product.getItems(Product.java:317) at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.pathChanged(ProductInfoUtils.java:160) at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.<init>(ProductInfoUtils.java:67) at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.getAllProductsInfo(ProductInfoUtils.java:910) at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.<clinit>(ProductInfoUtils.java:53) ... 11 more
or something similar, you may have hit one of the mysterious gotchas of Mac OS X 10.4. In /Library/Java/Extensions (or another one of these system Java directories), you have a conflicting copy of xerces.jar, probably from another software package that rudely installed these extensions without informing you of it. Due to the way Java classpaths are being resolved, apparently the copy in Extensions overrides the copy in Matlab’s directory.
The symptoms of this: among other things, Matlab will throw these exceptions at startup; you can’t open certain panels or windows via the menu bar; you also cannot select certain panels in the Preferences window. Whenever you perform one of these operations, you’ll receive a NoClassDefFoundError on one of the Matlab widget classes, even though it already exists in the Matlab directory.
This is a rather classic gotcha, but a lot of people wouldn’t even realize /Library/Java/Extensions actually exists. If you went off chasing the red herring of the NoClassDefFound exception, or went tracing StartupClassLoader.java, you’d never realize the core cause of the issue.
/Library is sometimes an incomprehensible morass of things that cause mysterious failures in other applications (InputManagers, anyone?) and end up exceedingly difficult to trace.
Many thanks for this – I would likely have never figured it out on my own.
It still took a little figuring out to get to work, though. Turns out I had a xercesImpl.jar in both /Library/Java/Extensions and my matlab/java/jarext folders, but no xerces.jar in my matlab folder. It took a bit of playing around with the various permutations of having these files exist under their correct names (and rebooting) to get those error messages to disappear and online help to work again.
Thanks again.
Many thanks, too!
The interfering .jar files might also be located in the user’s Library/Java/Extensions/ directory (i.e. /Users/…./Library/Java/Extensions/), so you should look there as well, in particular if the Matlab error doesn’t show up for all users.
Can someone let me know exact steps to resolve this error? Do you trash/rename the offending file(s)? I am not a Java expert so any help is greatly appreciated.
Thank you.
Wow. I actually have readers. I just noticed this.
To the anonymous, sorry for not noticing your question earlier 🙂 As far as what to do, yes, once you find offending JAR files, try removing them (first all at once, then putting them back one at a time until the problem comes back again. Then you’ve identified the problematic JAR).
You can go ahead and remove those offending jars from the directory to resolve your MATLAB problem. However, be sure that you keep a copy around, just in case whatever installed it in the first place decides that it really wants that one back.