Announcement Announcement Module
Collapse
No announcement yet.
VerifyError when running a JUnit test within Eclipse Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • VerifyError when running a JUnit test within Eclipse

    When I either run or debug a JUnit test of a class I'm developing I get a VerifyError message which doesn't really make sense in the context of the test. It is complaining that there is an incompatible argument to a function. What is strange is that the method (function) that it complains about is never called within the test.

    I am getting the bean that I want to test in the TestCase.setUp() method:

    Code:
    ApplicationContext applicationContext = new FileSystemXmlApplicationContext("C:/eclipse/workspace/admin/webapp/WEB-INF/sparkadmin-service.xml");
    this.loginService = (LoginService) applicationContext.getBean("loginService");
    The failure trace I see in my Eclipse console:

    Code:
    java.lang.VerifyError: (class: com/admin/prefs/PrefsDom, method: addInstanceNode signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZLjava/lang/String;)Lcom/admin/prefs/PrefsUpdateStatusMessage;) Incompatible argument to function
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at org.springframework.util.ClassUtils.forName(ClassUtils.java:108)
    at org.springframework.beans.factory.support.BeanDefinitionReaderUtils.createBeanDefinition(BeanDefinitionReaderUtils.java:65)
    at org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.parseBeanDefinitionElement(DefaultXmlBeanDefinitionParser.java:426)
    at org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.parseBeanDefinitionElement(DefaultXmlBeanDefinitionParser.java:392)
    at org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.parseBeanDefinitions(DefaultXmlBeanDefinitionParser.java:307)
    at org.springframework.beans.factory.xml.DefaultXmlBeanDefinitionParser.registerBeanDefinitions(DefaultXmlBeanDefinitionParser.java:191)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:295)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:223)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:173)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:148)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:126)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142)
    at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
    at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:81)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:89)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:269)
    at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:89)
    at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:74)
    at org.springframework.context.support.FileSystemXmlApplicationContext.<init>(FileSystemXmlApplicationContext.java:65)
    at com.admin.prefs.PrefsDomTest.setUp(PrefsDomTest.java:31)
    at junit.framework.TestCase.runBare(TestCase.java:125)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at junit.framework.TestSuite.runTest(TestSuite.java:208)
    at junit.framework.TestSuite.run(TestSuite.java:203)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    If I instantiate the bean rather than get it from the Spring ApplicationContext (i.e. remove all Spring dependencies from the test) then everything runs fine.

    Thanks in advance for any suggestions.


    --James

  • #2
    You have some classpath problems for sure - you are running two versions which have different definitions. I can't tell you where you should expect that you either have a stale cache or there are two different classpath that are being used, and each one contains a very similar yet different version of your class.

    Comment

    Working...
    X