Main Tutorials

java.lang.ClassNotFoundException : com/sun/xml/bind/v2/model/annotation/AnnotationReader

Problem

Deploying a JAX-WS web service on Tomcat, hits following error message :


java.lang.ClassNotFoundException: 
	com/sun/xml/bind/v2/model/annotation/AnnotationReader

Solution

The JAX-WS dependency library “jaxb-impl.jar” is missing.

  1. Go here http://jax-ws.java.net/.
  2. Download JAX-WS RI distribution.
  3. Unzip it and copy “jaxb-impl.jar” to Tomcat library folder “{$TOMCAT}/lib“.
  4. Restart Tomcat.

About Author

author image
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

Subscribe
Notify of
7 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
mick
10 years ago

Since the 2.2.7 version of jaxb the annotation reader class is in the jaxb-core.jar:
http://grepcode.com/file/repository.jboss.org/maven2/sun-jaxb/jaxb-impl/2.1.4/com/sun/xml/bind/v2/model/annotation/RuntimeAnnotationReader.java

So put the jaxb-core.jar file in the Tomcat’s lib folder.

It works for me.

Raj
10 years ago
Reply to  mick

This Worked for me, Thanks mick.

Neha
7 years ago

Hello Mkyong,

This is out of date for version 2.2.11. Could you please add / update post to support your answer for latest dependencies? No one willing to use old if latest is available.

rani
10 years ago

I have also same problem plz reply me please………….

sarath thota
10 years ago

In jaxb-impl.jar file , in com.sun.xml.bind.v2.model.annotation package , I could not found AnnotationReader class.
I am getting
“Exception in thread “main” java.lang.NoClassDefFoundError: com/sun/xml/bind/v2/model/annotation/AnnotationReader”

Pallavi
10 years ago

hi..”jaxb-impl.jar” is prsent in tomcat-lib..but still its giving the same error..Plz guide me..
Thanks in advance

Emy
8 years ago
Reply to  Pallavi

Please see the version of that jar.