In springMVC, bindingResult reports java.lang.NullPointerException?

problem description

deployment projects an and bjord tomcat under tomcat deploy a first, then b.
two projects are logged in using login in LoginController respectively. Xtuser uses @ Validated to verify the parameter userid passed in the front end. A project can be verified, and bindingResult reports an error when b project is verified: Property "userId" threw exception; nested exception is java.lang.NullPointerException;

.

but if you deploy the b project separately, there is nothing wrong with the verification, so ask for advice.

related codes

/ / LoginController.java

@RequestMapping(value="/login", method = RequestMethod.GET)
public void login(    @Validated({IXtLoginGroup.class}) XtUser xtUser,BindingResult bindingResult
                    ,@RequestParam(value ="token_index", required = true)String token_index
                    , HttpServletRequest request,HttpServletResponse response) throws Exception {
    if(bindingResult.hasFieldErrors()){
        String messageStr=ExceptionMessager.extractMessagesFromExceptionList(bindingResult);
        try {
            Map map=new HashMap();
            map.put("code", 0);//10
            map.put("message", "fault");
            Map childMap=new HashMap();
            childMap.put("title", "");
            childMap.put("errorMsg",messageStr);
            map.put("data",childMap);
            System.out.println( JsonTool.Obj2Json(map));
            ResponseUtil.write(response, JsonTool.Obj2Json(map));
            return;
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

/ / XtUser.java

public class XtUser implements java.io.Serializable {
    
    private static final long serialVersionUID = 1L;
    
    @NotEmpty(message="{notNull}",groups={IXtUserGroup.class,IXtLoginGroup.class})
    private String userId;

}

/ / spring related configuration

<!--   --> 
<mvc:annotation-driven validator="validator" conversion-service="conversion-service" />

<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
    <property name="providerClass"  value="org.hibernate.validator.HibernateValidator"/>
    <!--classpath ValidationMessages.properties -->
    <property name="validationMessageSource" ref="validatemessageSource"/>
</bean>
<bean id="conversion-service" class="org.springframework.format.support.FormattingConversionServiceFactoryBean" />
<bean id="validatemessageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">  
    <property name="basename" value="classpath:validatemessages"/>  
    <!-- <property name="useCodeAsDefaultMessage" value="true" /> -->
    <property name="defaultEncoding" value="utf-8" /> 
    <property name="cacheSeconds" value="120"/>  
</bean>
May.05,2022

public void setUserId(String userId) throws Exception {
    this.userId = userId;
    //userIdcontroller
    
    this.userId_encoded=SM2Util.encrypt(userId);
    System.out.println("***********"+userId);
    //this.userId_encoded=userId;
}

because SM2Util mistakenly uses static blocks to generate public and private keys, the public and private keys in project b are empty, and the SM2Util.encrypt () method under setUserId in entity is not completed successfully, resulting in a data binding error!

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e53619-4476f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e53619-4476f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?