在进行安全配置realm时,我直接在tomcat config文件夹下的server.xml里加入如下配置: <Realm className="org.apache.catalina.realm.JNDIRealm"