的InvocationTargetException

时间:2011-05-20 10:44:44

标签: java ant junit log4j

  

可能重复:
  ant target for junit

当我为junit运行ant目标时遇到以下错误。

<error type="java.lang.reflect.InvocationTargetException">java.lang.reflect.InvocationTargetException
    Caused by: java.lang.ExceptionInInitializerError
        at org.apache.log4j.Logger.getLogger(Logger.java:94)
        at com.bgc.ecm.core.test.ElNinoAbstractTestCase.<clinit>(ElNinoAbstractTestCase.java:62)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at com.bgc.EshopServiceTestSuite.suite(EshopServiceTestSuite.java:44)
    Caused by: sun.misc.InvalidJarIndexException: Invalid index
        at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:769)
        at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:682)
        at sun.misc.URLClassPath$JarLoader.findResource(URLClassPath.java:663)
        at sun.misc.URLClassPath.findResource(URLClassPath.java:142)
        at java.net.URLClassLoader$2.run(URLClassLoader.java:362)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findResource(URLClassLoader.java:359)
        at java.lang.ClassLoader.getResource(ClassLoader.java:977)
        at java.lang.ClassLoader.getSystemResource(ClassLoader.java:1075)
        at org.apache.log4j.helpers.Loader.getResource(Loader.java:106)
        at org.apache.log4j.LogManager.<clinit>(LogManager.java:96)
    </error>
      <system-out><![CDATA[]]></system-out>
      <system-err><![CDATA[log4j:WARN Caught Exception while in Loader.getResource. This may be innocuous.
    sun.misc.InvalidJarIndexException: Invalid index
        at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:769)
        at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:682)
        at sun.misc.URLClassPath$JarLoader.findResource(URLClassPath.java:663)
        at sun.misc.URLClassPath.findResource(URLClassPath.java:142)
        at java.net.URLClassLoader$2.run(URLClassLoader.java:362)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findResource(URLClassLoader.java:359)
        at java.lang.ClassLoader.getResource(ClassLoader.java:977)
        at org.apache.log4j.helpers.Loader.getResource(Loader.java:78)
        at org.apache.log4j.LogManager.<clinit>(LogManager.java:96)
        at org.apache.log4j.Logger.getLogger(Logger.java:94)
        at com.bgc.ecm.core.test.ElNinoAbstractTestCase.<clinit>(ElNinoAbstractTestCase.java:62)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
        at junit.framework.TestSuite.createTest(TestSuite.java:131)
        at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)
        at junit.framework.TestSuite.<init>(TestSuite.java:75)
        at junit.framework.TestSuite.addTestSuite(TestSuite.java:101)
        at com.bgc.EshopServiceTestSuite.suite(EshopServiceTestSuite.java:44)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:358)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:931)
        at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:785)
    ]]></system-err>

0 个答案:

没有答案