2016-08-08 2 views
0

3 일 동안이 문제가 있으며 지금 해결 방법을 모르겠습니다 ... 여기 있습니다 : 오이와 메이븐을 사용하여 수락 테스트를하고 있습니다.CucumberException 클래스를 인스턴스화하지 못했습니다.

모든 테스트가 잘 작동하고 테스트하려는 프로젝트의 pom.xml 파일에서 종속성으로 가져 오는 jar 라이브러리를 만들었습니다. 난 그냥 그러나 나는 수입 내 항아리의 그룹 ID의 이름 ...

을 변경할 때까지

모든 것이 잘 작동, 나는 항아리 라이브러리로 가져올 내 프로젝트에 대해 "MVN 설치"명령을했다 테스트하기 위해 프로젝트를 다시 실행하기 전에 (그리고 분명히 pom.xml 파일의 의존성을 변경했다.)

내가 지금 무엇입니까 오류 :

cucumber.runtime.CucumberException: Failed to instantiate class cucumber.steps.myClass 
     at cucumber.runtime.java.DefaultJavaObjectFactory.cacheNewInstance(DefaultJavaObjectFactory.java:46) 
     at cucumber.runtime.java.DefaultJavaObjectFactory.getInstance(DefaultJavaObjectFactory.java:32) 
     at cucumber.runtime.java.JavaStepDefinition.execute(JavaStepDefinition.java:38) 
     at cucumber.runtime.StepDefinitionMatch.runStep(StepDefinitionMatch.java:37) 
     at cucumber.runtime.Runtime.runStep(Runtime.java:299) 
     at cucumber.runtime.model.StepContainer.runStep(StepContainer.java:44) 
     at cucumber.runtime.model.StepContainer.runSteps(StepContainer.java:39) 
     at cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:44) 
     at cucumber.runtime.junit.ExecutionUnitRunner.run(ExecutionUnitRunner.java:91) 
     at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:63) 
     at cucumber.runtime.junit.FeatureRunner.runChild(FeatureRunner.java:18) 
     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) 
     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) 
     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) 
     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) 
     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) 
     at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 
     at cucumber.runtime.junit.FeatureRunner.run(FeatureRunner.java:70) 
     at cucumber.api.junit.Cucumber.runChild(Cucumber.java:93) 
     at cucumber.api.junit.Cucumber.runChild(Cucumber.java:37) 
     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) 
     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) 
     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) 
     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) 
     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) 
     at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 
     at cucumber.api.junit.Cucumber.run(Cucumber.java:98) 
     at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:367) 
     at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:274) 
     at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238) 
     at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:161) 
     at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290) 
     at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242) 
     at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121) 
     Caused by: java.lang.reflect.InvocationTargetException 
     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) 
     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 
     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 
     at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
     at cucumber.runtime.java.DefaultJavaObjectFactory.cacheNewInstance(DefaultJavaObjectFactory.java:40) 
     ... 33 more 
     Caused by: java.lang.NoClassDefFoundError: org/jdom/Element 
     at myPackageImportFromJar.anotherClass.<clinit> 
     at cucumber.steps.myClass.<init> 
     ... 38 more 
     Caused by: java.lang.ClassNotFoundException: org.jdom.Element 
     at java.net.URLClassLoader.findClass(URLClassLoader.java:381) 
     at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) 
     at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
     ... 40 more 

그냥 정보는 (내 오류가에서 비롯 될 수있다) : 제가 테스트 할 프로젝트의 속성을 읽을 수 jar 파일을 사용하고 있습니다.

당신이 어떤 생각을 가지고 있다면, 나는 그것을 듣고 기뻐할 것입니다 ... 고마워요! 문제가 어디에서 오는지

+0

이 질문을보십시오 : http://stackoverflow.com/a/28387412/1119381. 의존성 버전에 문제가있을 수 있습니다. –

+0

답변 해 주셔서 감사합니다. 불행히도, 나는 이미이 질문을 보았고 제 경우에는 오이 - 자바 (1.2.4), 오이 - 유니트 (1.2.4) 및 유니트 (4.12) 종속성 이외의 것을 사용하지 않고 있습니다. –

답변

0

아웃 찾았 내가 인정되지 않았다 의존성과 JDOM을 반드시 org.jdom 사용하고 인스턴스화되지 않을 수

(조금 이상한을하지만 ... 그것을 설명 할 수 없다). 내가 사용한 솔루션은 jdom2 종속성으로 jdom 종속성을 변경하는 것입니다. 이러한 의존성으로 모든 것이 잘 작동합니다 (잠시 동안).

관련 문제