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.

mkyong

Founder of Mkyong.com, passionate Java and open-source technologies. If you enjoy my tutorials, consider making a donation to these charities.

7 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
mick
12 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
12 years ago
Reply to  mick

This Worked for me, Thanks mick.

Neha
10 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
12 years ago

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

sarath thota
12 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
12 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
10 years ago
Reply to  Pallavi

Please see the version of that jar.