我正在尝试使用 WLST 在线模式脚本添加新的自定义身份验证提供程序,但尽管我可以在 WL 控制台上看到我的提供程序,但我收到了未找到类的异常。
情况是这样的:
user_projects/domains/$DOMAIN_NAME/lib/
目录下。Home > Security Realms > myrealm > Providers > new> Type
但我需要自动执行此步骤,因此我为此创建了一个 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
异常呢?
这太疯狂了。
我已经用谷歌搜索过这个问题,但只有我发现的相同问题没有解决方案。
我错过了什么?
在某些时候,oracle 已从使用
CLASSPATH
更改为 WLST_EXT_CLASSPATH
来设置 WLST 的类路径。 Oracle 似乎并没有很好地证明这是正确使用的环境变量。我通过挖掘 wlst.sh 调用的各种 sh 脚本找到了它,但是 12c 的 this 文档引用了它,但似乎是唯一提到它的地方。
我已经使用 14.1.1 和 DOMAIN/lib/mbeantypes 目录中的自定义提供程序对此进行了测试,它可以工作(即,只要我先设置 WLST_EXT_CLASSPATH,我就可以使用 WLST 来配置自定义安全提供程序),但没有12c 来测试它是否在那里工作。
我将 JAR 添加到 WLST 类路径,但这没有帮助。
CLASSPATH
变量,因为 wlst.sh
在后台执行 java 命令,因此必须考虑此标准变量。没成功。-cp
JVM 参数添加到启动 WlST 的 java 命令中。没成功。对我有用的唯一解决方法是:
$ORACLE_HOME/user_projects/domains/$DOMAIN_NAME/lib/
目录下$ORACLE_HOME/wlserver/server/lib/mbeantypes/
第二个副本解决了WLST抛出的
class not found issue
。
如果你知道更好、更标准的方法,请告诉我。