Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to setup W3C Unicorn validator for local URIs?
    text
    copied!<p>I frequently need to check not-yet-public websites so cannot use a public online validator. I tried to install W3C’s <a href="http://code.w3.org/unicorn" rel="nofollow">Unicorn</a> on my OSX (10.7) machine using MacPorts (because I didn’t want to cope with dependencies). Unfortunately the docs for Unicorn installation are mostly missing or outdated, and the mailing list looks dead. Disclaimer: I don’t know Java.</p> <p>Here’s what I did:</p> <ul> <li>install Java update to 1.6.0_29 (since Apple’s current one has a memory leak)</li> <li><p>install Tomcat and dependencies (ivy is missing in docs and doesn’t get downloaded automatically as it is supposed to):</p> <pre><code>sudo port install apache-ant apache-ivy tomcat6 mercurial </code></pre></li> <li><p>select Python version for Mercurial; perhaps better use python.org-Python and install Mercurial there, but I’ve only system and MacPort’s Python on this machine:</p> <pre><code>sudo port select python python27 </code></pre></li> <li><p>automatically start Tomcat after reboot:</p> <pre><code>sudo launchctl load -w /Library/LaunchDaemons/org.macports.tomcat6.plist </code></pre></li> <li><p>add setup to <code>.profile</code>:</p> <pre><code>export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK export CATALINA_HOME=/opt/local/share/java/tomcat6 </code></pre></li> <li><p>check output of <code>java -version</code> (my Java version in "A" or "Current" was broken; <code>java -version</code> just hang)</p></li> <li><p>fix Java binary path; if there's no <code>$JAVA_HOME/bin</code>:</p> <pre><code>cd $JAVA_HOME; sudo ln -s Commands bin </code></pre></li> <li><p>restart</p></li> <li><p>check if tomcat runs on <code>http://localhost:8080</code> (ok)</p></li> <li><p>get and compile unicorn:</p> <pre><code>cd ~/workspace hg clone https://dvcs.w3.org/hg/unicorn cd unicorn ant retrieve compress-css compress-js war cli </code></pre></li> <li><p>install unicorn in tomcat:</p> <pre><code>sudo cp dist/unicorn.war $CATALINA_HOME/webapps/ sudo cp WebContent/resources/tomcat_policy/* $CATALINA_HOME/conf/ </code></pre></li> <li><p><em>yes it works</em>, but only for public addresses; we need to change</p> <ul> <li>one setting in <code>unicorn.properties</code>: <code>ACCEPT_LOCAL_ADDRESSES = true</code></li> <li>validator paths in <code>observers.properties</code> from <code>http://validator.w3.org/.../*.wadl</code> to <code>file:///.../*.wadl</code></li> </ul></li> <li><p>I can change <code>*.properties</code> in <code>$CATALINA_HOME/webapps/unicorn/WEB-INF/classes</code> or (better) in <code>~/workspace/unicorn/WebContent/WEB_INF/conf</code>. But changes to the latter never make it into the <code>.war</code>, don’t know why. (Maybe they’re pacifist?) If <code>*.properties.default</code> are renamed to <code>*.properties</code>, they’re missing in the distribution, if I don’t rename them, changes are ignored. I found a hint to include that conf-path in <code>$CLASSPATH</code>, but that didn’t help either.</p></li> <li><p>So I copy the adapted configs into the installed webapp, and Unicorn seems to run - but validation results in a white page (status code = 200, but content length = 0).</p></li> <li><p>In tomcat’s error log I find only (don’t know if that’s important):</p> <pre><code>INFO: validateJarFile(/opt/local/share/java/tomcat6/webapps/unicorn/WEB-INF/lib/servlet-api-2.5.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class </code></pre></li> </ul> <h2>CLI</h2> <p>Inbetween I tried if the command line interface is usable. <code>java -jar unicorn.jar</code> shows some usage hints, but validation of anything fails with</p> <pre><code>Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 at org.w3c.unicorn.UnicornClient.main(UnicornClient.java:113) </code></pre> <h2>Finally</h2> <p>What can I do?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload