問題:
使用org.apache.commons.validator.GenericValidator.matchRegexp,發生下列錯誤
Exception in thread "main" java.lang.NoClassDefFoundError:
org.apache.oro.text.perl.Perl5Util
at org.apache.commons.validator.GenericValidator.matchRegexp(GenericValidator.java:65)
at com.fesc.bot.batch.BatchJob.downloadFiles(Unknown Source)
at com.fesc.bot.batch.FD903C.exec(Unknown Source)
at com.fesc.bot.batch.FD903C.main(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.oro.text.perl.Perl5Util
at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:665)
at java.lang.ClassLoader.loadClass(ClassLoader.java:644)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:358)
at java.lang.ClassLoader.loadClass(ClassLoader.java:627)
... 4 more

解決:
由錯誤訊息判斷應該缺少oro project的jar
連到ORO official site,卻發現As of 2010-09-01, the ORO project is retired.

改到common-validator official site,下載最新版本的jar,重新執行程式測試,確認錯誤不會發生。

mark528 發表在 痞客邦 PIXNET 留言(0) 人氣()