Exception in thread “main” java.lang.NoClassDefFoundError: com/google/gson/JsonParseExceptiong

心不动则不痛 提交于 2020-06-16 09:37:47

问题


I have encountered the following error "Exception in thread "main" java.lang.NoClassDefFoundError: com/google/gson/JsonParseException", when running selenium script in TestNg. How to resolve this error?


回答1:


I have came across the same "NoClassDefFoundError:com/google/gson/JsonParseException" error before. This was caused by the addition of "selenium-java-2.53.0" jar file in my package.

I removed this jar file and refreshed my project and ran again. It was working fine there after.

You can try the same. The version of the jar file may differ but removing it should do the job.

Cheers.




回答2:


I was facing the same problem. The error is due to the conflicting version on gson. I was able to overcome this by removing the maven dependency and deleting the jar from maven repository.

Cheers



来源:https://stackoverflow.com/questions/44645859/exception-in-thread-main-java-lang-noclassdeffounderror-com-google-gson-jsonp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!