异常 | access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")

异常提示:

SEVERE: Context initialization failedorg.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'dataSource' defined in class path resource [applicationContext.xml]: access denied ("java.lang.RuntimePermission" "accessDeclaredMembers")

解决方法:

  • 1 找到工程所用jar包的位置
  • 2 在目录下的security文件夹下找到java.policy文件:
  • 3 打开文件,在permission java.lang.RuntimePermission "accessDeclaredMembers"; 后面添加
permission java.lang.RuntimePermission "createClassLoader"; 
permission java.lang.RuntimePermission "getClassLoader"; 
permission java.lang.RuntimePermission "accessDeclaredMembers";
  • 4 保存。

你可能感兴趣的:(异常,Java)