It's all about the answers!

Ask a question

Error 500: java.lang.NoClassDefFoundError: packageName/className

Raheem Alhamdani (2816) | asked Jun 08 '17, 12:26 p.m.
edited Jun 09 '17, 12:54 a.m. by Ralph Schoon (63.2k33646)

I have created a jsp page that has a form to get the attributes needed to create a Work Item, the jsp calls on the class to create the Item, but I ran into this error and researched multiple times with multiple sources but none solve the problem for me. can you please help, what to you need to see (code, web.xml, MANIFEST, server.xml... etc.)?

Donald Nong commented Jun 09 '17, 12:21 a.m.

Full stack trace? We don't even know which component reports this error.

Raheem Alhamdani commented Feb 22 '18, 12:38 p.m.

Class loader order was the problem, I had to change to parent last and WAR class loader policy to "Single class loader for application.

I am including and loading Plain java jars with my war files, not the best practice I think.

One answer

permanent link
Mark Aldo (11) | answered Aug 21 '20, 2:59 a.m.

 The NoClassDefFoundError indicates that the classloader , which is responsible for dynamically loading classes, cannot find the .class file for the class that you're trying to use. The definition of a class can be requested during a method call , or while creating a new instance using a new expression. NoClassDefFoundError means that the class is present in the classpath at Compile time, but it doesn't exist in the classpath at Runtime. After you compile your code, you end up with .class files for each class in your program. These binary files are the bytecode that Java interprets to execute your program. 

Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.