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 the Author

author image
mkyong
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

avatar
5 Comment threads
2 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
7 Comment authors
NehaEmyRajmickrani Recent comment authors
newest oldest most voted
mick
Guest
mick

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.

Pallavi
Guest
Pallavi

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

sarath thota
Guest
sarath thota

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”

rani
Guest
rani

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

Neha
Guest
Neha

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.