【发布时间】:2021-06-10 10:53:18
【问题描述】:
我正在尝试使用 WLST 在线模式脚本添加一个新的自定义身份验证提供程序,但尽管我可以在 WL 控制台上看到我的提供程序,但我得到了一个找不到类的异常。
情况是这样的:
- 我有一个 JAR 文件,它包含一个自定义 WebLogic 身份验证提供程序。
- JAR 被复制到
user_projects/domains/$DOMAIN_NAME/lib/目录下。 - 我可以在 WL 控制台上看到自定义身份验证提供程序,出现在列表中:
Home > Security Realms > myrealm > Providers > new> Type - 我可以通过 WL 控制台手动添加此自定义提供程序。
但是我需要自动化这一步,所以我为此创建了一个 WLST 脚本。 WLST 的相关部分是这样的:
# add a new authentication provider with name of MyCustomAuthProvider
cd('/SecurityConfiguration/' + _domainName + '/Realms/myrealm')
cmo.createAuthenticationProvider('MyCustomAuthProvider', 'aa.bb.cc.MyCustomAuthProvider')
cd('/SecurityConfiguration/' + _domainName + '/Realms/myrealm/AuthenticationProviders/MyCustomAuthProvider')
cmo.setControlFlag('OPTIONAL')
# reorder authentication providers
...
但是这个 WLST 会抛出以下异常:
java.lang.RuntimeException: java.lang.RuntimeException: java.lang.ClassNotFoundException: aa.bb.cc.MyCustomAuthProvider
所以我仔细检查了 WL 是否看到我的自定义身份验证提供程序:
wls:/offline> connect('weblogic', 'weblogic12', 't3://localhost:7001')
cd('/SecurityConfiguration/myDomain/Realms/myrealm')
ls()
我得到的名单和我预期的完全一样:我的班级在名单上。这就是我可以使用 Web 控制台添加它的原因。
这是 AuthenticationProviderTypes 的值:
java.lang.String[com.bea.security.saml2.providers.SAML2IdentityAsserter,
aa.bb.cc.MyCustomAuthProvider,
eblogic.security.providers.authentication.ActiveDirectoryAuthenticator,
weblogic.security.providers.authentication.CustomDBMSAuthenticator,
eblogic.security.providers.authentication.DefaultAuthenticator,
weblogic.security.providers.authentication.DefaultIdentityAsserter,
eblogic.security.providers.authentication.IPlanetAuthenticator,
weblogic.security.providers.authentication.LDAPAuthenticator,
weblogic.security.providers.authentication.LDAPX509IdentityAsserter,
weblogic.security.providers.authentication.NegotiateIdentityAsserter,
weblogic.security.providers.authentication.NovellAuthenticator,
weblogic.security.providers.authentication.OpenLDAPAuthenticator,
weblogic.security.providers.authentication.OracleIdentityCloudIntegrator,
weblogic.security.providers.authentication.OracleInternetDirectoryAuthenticator,
weblogic.security.providers.authentication.OracleUnifiedDirectoryAuthenticator,
weblogic.security.providers.authentication.OracleVirtualDirectoryAuthenticator,
weblogic.security.providers.authentication.ReadOnlySQLAuthenticator,
weblogic.security.providers.authentication.SQLAuthenticator,
weblogic.security.providers.authentication.VirtualUserAuthenticator,
weblogic.security.providers.saml.SAMLAuthenticator,
weblogic.security.providers.saml.SAMLIdentityAsserterV2]
一切看起来都很完美。但是为什么 WLST 在尝试创建它时会抛出 class not found 异常呢?
这太疯狂了。
我已经用谷歌搜索过这个问题,但我发现的只是相同的问题而没有解决方案。
我错过了什么?
【问题讨论】:
-
您的 JAR 文件必须添加到 WLST 的类路径中。 $DOMAIN_HOME/lib 由服务器启动脚本使用,而不是与 WLST 一起使用。
-
JAR 在服务器类路径上。否则,我的自定义安全提供程序不会出现在 WL 控制台上。
-
但是,如果我错了,请纠正我!
-
服务器类路径不是 wlst 类路径。服务器类路径中的库,因此控制台能够部署您的自定义安全提供程序。如果要使用 WLST 执行此操作,则必须更新 WLST 脚本并更新类路径。
标签: java weblogic weblogic12c wlst