|
简介:这是运行selenium2出现NoClassDefFoundError - Java / Java SE的详细页面,介绍了和java,运行selenium2出现NoClassDefFoundError - Java / Java SE有关的知识,加入收藏请按键盘ctrl+D,谢谢大家的观看!要查看更多有关信息,请点击此处
下载了selenium2alpha4版本,是一个zip包,解开后是一些jar文件,因为需要在classpath设置这些文件,所以编写了一个cmd文件:
==================
set java_home=C:\Program Files\Java\jre6
set classpath=.;selenium-server-2.0a4.jar;ant-1.6.5.jar;bcprov-jdk15-135.jar;commons-codec-1.4.jar;commons-collections-3.2.1.jar;commons-httpclient-3.1.jar;commons-io-1.4.jar;commons-lang-2.4.jar;commons-logging-1.1.1.jar;cssparser-0.9.5.jar;google-collect-1.0.jar;hamcrest-all-1.1.jar;htmlunit-2.7.jar;htmlunit-core-js-2.7.jar;jmock-2.4.0.jar;jmock-junit3-2.4.0.jar;jna.jar;json-20080701.jar;junit-3.8.1.jar;mx4j-tools-3.0.1.jar;nekohtml-1.9.14.jar;sac-1.3.jar;serializer-2.7.1.jar;servlet-api-2.5-6.1.9.jar;xalan-2.7.1.jar;xercesImpl-2.9.1.jar;xml-apis-1.3.04.jar
"%java_home%\bin\java" -jar selenium-server-2.0a4.jar
==================
运行后报错:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.openqa.selenium.server.InjectionHelper.<clinit>(InjectionHelper.java:21)
at org.openqa.selenium.server.SeleniumServer.checkArgsSanity(SeleniumServer.java:642)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:194)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 15 more
可是commons-logging-1.1.1.jar中明明有org.apache.commons.logging.LogFactory这个类(接口)啊!
==================
set java_home=C:\Program Files\Java\jre6
set classpath=.;selenium-server-2.0a4.jar;ant-1.6.5.jar;bcprov-jdk15-135.jar;commons-codec-1.4.jar;commons-collections-3.2.1.jar;commons-httpclient-3.1.jar;commons-io-1.4.jar;commons-lang-2.4.jar;commons-logging-1.1.1.jar;cssparser-0.9.5.jar;google-collect-1.0.jar;hamcrest-all-1.1.jar;htmlunit-2.7.jar;htmlunit-core-js-2.7.jar;jmock-2.4.0.jar;jmock-junit3-2.4.0.jar;jna.jar;json-20080701.jar;junit-3.8.1.jar;mx4j-tools-3.0.1.jar;nekohtml-1.9.14.jar;sac-1.3.jar;serializer-2.7.1.jar;servlet-api-2.5-6.1.9.jar;xalan-2.7.1.jar;xercesImpl-2.9.1.jar;xml-apis-1.3.04.jar
"%java_home%\bin\java" -jar selenium-server-2.0a4.jar
==================
运行后报错:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.openqa.selenium.server.InjectionHelper.<clinit>(InjectionHelper.java:21)
at org.openqa.selenium.server.SeleniumServer.checkArgsSanity(SeleniumServer.java:642)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:194)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 15 more
可是commons-logging-1.1.1.jar中明明有org.apache.commons.logging.LogFactory这个类(接口)啊!