0

I can not start web app in eclipse embedded tomcat, but if I deploy war file in standalone tomcat then it works.

The exception I get is:

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name  defined in class path resource Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Factory method threw exception; nested exception is java.lang.NoClassDefFoundError: org/mockito/Mockito

The file exception is referring to is annotated with @Configuration and is located in src/test/java; purpose of the file is to create mock beans for test cases.

Sandeep Kumar
  • 2,397
  • 5
  • 30
  • 37
Guram Kankava
  • 51
  • 1
  • 4

1 Answers1

0

The fix to the problem is this link:

How to prevent eclipse from deploying test classes on Tomcat?

The cause of the problem was, when eclipse was assembling a war file it would include src/test/java dir in it, and the dependencies were missing for test cases. because in pom dependencies for test had test which means that maven will not include those jar files in final bucked product meaning war file.

Guram Kankava
  • 51
  • 1
  • 4