ClassNotFoundException: org.apache.xml.serialize.XMLSerializer

ClassNotFoundException: org.apache.xml.serialize.XMLSerializer

Problem

MitSpring OXM + Castor binding wird die Castor-Bibliothek hinzugefügt, aber trotzdem die folgende Fehlermeldung angezeigt?

Exception in thread "main" java.lang.RuntimeException:
    Could not instantiate serializer org.apache.xml.serialize.XMLSerializer:
    java.lang.ClassNotFoundException: org.apache.xml.serialize.XMLSerializer
    at org.exolab.castor.xml.XercesSerializer.(XercesSerializer.java:50)
    //...

Castor-Abhängigkeit in Maven.

    
        org.codehaus.castor
        castor
        1.2
    

Lösung

Wenn nicht Fehler,Castor need Xerces to work, müssen Sie auch die Xerces-Abhängigkeit hinzufügen.

    

        
            org.springframework
            spring-oxm
            3.0.5.RELEASE
        

        
            org.codehaus.castor
            castor
            1.2
        

        
            xerces
            xercesImpl
            2.8.1