середа, 31 липня 2019 р.

NoClassDefFoundError and tools.jar

On my current project, I faced up with some bug which made me crazy:
java.lang.NoClassDefFoundError: com/sun/tools/attach/AttachNotSupportedException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.getDeclaredMethods(Class.java:1975)
at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:609)
at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:521)

I used IDEA, Maven and Tomcat 9. Using IDEA Ultimate I created a configuration which should run my MVC project. In POM I had:
<dependency>
   <groupId>com.sun</groupId>
   <artifactId>tools</artifactId>
   <version>1.0.0</version>
   <scope>system</scope>
   <systemPath>${project.basedir}/lib/tools.jar</systemPath>
</dependency>
And everytime I saw the exception.
The Internet did not help and I was merely suffering. However, my teammate had already faced up with this kind of issue. So he advised me to put tools.jar into:
C:\Program Files\Apache Software Foundation\Tomcat 9.0\lib

And at last, it has worked.    

Немає коментарів:

Дописати коментар