Problem

Validate an URL with Apache common URLValidator to validate an URL, but it hits following error message ?

java.lang.NoClassDefFoundError: org/apache/oro/text/perl/Perl5Util
	at org.apache.commons.validator.UrlValidator.isValid(UrlValidator.java:242)
	...
Caused by: java.lang.ClassNotFoundException: org.apache.oro.text.perl.Perl5Util
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1516)
	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
	... 28 more

Solution

The URLValidator class is required Jakarta-ORO library, make sure you include the oro-xxx.jar into your project class path.

You can get oro-xxx.jar from :
1. Jakarta-ORO official site – http://jakarta.apache.org/oro/index.html
2. Maven central repository

<dependency>
	<groupId>oro</groupId>
	<artifactId>oro</artifactId>
	<version>2.0.8</version>
</dependency>
Tags :
Founder of Mkyong.com and HostingCompass.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider making a donation to this charity, thanks.

Related Posts

Popular Posts