How to configure W3C Unicorn validator for local URIs?

I often need to check unregistered websites, so you cannot use a publicly available online validator. I tried installing W3Cs Unicorn on my OSX computer (10.7) using MacPorts (because I did not want to deal with dependencies). Unfortunately, the documents for installing Unicorn are mostly missing or out of date, and the mailing list looks dead. Disclaimer: I do not know Java.

Here is what I did:

  • install the Java update to 1.6.0_29 (since poisons have a current memory leak current)
  • install Tomcat and dependencies (ivy is missing from the docs and does not load automatically as expected):

    sudo port install apache-ant apache-ivy tomcat6 mercurial 
  • select the Python version for Mercurial; it might be better to use python.org-Python and install Mercurial there, but Ive only got Python system and MacPorts on this computer:

     sudo port select python python27 
  • automatically starts Tomcat after reboot:

     sudo launchctl load -w /Library/LaunchDaemons/org.macports.tomcat6.plist 
  • add setting to .profile :

     export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK export CATALINA_HOME=/opt/local/share/java/tomcat6 
  • check java -version (my java -version version in "A" or "Current" was broken; java -version just hangs)

  • fix Java binary path; if not $JAVA_HOME/bin :

     cd $JAVA_HOME; sudo ln -s Commands bin 
  • reboot

  • check if tomcat is working on http://localhost:8080 (ok)

  • get and compile a unicorn:

     cd ~/workspace hg clone https://dvcs.w3.org/hg/unicorn cd unicorn ant retrieve compress-css compress-js war cli 
  • install unicorn in tomcat:

     sudo cp dist/unicorn.war $CATALINA_HOME/webapps/ sudo cp WebContent/resources/tomcat_policy/* $CATALINA_HOME/conf/ 
  • yes, it works, but only for public addresses; we need to change

    • one setting in unicorn.properties : ACCEPT_LOCAL_ADDRESSES = true
    • validation paths in observers.properties from http://validator.w3.org/.../*.wadl to file:///.../*.wadl
  • I can change *.properties in $CATALINA_HOME/webapps/unicorn/WEB-INF/classes or (better) in ~/workspace/unicorn/WebContent/WEB_INF/conf . But the changes of the latter never fall into .war , I do not know why. (Maybe they are pacifist?) If *.properties.default renamed to *.properties , they are not in the distribution, if I do not rename them, the changes are ignored. I found a hint to include this conf path in $CLASSPATH , but that didn't help either.

  • So, I copy the adapted configs to the installed webapp, and Unicorn seems to start, but the check is done on a white page (status code = 200, but content length = 0).

  • In the tomcats error log I find only (I don't know if this is important):

     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 

CLI

In between, I tried using the command line interface. java -jar unicorn.jar shows some usage hints, but checking for something fails with

 Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1 at org.w3c.unicorn.UnicornClient.main(UnicornClient.java:113) 

Finally

What can I do?

+4
source share

Source: https://habr.com/ru/post/1401386/


All Articles