ramesh027
ramesh027

Reputation: 796

Issue with Jenkins Junit cases running with maven

from last few week, I am facing a strange issue regarding the junit test case in the jenkins, when I say strange the same workspace if I try to run from the command prompt working fine and execute the junit test case but when running with jenkin it is throwing error for junit as test case UNC paths are not supported. Defaulting to Windows directory. and lso class not found. and the error is:

 [INFO] --- maven-surefire-plugin:2.7.2:test (default-test) @ projectdemo ---
    [INFO] Surefire report directory: MBP\workspace\target\surefire-reports
MBP\workspace'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
java.lang.reflect.UndeclaredThrowableException
    at com.sun.proxy.$Proxy0.invoke(Unknown Source)
    at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150)
    at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103)
    ... 4 more
Caused by: java.lang.RuntimeException: Unable to create test class 'com.db.proj.demo.services.integration.impl.test.TestImpl'
    at org.apache.maven.surefire.util.DefaultDirectoryScanner.loadClass(DefaultDirectoryScanner.java:109)
    at org.apache.maven.surefire.util.DefaultDirectoryScanner.locateTestClasses(DefaultDirectoryScanner.java:78)
    at org.apache.maven.surefire.junit4.JUnit4Provider.scanClassPath(JUnit4Provider.java:164)
    at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:86)
    ... 9 more
Caused by: java.lang.ClassNotFoundException: com.db.proj.demo.services.integration.impl.test.TestImpl
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
    at org.apache.maven.surefire.util.DefaultDirectoryScanner.loadClass(DefaultDirectoryScanner.java:105)
    ... 12 more
[ERROR] There are test failures.

Please refer to MBP\workspace\target\surefire-reports for the individual test results.

It is working fine till few day backs, but I don't if anything else need to declared for junit to pass in jenkin.

Note: I have declared a maven project in jenkin with svn as source repository.

Upvotes: 2

Views: 770

Answers (1)

killabyte_garcia
killabyte_garcia

Reputation: 160

In my humble opinion, the error is clear: java.lang.ClassNotFoundException: com.db.proj.demo.services.integration.impl.test.TestImpl

You should revise that in your svn repository the TestImpl class changes has been committed. If the problem persists, try to configure your Jenkins project to an older version in which you are sure it used to compile fine. Step by step, you are likely to find out what problem has been introduced, but it is bound to be related to a non-commit class.

Upvotes: 2

Related Questions