WebLogic启动失败报‘Authentication denied’及EJB部署异常求助
问题描述
- 为解决「未指定连接字符串」运行时错误修改数据源配置后,触发EJB部署错误:
Unable to deploy EJB: MailService from wps.jar: The run-as security principal, 'portaladmin', chosen for the EJB 'MailService(Application: my-application, EJBComponent: wps.jar)' is not a valid user principal in the current security realm. Please specify a valid user principal for the EJB to use. - 参考方案停止受管服务器并清理相关文件夹后,所有服务器(含AdminServer)启动均报身份验证错误,仅NodeManager正常运行:
weblogic.security.SecurityInitializationException: Authentication denied: Boot identity not valid; The user name and/or password from the boot identity file (boot.properties) is not valid. The boot identity may have been changed since the boot identity file was created. Please edit and update the boot identity file with the proper values of username and password. The first time the updated boot identity file is used to start the server, these new values are encrypted - 已尝试的无效操作:删除
servers/MyServer/data/ldap与servers/MyServer/security/boot.properties、重置管理员账号密码、手动输入账号启动、回滚数据源配置。 - 约束要求:避免重新部署环境、需保留服务器运行状态(无法重启整个环境)、必须使用
boot.properties后台启动WebLogic进程。
解决方案
1. 彻底清除域安全缓存并重建管理员身份
首先解决AdminServer的启动问题,这是后续操作的核心前提:
- 强制终止所有WebLogic服务器进程(包括无法正常启动的AdminServer和受管服务器),确保无残留进程占用文件。
- 删除域级安全密钥文件:
$DOMAIN_HOME/security/SerializedSystemIni.dat - 删除所有服务器的LDAP缓存目录:
rm -rf $DOMAIN_HOME/servers/AdminServer/data/ldap rm -rf $DOMAIN_HOME/servers/MyServer/data/ldap - 重新生成管理员账号,执行以下命令:
替换cd $DOMAIN_HOME/bin . ./setDomainEnv.sh cd ../security java weblogic.security.utils.AdminAccount admin@example.com your_secure_password .admin@example.com和your_secure_password为你要设置的合法账号密码。
2. 配置AdminServer的boot.properties
- 进入AdminServer的安全目录:
mkdir -p $DOMAIN_HOME/servers/AdminServer/security cd $DOMAIN_HOME/servers/AdminServer/security - 创建
boot.properties文件,写入明文账号密码(首次启动后会自动加密):username=admin@example.com password=your_secure_password - 启动AdminServer,确认能正常启动并登录控制台。
3. 修复EJB的run-as安全主体配置
AdminServer启动正常后,登录WebLogic控制台:
- 定位到
my-application应用,找到MailServiceEJB的配置页面。 - 修改「Run As安全主体」为当前安全域中存在的有效用户(比如刚创建的管理员账号,或域内已验证的合法用户)。
- 若该EJB无需run-as权限,可直接移除run-as配置项。
- 重新部署
my-application应用,确认EJB部署错误消除。
4. 配置受管服务器的boot.properties并启动
- 进入受管服务器的安全目录:
mkdir -p $DOMAIN_HOME/servers/MyServer/security cd $DOMAIN_HOME/servers/MyServer/security - 创建
boot.properties文件,写入与AdminServer一致的管理员账号密码(或受管服务器专属启动账号,需确保在安全域中有效):username=admin@example.com password=your_secure_password - 通过AdminServer控制台或NodeManager启动受管服务器,确认启动正常且无身份验证错误。
关键注意事项
- 操作前务必备份
$DOMAIN_HOME/security目录和所有服务器的servers/<server_name>/security目录,防止数据丢失。 - 确保所有服务器进程完全终止,避免文件被锁定导致操作失败。
- 若使用NodeManager,需确保NodeManager的账号配置与域管理员账号一致,或在启动时指定正确的启动凭据。
内容的提问来源于stack exchange,提问作者Marco Frag Delle Monache
相关产品推荐
相关产品推荐

