Re: Problems with setting up css-validator

> Miklos Vajna a écrit :
> > Now that one seems to be in the velocity code.
> >
> > Any suggestion? :)
>
> Hi Miklos,
>
> I've made some changes in the codebase and in build.xml. Can you update
> and try again?
>
> [[
>  > ant jar
>  > java -jar css-validator.jar http://www.w3.org
> {output=text, medium=all, warning=2, profile=css21, lang=en}
> W3C CSS Validator results for http://www.w3.org
>
>      Congratulations! No Error Found.
> [...]
> ]]
>
> Jean-Gui

I've been trying to get the css-validator.jar to work on Mac OS X
10.5.6.  I was completely unable to get it to work early yesterday,
for the same reasons explained by Miklos, but the updates to CVS today
have allowed me to compile and run the command line version of
css-validator.jar from the Tomcat/webapps/css-validator directory.

However, I'm unable to get the css-validator.jar to work with Tomcat,
since once I move it from "[VALIDATOR_DIR]/css-validator.jar" to
"[VALIDATOR_DIR]/WEB-INF/lib/" as explained in the instructions at
<http://jigsaw.w3.org/css-validator/DOWNLOAD.html>, it will no longer
run, and produces the following error from the command line:

"Exception in thread "main" java.lang.NoClassDefFoundError:
org/w3c/tools/resources/ProtocolException"

So I edit build.xml and remove the "lib/" prefix from the Class-Path
key in the <manifest> section:

                        <manifest>
        <attribute name="Main-Class"
value="org.w3c.css.css.CssValidator"/>
        <attribute name="Class-path"
value="commons-collections-3.2.1.jar commons-lang-2.4.jar jigsaw.jar
tagsoup-1.2.jar velocity-1.6.1.jar xercesImpl.jar \
xml-apis.jar"/>
                        </manifest>

I rebuild and try running it again, but receive an error:

$ java -jar css-validator.jar http://www.w3c.org
{output=text, medium=all, warning=2, profile=css21, lang=en}
Jan 21, 2009 3:05:18 AM org.apache.velocity.runtime.log.JdkLogChute log
SEVERE: ResourceManager : unable to find resource
'org/w3c/css/css/text.properties' in any resource loader.
Unable to find resource 'org/w3c/css/css/text.properties'
org.apache.velocity.exception.ResourceNotFoundException: Unable to
find resource 'org/w3c/css/css/text.properties'
	at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:483)

So it's unable to locate the text.properties resource, but when I
inspect the css-validator.jar file, it seems to be available:

$ jar tf css-validator.jar | grep -i "text.properties"
org/w3c/css/css/text.properties

I then try copying the entire "org" directory from the
"/usr/local/Tomcat/Home/webapps/css-validator/org" path and running it
again:

$ pwd
/usr/local/Tomcat/Home/webapps/css-validator/WEB-INF/lib
$ cp -R ../../org ./
$ java -jar css-validator.jar http://www.w3c.org

{output=text, medium=all, warning=2, profile=css21, lang=en}
W3C CSS Validator results for http://www.w3c.org

    Congratulations! No Error Found.

This document validates as CSS level 2.1 !

-----------------------------------------------------------------

So now it works, but why must I copy the "org" directory to the
WEB-INF/lib path? Why can't css-validator.jar use its internal version
of the text.properties file?

Also, regardless of what I do, I can't get it to work under Tomcat. I
receive the following error:

 [error] ResourceManager : unable to find resource 'validator.vm' in
any resource loader.
org.apache.velocity.exception.ResourceNotFoundException: Unable to
find resource 'validator.vm'
	at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:483)
	at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:354)
	at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance..java:1400)
	at org.apache.velocity.runtime.RuntimeSingleton.getTemplate(RuntimeSingleton.java:326)
	at org.apache.velocity.app.Velocity.getTemplate(Velocity.java:404)
	at org.w3c.css.index.IndexGenerator.generatesIndex(IndexGenerator.java:102)
	at org.w3c.css.servlet.CssValidator$1.run(CssValidator.java:139)
 [error] ResourceManager : unable to find resource
'org/w3c/css/css/xhtml.properties' in any resource loader.
Unable to find resource 'org/w3c/css/css/xhtml.properties'
org.apache.velocity.exception.ResourceNotFoundException: Unable to
find resource 'org/w3c/css/css/xhtml.properties'
	at org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:483)

So can anyone give me some suggestions of:

1) how to get css-validator.jar to work from the command line without
copying over the "org" directory to it's current working directory
2) how to get css-validator.jar running under Tomcat

Thanks for any help!

Mike

Received on Wednesday, 21 January 2009 08:21:46 UTC