精华内容
下载资源
问答
  • 点击Initialize comments 突然跳转出一个错误Errorvalidation failed 经查阅之后发现 issue的标签label有长度限制!labels的最大长度限制是50个字符。 对于这个问题的解决方法是修改gitment.ejs文件 将id: "&...

    点击Initialize comments 突然跳转出一个错误Error:validation failed

    经查阅之后发现

    issue的标签label有长度限制!labels的最大长度限制是50个字符。
    对于这个问题的解决方法是修改gitment.ejs文件

    在这里插入图片描述
    将id: "<%=url%>"修改为 id: "<%=page.title%>"
    最后问题解决:
    在这里插入图片描述

    我的博客,欢迎博友查看

    转载于:https://www.cnblogs.com/liuurick/p/10713687.html

    展开全文
  • Created by Wang, Jerry on Dec 29, 2016 http://stackoverflow.com/questions/7267341/validation-error-of-spring-beans-schema-inside-application-context
    展开全文
  • shema validation(XSD only)

    2013-06-04 13:03:49
    package com.pg.commerce.utils; import java.io.File; import java.io.IOException; import javax.xml.transform.Source;...import javax.xml.transform.stream.StreamSource;...import javax.xml.validation.Sche

    package com.pg.commerce.utils;

    import java.io.File;
    import java.io.IOException;

    import javax.xml.transform.Source;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.validation.Schema;
    import javax.xml.validation.SchemaFactory;
    import javax.xml.validation.Validator;

    import org.apache.log4j.Logger;
    import org.xml.sax.SAXException;

    public class ValidateXML {

     
     
     public static boolean Validatexml(String xsdpath, String xmlpath)
       throws SAXException, IOException {
      Logger log = LoggerHelp.getInstance("BazaarVoice");
      // 建立schema工厂
      SchemaFactory schemaFactory = SchemaFactory
        .newInstance("http://www.w3.org/2001/XMLSchema");
      // 建立验证文档文件对象,利用此文件对象所封装的文件进行schema验证
      File schemaFile = new File(xsdpath);
      // 利用schema工厂,接收验证文档文件对象生成Schema对象
      Schema schema = schemaFactory.newSchema(schemaFile);
      // 通过Schema产生针对于此Schema的验证器,利用schenaFile进行验证
      Validator validator = schema.newValidator();
      // 得到验证的数据源
      Source source = new StreamSource(xmlpath);
      // 开始验证,成功输出success!!!,失败输出fail
      try {

       validator.validate(source);

      } catch (Exception ex) {
       if(log.isDebugEnabled()){
        log.error("Validatexml| >>>error>>>"+ex.toString());
       }
       ex.printStackTrace();
       return false;
      }
      return true;
     }
     
     
     
     public static void main(String args[])throws Exception{
      System.out.println(Validatexml("D:/CCommerce/IBM/WCDE_ENT70/workspace/config/src/conf/BVvalidateSchema.xsd","C:/Users/sunc002/Desktop/aaa.xml"));
     }
    }

     

    如果不需要代码实现验证xml的有效性,可以下载xml notepad 2007,  view->schemas里面导入你要用于验证的xsd文件,打开xml文件,就会自动验证,如果有错误Error List里面就会显示出来,非常方便。

    注意要验证的xml文件必须先用记事本保存成unicode的格式的文件。
    展开全文
  • Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class...
    Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Error applying BeanValidation relational constraints
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
    	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
    	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)
    	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
    	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
    	at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
    	at com.abc.test.Test.main(Test.java:21)
    Caused by: org.hibernate.HibernateException: Error applying BeanValidation relational constraints
    	at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.applyRelationalConstraints(BeanValidationIntegrator.java:219)
    	at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.integrate(BeanValidationIntegrator.java:126)
    	at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:306)
    	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1744)
    	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1782)
    	at org.springframework.orm.hibernate4.LocalSessionFactoryBuilder.buildSessionFactory(LocalSessionFactoryBuilder.java:189)
    	at org.springframework.orm.hibernate4.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:350)
    	at org.springframework.orm.hibernate4.LocalSessionFactoryBean.afterPropertiesSet(LocalSessionFactoryBean.java:335)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
    	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
    	... 12 more
    Caused by: java.lang.reflect.InvocationTargetException
    	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    	at java.lang.reflect.Method.invoke(Method.java:606)
    	at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.applyRelationalConstraints(BeanValidationIntegrator.java:208)
    	... 21 more
    Caused by: org.hibernate.HibernateException: Unable to build the default ValidatorFactory
    	at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:524)
    	at org.hibernate.cfg.beanvalidation.TypeSafeActivator.applyDDL(TypeSafeActivator.java:119)
    	... 26 more
    Caused by: javax.validation.ValidationException: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.
    	at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:271)
    	at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:110)
    	at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:521)
    	... 27 more

    在使用Spring和Hibernate进行结合的时候出现了这个问题!

    <prop key="javax.persistence.validation.mode">none</prop>

    在配置文件中添加这个!

     <property name="hibernateProperties">
       <props>
        <prop key="hibernate.show_sql">true</prop>
        <prop key="hibernate.format_sql">true</prop>
        <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
        <prop key="javax.persistence.validation.mode">none</prop> 
       </props>
      </property>

    其实这个问题是我们自己造成的!为什么这么说?因为我们在配置Spring和Hibernate进行结合的时候版本出现了问题。
    <persistence ...>   
      <persistence-unit ...>  
        ...  
        <properties>  
          <property name="javax.persistence.validation.mode"  
                    value="callback, ddl"/>  
        </properties>  
      </persistence-unit>  
    </persistence>  
    这是hibernate官方文档的一段话!

    意思就是在hibernate.cfg.xml或者是
    persistence.xml文件下面需要配置
    javax.persistence.validation.mode属性!

    特别的!在Hibernate中默认的 <prop key="javax.persistence.validation.mode">none</prop> 

    是auto而不是none! 

    我的配置文件,applicationContext.xml

       
    <?xml version="1.0" encoding="UTF-8"?>
    <beans
    	xmlns="http://www.springframework.org/schema/beans"
    	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    	xmlns:p="http://www.springframework.org/schema/p"
    	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" xmlns:tx="http://www.springframework.org/schema/tx">
     
     <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            <property name="locations"  value="classpath:jdbc.properties">
            </property>
        </bean> 
    
    	<bean id="dataSource"
    		class="org.apache.commons.dbcp.BasicDataSource">
    		<property name="url" value="${jdbc.url}"></property>
    		<property name="username" value="${jdbc.username}"></property>
    		<property name="password" value="${jdbc.password}"></property>
    		<property name="driverClassName" value="${jdbc.driverClassName}"></property>
    
    		<property name="maxActive"> <value>100</value></property>
      		<property name="maxIdle"> <value>30</value> </property>
      		<property name="maxWait"> <value>10000</value> </property>
    	</bean>
    	
    	<bean id="sessionFactory"
    		class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
    		<property name="dataSource">
    			<ref bean="dataSource" />
    		</property>
    		<property name="hibernateProperties">
    			<props>
    				<prop key="hibernate.dialect">
    					org.hibernate.dialect.MySQLDialect
    				</prop>
    				<prop key="hibernate.show_sql">true</prop>
    				<prop key="hibernate.format">true</prop>
    				<prop key="hbm2ddl.auto">create</prop>
    				<prop key="javax.persistence.validation.mode">none</prop> 
    			</props>
    		</property>
    		<property name="mappingResources">
    			<list>
    				<value>com/cn/entity/Department.hbm.xml</value>
    				<value>com/cn/entity/Employee.hbm.xml</value></list>
    		</property></bean>
    	<bean id="transactionManager"
    		class="org.springframework.orm.hibernate4.HibernateTransactionManager">
    		<property name="sessionFactory" ref="sessionFactory" />
    	</bean>
    	<!-- 配置action -->
    	<bean id="employeeAction" class="com.cn.action.EmployeeAction" scope="prototype" >
    	<property name="employeeService" ref="employeeService"></property>
    	<property name="departmentService" ref="departmentService"></property>
    	</bean>
    	
    	<bean id="departmentAction" class="com.cn.action.DepartmentAction" scope="prototype">
    	<property name="departmentService" ref="departmentService"></property>
    	</bean>
    
    		<!-- 配置service -->
    	<bean id="employeeService" class="com.cn.service.EmployeeServiceImpl" scope="prototype">
    		<property name="employeeDao" ref="employeeDao"></property>
    	</bean>
    	
    	<bean id="departmentService" class="com.cn.service.DepartmentServiceImpl" scope="prototype">
    		<property name="departmentDao" ref="departmentDao"></property>
    	</bean>
    	
    	<!-- 配置dao -->
    	<bean id="employeeDao" class="com.cn.dao.EmployeeDaoImpl" scope="prototype">
    		<property name="sessionFactory" ref="sessionFactory"></property>
    	</bean>
    	<bean id="departmentDao" class="com.cn.dao.DepartmentDaoImpl" scope="prototype">
    		<property name="sessionFactory" ref="sessionFactory"></property>
    	</bean>
    	
    	<tx:annotation-driven transaction-manager="transactionManager" /></beans>


    测试成功!


    转载于:https://my.oschina.net/u/1987703/blog/1617521

    展开全文
  • Fits nicely when used in conjunction with Spring's own validation error classes which all implement the MessageSourceResolvable interface . For example , this allows you to iterate ...
  • 出现错误的文件是web.xml 错误是: There is ‘1’ error in ‘javaee_7.xsd’. schema_reference.4: Failed to read schema document ‘platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/xml.xsd’, ...
  • 最新在做项目批量更换部署方式, 把之前的部署方式换成jenkins, 前面七项目都成功换成了CD 自动部署, 为读这个项目报错了,信息...ADMA0010E: Validation error in task Selecting virtual hosts for Web modules. A vir
  • In this example we create a Custom Error Handler while Validating XML against XSD. We use the javax.xml.validation.Validator to check the XML document against the XSD schema. We can create a custom er...
  • WPF开发教程

    万次阅读 多人点赞 2019-07-02 23:13:20
    ------WPF开发教程 目录 WPF基础入门....... 1. WPF基础之体系结构......2. WPF基础之XAML....3. WPF基础之基元素......4. WPF基础之属性系统......5. WPF基础之路由事件......6. WPF基础之布局系统......7. WPF基础之样式设置和模板...
  • 使用Validation自动化校验请求参数

    千次阅读 2019-04-03 18:11:42
    请求参数校验是我们编程经常需要做的事情,但是每次都用if语句去判空会使代码显得很难看,有的小伙伴就使用javax.validation中的注解去校验参数,这样会使代码变得优雅。但是遇到一个问题就是每个接口中去校验参数又...
  • 错误提示: ...警告: Ignored XML validation warning org.xml.sax.SAXParseException; lineNumber: 10; columnNumber: 77; schema_reference.4: 无法读取方案文档 ‘https://www.springframework.org/schem
  • 如果引入dubbo时候,dubbo的标签报错,是因为没有引入dubbo.xsd配置文件:Window --&gt; Preferences --&gt; XML--&gt;XML Catalog制作:dubbo.xsd文件:&lt;?xml version="1.0" encoding...
  • Spring Bean Validation

    千次阅读 2016-10-11 19:45:17
    我们都知道在Spring MVC中要使用Bean Validation验证Controller类中的方法入参可以很轻松的做到,具体可以查相关资料。但是相对于数据层就没有找到优雅的验证方式。不久前看Spring中的扩展Spring的BeanPostProcessor...
  • Bean Validation standardizes constraint definition, declaration and validation for the Java platform. 大体意思是:Bean Validation 标准化了Java平台的约束定义、描述、和验证。   详细了解请参考:...
  • java 使用xsd文件 校验 xml文件

    千次阅读 2016-11-24 16:04:39
    java 使用xsd文件 校验 xml文件
  • Spring Hibernate Validation

    万次阅读 2017-10-17 11:57:07
    数据校验是 Web 应用为了安全必须处理的步骤,Spring MVC 提供了两种方法来对用户的输入数据进行校验,一种是 Spring 自带的 Validation 校验框架,另一种是利用 JRS-303 验证框架进行验证。在实际开发中我们不是...
  • self.validate_xsd_xml(f_xml.strip(),elem_xsd) 66 67 # matching schemaLocation url 68 def get_xsd(self): 69 with open( " ./xsd/multicacheschemas/MCCI_IN200100UV01.xsd " ) as f: 70 elem...
  • 很多情况下我们为了优化XSD文件的可读性和可维护性,以及复用等问题的时候我们需要将schema文件拆分成多个,本文将着重关注于使用多个schema文件验证单一XML文件的问题(注: XML validation for multiple ...
  • 使用xsd文件验证xml

    万次阅读 2016-01-19 17:50:34
    项目中遇到了需要对xml数据进行入库的需求,但是在入库之前需要利用xsd文件对xml的合法性进行验证。 在网上找代码,找到了 leizhimin 的BLOG ,将其整理。感谢博主分享代码。 代码: import java.io.File; ...
  • xml文件的xsd验证失败信息

    千次阅读 2016-03-02 17:22:27
    xml错误提示: Multiple annotations found at this ...- Referenced file contains errors (http://www.springframework.org/schema/beans/spring-beans-3.0.xsd). For more  information, right click on the mes
  • Bean Validation

    千次阅读 2018-01-15 14:59:18
    Bean Validation简介 Bean Validation的特点 Bean Validation的配置 Bean Validation的用法 最简单的用法 自定义错误提示信息 在方法上面添加注解 资源链接 Bean Validation 官网地址: Bean Validation...
  • springboot使用注解参数校验 javax.validation 和 hibernate-validator1. 请求参数校验概述1.1 业务需求概述1.2 常见注解说明2. 参数校验验证2.1 引入依赖2.2 代码实现2.2 实现验证 1. 请求参数校验概述 1.1 业务...
  • Java类属性字段校验(validation的使用)1、需求来源:日常校验需求2、validation介绍2-1、常见的注解2-2、快速入门1、简单校验2、自定义校验注解3、通用的Validtor校验工具类 1、需求来源:日常校验需求 日常开发中...
  • [WARN ](SimpleSaxErrorHandler.java:47) - 2018-10-26 15:04:12,240 Ignored XML validation warning org.xml.sax.SAXParseException; lineNumber: 10; columnNumber: 80; schema_reference.4: Failed to read sche...
  • XML与XSD两兄弟

    2019-03-06 16:37:24
    LOGGER.error("获取本机IP异常!"); } return ips; } private static String convertPath(String path, boolean fix) { if ((path == null) || (path.length() == 0)) { return path; } path = ...
  • 文章目录夯实Spring系列|第十八章:Spring Validation 效验本章说明1.项目环境2.Spring 效验使用场景3.相关接口3.1 Validator 接口设计3.2 Errors 接口设计3.3 Errors 文案来源3.4 示例3.5 结论4.自定义 Validator...
  • XSD检验报文是否符合设计

    千次阅读 2014-11-18 11:18:08
    * @param f_xsd 设计文档 * @param file 报文 * @return false 校验不通过 * @throws Exception */ public static boolean testXmlBySchema(String f_xsd,File file) throws Exception{ DOMPa
  • 用程序生成XSD模式.

    2019-10-08 23:37:14
    Schema Validation Failed. " );  MessageBox.Show(args.Message);  }   生成的XSD为: xml version = " 1.0 " ?> < xs:schema xmlns:xs = " http://www.w3.org/2001/XMLSchema " >   < xs:element name = ...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 7,045
精华内容 2,818
关键字:

errorvalidationxsd