• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Using css-validator.jar (provided by W3C) in my web application

 
Greenhorn
Posts: 3
MySQL Database Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,

I need to add a utility in my web application that user enters their site url and I need to validate it against W3C standards. Same as W3C validator tools does already.
[Markup validator]
[CSS Validator]

. I can't use their service as it is shared ,,and access use of it is blocked. So I decided to use their api and integrate it to my application ..

I've been trying to get the css-validator.jar in my application .I have foolowed every instruction they have listed in Instructions . But I am not able to work with Tomcat.

Here is the error log printed in tomcat stdout.log file.


[trace] *******************************************************************
[debug] Starting Apache Velocity v1.5 (compiled: 2007-02-22 08:52:29)
[trace] RuntimeInstance initializing.
[debug] Default Properties File: org\apache\velocity\runtime\defaults\velocity.properties
[debug] Trying to use logger class org.apache.velocity.runtime.log.AvalonLogChute
[debug] Couldn't find class org.apache.velocity.runtime.log.AvalonLogChute or necessary supporting classes in classpath.
org/apache/log/format/Formatter
java.lang.NoClassDefFoundError: org/apache/log/format/Formatter
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.apache.velocity.util.ClassUtils.getClass(ClassUtils.java:63)
at org.apache.velocity.util.ClassUtils.getNewInstance(ClassUtils.java:95)
at org.apache.velocity.runtime.log.LogManager.createLogChute(LogManager.java:147)
at org.apache.velocity.runtime.log.LogManager.updateLog(LogManager.java:208)
at org.apache.velocity.runtime.RuntimeInstance.initializeLog(RuntimeInstance.java:728)
at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:240)
at org.apache.velocity.runtime.RuntimeSingleton.init(RuntimeSingleton.java:113)
at org.apache.velocity.app.Velocity.init(Velocity.java:83)
at org.w3c.css.index.IndexGenerator.generatesIndex(IndexGenerator.java:102)
at org.w3c.css.servlet.CssValidator$1.run(CssValidator.java:144)
Caused by: java.lang.ClassNotFoundException: org.apache.log.format.Formatter
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1438)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1284)
... 12 more
[debug] Using SystemLogChute.
[debug] Default ResourceManager initializing. (class org.apache.velocity.runtime.resource.ResourceManagerImpl)
[debug] ResourceLoader instantiated: org.apache.velocity.runtime.resource.loader.FileResourceLoader
[trace] FileResourceLoader : initialization starting.
[debug] Do unicode file recognition: false
[info] FileResourceLoader : adding path '/D:/hardik_java/Eclipse%203.1/eclipse/eclipse/workspace/vys/.deployables/vys/WEB-INF/classes/org/w3c/css/index/'
[info] FileResourceLoader : adding path '/D:/hardik_java/Eclipse%203.1/eclipse/eclipse/workspace/vys/.deployables/vys/WEB-INF/classes/org/w3c/css/index/../../../../'
[trace] FileResourceLoader : initialization complete.
[debug] ResourceCache: initialized (class org.apache.velocity.runtime.resource.ResourceCacheImpl)
[trace] Default ResourceManager initialization complete.
[debug] Loaded System Directive: org.apache.velocity.runtime.directive.Literal
[debug] Loaded System Directive: org.apache.velocity.runtime.directive.Macro
[debug] Loaded System Directive: org.apache.velocity.runtime.directive.Parse
[debug] Loaded System Directive: org.apache.velocity.runtime.directive.Include
[debug] Loaded System Directive: org.apache.velocity.runtime.directive.Foreach
[debug] Created '20' parsers.
[trace] Velocimacro : initialization starting.
[debug] Velocimacro : "velocimacro.library" is not set. Trying default library: VM_global_library.vm
[debug] Velocimacro : Default library not found.
[debug] Velocimacro : allowInline = true : VMs can be defined inline in templates
[debug] Velocimacro : allowInlineToOverride = false : VMs defined inline may NOT replace previous VM definitions
[debug] Velocimacro : allowInlineLocal = false : VMs defined inline will be global in scope if allowed.
[debug] Velocimacro : autoload off : VM system will not automatically reload global library macros
[trace] Velocimacro : Velocimacro : initialization complete.
[trace] RuntimeInstance successfully initialized.
[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:452)
at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:335)
at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1102)
at org.apache.velocity.runtime.RuntimeSingleton.getTemplate(RuntimeSingleton.java:324)
at org.apache.velocity.app.Velocity.getTemplate(Velocity.java:524)
at org.w3c.css.index.IndexGenerator.generatesIndex(IndexGenerator.java:110)
at org.w3c.css.servlet.CssValidator$1.run(CssValidator.java:144)
[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:452)
at org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:335)
at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1102)
at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1077)
at org.apache.velocity.runtime.RuntimeSingleton.getTemplate(RuntimeSingleton.java:303)
at org.apache.velocity.app.Velocity.getTemplate(Velocity.java:503)
at org.w3c.css.css.StyleSheetGenerator.<init>(StyleSheetGenerator.java:199)
at org.w3c.css.css.StyleReportFactory.getStyleReport(StyleReportFactory.java:19)
at org.w3c.css.servlet.CssValidator.handleRequest(CssValidator.java:758)
at org.w3c.css.servlet.CssValidator.doGet(CssValidator.java:393)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:873)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)
java.lang.NullPointerException
at org.w3c.css.css.StyleSheetGenerator.print(StyleSheetGenerator.java:474)
at org.w3c.css.servlet.CssValidator.handleRequest(CssValidator.java:770)
at org.w3c.css.servlet.CssValidator.doGet(CssValidator.java:393)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:873)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
at java.lang.Thread.run(Unknown Source)




I am confused that all resource the error is saying missing ex. xhtml.properties, Validator.vm .. are present in jar file. I ll be really thankful... if there is anybody that has already been done this or anybody who can guide me,... please please please.......


Thanks,
Sneha.
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The error indicates that the validator jar is not on classpath, make sure you've put that file in WEB-INF/lib.
 
Sneha Ganatra
Greenhorn
Posts: 3
MySQL Database Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's proper dear... the jar file is in the classpath...
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you starting your app from Eclipse ? If so, I suggest to make a war for your web app and deploy it in standalone tomcat server and then try.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sneha Ganatra wrote:It's proper dear... the jar file is in the classpath...


The classpath is meaningless at run time.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sneha Ganatra wrote:It's proper dear... the jar file is in the classpath...


Is it in WEB-INF/lib of your webapp? That is where it should be. Forget about the CLASSPATH environment variable.

The error indicates that the class org.apache.log.format.Formatter cannot be found. That is a class from Apache Commons Logging. You need to include the right version of that library in your WEB-INF/lib also.
 
Sneha Ganatra
Greenhorn
Posts: 3
MySQL Database Tomcat Server Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks all ,,but I have taken care all of the things you suggested.. Hey,can you do it at your end and tell me where I lack ,,if you have time ...

@ Sagar Rohankar :

Yes dear,, I am using ecclipse... but I had tried also by deploying the war in standalone tomcat server,,,, but both way it gives same result ... .. I have tried all ways.. but nothing works..

@ Jesper de Jong :


Yes,it is in WEB-INF/lib and I have added all jars of the same version stated in W3C installation guide.. here is the link -- http://jigsaw.w3.org/css-validator/DOWNLOAD.html

By following all these ,, instruction I have successfully build css-validator.war file and deploy in tomcat.. but still it gives me an error... Then I tried to use it in my existing web-application same as we do with any jar file... but it also gives me same errors in back end...

Thanks,
Sneha.
reply
    Bookmark Topic Watch Topic
  • New Topic