You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by "Konstantin Kolinko (Confluence)" <no...@apache.org> on 2019/11/23 23:20:08 UTC

[CONF] Apache Tomcat > Class Not Found Issues

There's **1 new edit** on this page  
---  
|  
---  
|  | [![page icon](cid:page-
icon)](https://cwiki.apache.org/confluence/display/TOMCAT/Class+Not+Found+Issues?src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574551208226&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=view
"page icon")  
---  
[Class Not Found
Issues](https://cwiki.apache.org/confluence/display/TOMCAT/Class+Not+Found+Issues?src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574551208226&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=view
"Class Not Found Issues")  
|  |  |  |  | ![](cid:avatar_892fc5b633a433d86a56f192323474ea) |  | Konstantin
Kolinko edited this page  
---  
|  
|  | Here's the version comment  
---  
|  
---  
|  |  | ![](cid:avatar_892fc5b633a433d86a56f192323474ea) |  | Konstantin
Kolinko edited at [11:18
PM](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=103098805)  
---  
|  |  |  Add a permalink. Fix formatting. Convert links to https.  
---  
|  
|  | Here's what changed:  
---  
|

_Permalink_ to this page: [
https://cwiki.apache.org/confluence/x/tSklBg](https://cwiki.apache.org/confluence/x/tSklBg)

## Preface

This page discusses the various ways you see Class Not Found errors or very
similar errors. It is strongly advised you read the following topics:

  * Classloader HOWTO pages: [Tomcat 9.0](https://tomcat.apache.org/tomcat-9.0-doc/class-loader-howto.html), [Tomcat 8.5](https://tomcat.apache.org/tomcat-8.5-doc/class-loader-howto.html), [Tomcat 7.0](https://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html), (historic: [Tomcat 6.0](https://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html)).
  * [Don't](https://marc.info/?t=104317529200004&r=1&w=2) [use](https://marc.info/?t=104380440100003&r=1&w=2) [packageless](https://marc.info/?t=96947656900002&r=1&w=2) [classes](https://marc.info/?t=104491020100002&r=1&w=2) [and](https://marc.info/?t=104265576200003&r=1&w=2) [declare](https://marc.info/?t=104249748300001&r=1&w=2) [all](https://marc.info/?t=102996950100003&r=1&w=2) [imported classes](https://marc.info/?t=102922189400001&r=1&w=2)!
  * [Another answer to a classloader issue](https://marc.info/?l=tomcat-user&m=103843452413727&w=2)

If you get a `NoClassDefFoundError` exception, the root cause might be the
same as for a `ClassNotFound` exception.

...

  1. [Why is jsp:useBean is not working?](/confluence/pages/viewpage.action?pageId=103098805)
  2. [Why do I get java.lang.NoClassDefFoundError: javax/servlet/Filter?](/confluence/pages/viewpage.action?pageId=103098805)
  3. [Why do I get java.lang.NoClassDefFoundError: org/xml/sax/InputSource?](/confluence/pages/viewpage.action?pageId=103098805)

## Answers

###  |
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q1  
---|---  
| Q1  
  
...

###  Why is

...

###  `jsp:useBean`

...

###  is not working?

...

###

Make sure:

  * Your bean is packaged in a class.
  * You have fully qualified your class name (e.g.: 

![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/noformat.png)
No Format

`com.bar.package.MyClass`

) OR

  * You have imported your class into your jsp (e.g.: 

![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/noformat.png)
No Format

`<%@ `

` page `

` import="com.bar.package.MyClass"%>`

 )

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q2  
---|---  
| Q2  
  
...

###  Why do I get

...

###  `java.lang.NoClassDefFoundError: `

...

###  ` javax/servlet/Filter`

...

###  ?

...

###

You probably have servlet-api.jar floating around somewhere it shouldn't be.
This really messes up the classloaders since Tomcat's classloaders don't act
quite as normal as one expects (see links above). servlet-api.jar should only
be found only once in $CATALINA_HOME/lib.

###
![](https://cwiki.apache.org/confluence/s/en_GB/8100/6ef1ce95c788ac159314a8fa6387047b8d1cc9fb/_/images/icons/macrobrowser/dropdown/anchor.png)
Anchor  
---  
|  | Q3  
---|---  
| Q3  
  
...

###  Why do I get

...

###  `java.lang.NoClassDefFoundError: `

...

###  ` org/xml/sax/InputSource`

...

###  ?

...

###

You have conflicting XML api jar files in your classpath. Read the README or
RELEASE-NOTES for more information.

...  
  
|  |  | [Go to page
history](https://cwiki.apache.org/confluence/pages/viewpreviousversions.action?pageId=103098805&src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574551208226&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db "Go to page
history")  
---  
---  
| [View
page](https://cwiki.apache.org/confluence/display/TOMCAT/Class+Not+Found+Issues?src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574551208226&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=view)  
---  
  
|  | [Stop watching
space](https://cwiki.apache.org/confluence/users/removespacenotification.action?spaceKey=TOMCAT&src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574551208226&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=stop-
watching&jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ4c3JmOjhhYTk4MDk1NjlkNDIzY2QwMTZhMDQxMzMwNmYwMGRiIiwicXNoIjoiNGFiMGQyYjZhMjBlOWExNjQ4YWZjMzM4NTM1YjQ2YmJkN2UyNzhmODFkZDY1YTEyMmE3YTY4NGVmOTg5ZGU1ZiIsImlzcyI6ImNvbmZsdWVuY2Vfbm90aWZpY2F0aW9uc0FSRUgtWFVEMS1QT1FHLUNTQU8iLCJleHAiOjE1NzUxNTYwMDgsImlhdCI6MTU3NDU1MTIwOH0.gvLNa6dxC_2slpJ8scZwkSy12QGcjJvyl2gSVwQQtJ4)
| •  
---|---  
[Manage
notifications](https://cwiki.apache.org/confluence/users/editmyemailsettings.action?src=mail&src.mail.product=confluence-
server&src.mail.timestamp=1574551208226&src.mail.notification=com.atlassian.confluence.plugins.confluence-
notifications-batch-plugin%3Abatching-
notification&src.mail.recipient=8aa9809569d423cd016a0413306f00db&src.mail.action=manage)  
---  
| ![Confluence logo big](cid:footer-desktop-logo)  
---  
This message was sent by Atlassian Confluence 6.15.8  
![](cid:footer-mobile-logo)  
---