java.lang.illegalargumentexception: when allowcredentials is true, allowedorigins cannot contain the special value "*" since that cannot be set on the "access-control-allow-origin" response header. to allow credentials to a set of origins, list them expli
时间: 2023-06-05 14:47:04 浏览: 1145
citly or consider using "allowedoriginpatterns" instead.
这是一个Java异常,意思是当设置allowcredentials为true时,allowedorigins不能包含特殊值“*”,因为这个值不能被设置在“access-control-allow-origin”响应头中。如果要允许一组来源的凭据,需要明确列出它们,或者考虑使用“allowedoriginpatterns”代替。
相关问题
servlet.service() for servlet [dispatcherservlet] in context with path [] threw exception [request processing failed; nested exception is java.lang.illegalargumentexception: when allowcredentials is true, allowedorigins cannot contain the special value "*" since that cannot be set on the "access-control-allow-origin" response header. to allow credentials to a set of origins, list them explicitly or consider using "allowedoriginpatterns" instead.] with root cause
这个异常是因为跨域请求中配置了allowCredentials为true,在指定的allowedOrigins中不能包含特殊值“*”,因为response header中的"access-control-allow-origin"不能设置为“*”。如果要允许一组地址访问需要显式地列出它们,或者考虑使用allowedOriginPatterns替代。
java.lang.IllegalArgumentException: value cannot be null
java.lang.IllegalArgumentException是Java中的一个异常类,表示传递给方法的参数不合法。其中,value cannot be null表示传递给方法的参数值为null,而该参数值不能为空。
当方法需要一个非null值作为参数,但实际传递的参数值为null时,就会抛出该异常。例如,下面的代码中,如果传递的参数为null,则会抛出java.lang.IllegalArgumentException异常。
```
public void doSomething(String str) {
if (str == null) {
throw new IllegalArgumentException("value cannot be null");
}
// do something...
}
```