Search code examples
javamarshalling

Getting java.lang.ClassNotFoundException:MalformedPatternException


While trying to marshal the java object to xml i am getting below exception .

java.lang.ClassNotFoundException: org.apache.oro.text.regex.MalformedPatternException
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:186)
    at org.castor.xml.AbstractInternalContext.getRegExpEvaluator(AbstractInternalContext.java:325)
    at org.exolab.castor.xml.validators.PatternValidator.initEvaluator(PatternValidator.java:262)
    at org.exolab.castor.xml.validators.PatternValidator.validate(PatternValidator.java:200)
    at org.exolab.castor.xml.validators.StringValidator.validate(StringValidator.java:302)
    at org.exolab.castor.xml.validators.StringValidator.validate(StringValidator.java:340)
    at org.exolab.castor.xml.FieldValidator.validateInstance(FieldValidator.java:324)
    at org.exolab.castor.xml.FieldValidator.validate(FieldValidator.java:271)
    at org.exolab.castor.xml.util.XMLClassDescriptorImpl.validate(XMLClassDescriptorImpl.java:1072)
    at org.exolab.castor.xml.Validator.validate(Validator.java:135)
    at org.exolab.castor.xml.Marshaller.validate(Marshaller.java:2594)
    at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:826)
    at in.mywebapp.util.XMLUnmarshaller.getStatusRequestParam(XMLUnmarshaller.java:266)

Not sure which jar is missing .


Solution

  • you are probably missing oro.jar. You can add maven dependency

        <dependency>
            <groupId>oro</groupId>
            <artifactId>oro</artifactId>
            <version>2.0.8</version>
        </dependency>
    

    or download the jar from maven repository