@Override protected JAXBContext createJaxbContext() throws Exception { if (JaxbUtils.getJaxbVersion(classLoader) < JaxbUtils.JAXB_2) { throw new IllegalStateException( "Cannot use Jaxb2Marshaller in combination with JAXB 1.0. Use Jaxb1Marshaller instead."); } if (StringUtils.hasLength(getContextPath()) && !ObjectUtils.isEmpty(classesToBeBound)) { throw new IllegalArgumentException("specify either contextPath or classesToBeBound property; not both"); } if (!ObjectUtils.isEmpty(schemaResources)) { if (logger.isDebugEnabled()) { logger.debug( "Setting validation schema to " + StringUtils.arrayToCommaDelimitedString(schemaResources)); } schema = SchemaLoaderUtils.loadSchema(schemaResources, schemaLanguage); } if (StringUtils.hasLength(getContextPath())) { return createJaxbContextFromContextPath(); } else if (!ObjectUtils.isEmpty(classesToBeBound)) { return createJaxbContextFromClasses(); } else { throw new IllegalArgumentException("setting either contextPath or classesToBeBound is required"); } }