How do I create MBean for the custom authenticator/authorizer to set it in the
realm?
The sample providers have a weblogic.Admin script for modifying providers.
I will ask around if anyone has some java equivalents.
I couldn't find anything suitable for a sample. The console does some of
this, but it is much more generic and not suitable for an example. The
console works like this.
1) get attribute name
2) get attribute value (in this case it sounds like an object name, or
perhaps an array of object names
3) get object name of the mbean who's attributes you wish to change
4) get a reference to an mbean server
5) call a setAttribute on the mbean
String name1 = realmName + "1DefaultAuthenticator";
homeServer.createMBean("weblogic.security.providers.authentication.DefaultAuthenticatorMBean",
new ObjectName("Security:Name=" + name1));
Caught Exception javax.management.NotCompliantMBeanException: The MBean must be
have a concrete class
so, I changed the code to
homeServer.createMBean("weblogic.security.providers.authentication.DefaultAuthenticatorImpl",
new ObjectName("Security:Name=" + name1));
I get the error message as
Caught Exception javax.management.NotCompliantMBeanException: weblogic.security.providers.authentication.DefaultAuthenticatorImpl
does not implement the weblogic.security.providers.authentication.DefaultAuthenticatorImplMBean
interface or the DynamicMBean interface
I even tried
homeServer.createMBean("weblogic.security.providers.authentication.DefaultAuthenticator"
, new ObjectName("Security:Name=" + name1));
Caught ReflectionException javax.management.ReflectionException: The MBean class
could not be loaded by the default loader repository
cause = null
actual exception = java.lang.ClassNotFoundException: weblogic.security.providers.authentication.DefaultAuthenticator
Anyone out there knows how to instantiate the MBean for the provider so that I
can call setAuthenticators method on the realm to set the desired authenticators.
Any prompt help is greatly appreciated.
thanks
I get a java.lang.ClassCastException or
java.lang.ClassCastException: java.lang.NoClassDefFoundError.
Looks like a class loader issue.
I am trying to configure the providers from a client program (no EJBs involved
here). How do I resolve this.
####<Feb 11, 2004 10:42:14 AM PST> <Notice> <WebLogicServer> <man> <myserver>
<main> <<WLS Kernel>> <> <BEA-000360> <Server s
tarted in RUNNING mode>
####<Feb 11, 2004 10:42:14 AM PST> <Notice> <WebLogicServer> <xman> <myserver>
<ListenThread.Default> <<WLS Kernel>> <> <BEA-0
00355> <Thread "ListenThread.Default" listening on port 7001, ip address *.*>
####<Feb 11, 2004 10:46:52 AM PST> <Warning> <RMI> <xman> <myserver> <ExecuteThread:
'1' for queue: 'weblogic.admin.RMI'> <<WL
S Kernel>> <> <BEA-080003> <RuntimeException thrown by rmi server: weblogic.management.internal.RemoteMBeanServerImpl.invoke(L
javax.management.ObjectName;Ljava.lang.String;[Ljava.lang.Object;[Ljava.lang.String;)
javax.management.RuntimeOperationsException: RuntimeException thrown by the invoke
method of the Dynamic MBean.
java.lang.ClassCastException
at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:1166)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
at weblogic.management.internal.RemoteMBeanServerImpl.invoke(RemoteMBeanServerImpl.java:765)
at weblogic.management.internal.RemoteMBeanServerImpl_WLSkel.invoke(Unknown
Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:466)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:409)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:353)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:404)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
--------------- nested within: ------------------
javax.management.RuntimeOperationsException: RuntimeException thrown by the invoke
method of the Dynamic MBean
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1559)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
at weblogic.management.internal.RemoteMBeanServerImpl.invoke(RemoteMBeanServerImpl.java:765)
at weblogic.management.internal.RemoteMBeanServerImpl_WLSkel.invoke(Unknown
Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:466)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:409)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:353)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:404)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
>
####<Feb 11, 2004 10:56:35 AM PST> <Warning> <RMI> <man> <myserver> <ExecuteThread:
'2' for queue: 'weblogic.admin.RMI'> <<WL
S Kernel>> <> <BEA-080003> <RuntimeException thrown by rmi server: weblogic.management.internal.RemoteMBeanServerImpl.invoke(L
javax.management.ObjectName;Ljava.lang.String;[Ljava.lang.Object;[Ljava.lang.String;)
javax.management.RuntimeOperationsException: RuntimeException thrown by the invoke
method of the Dynamic MBean.
java.lang.ClassCastException: java.lang.NoClassDefFoundError
at javax.management.modelmbean.RequiredModelMBean.invoke(RequiredModelMBean.java:1166)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1557)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
at weblogic.management.internal.RemoteMBeanServerImpl.invoke(RemoteMBeanServerImpl.java:765)
at weblogic.management.internal.RemoteMBeanServerImpl_WLSkel.invoke(Unknown
Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:466)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:409)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:353)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:404)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
--------------- nested within: ------------------
javax.management.RuntimeOperationsException: RuntimeException thrown by the invoke
method of the Dynamic MBean
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1559)
at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1525)
at weblogic.management.internal.RemoteMBeanServerImpl.invoke(RemoteMBeanServerImpl.java:765)
at weblogic.management.internal.RemoteMBeanServerImpl_WLSkel.invoke(Unknown
Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:466)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:409)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:353)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:404)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
>
----------------------------------------------------------------------------------------------------
>import weblogic.management.*;
>
>import weblogic.management.configuration.*;
>
>import weblogic.management.commo.*;
>import javax.management.*;
>
>//import java.util.Set;
>//import java.util.Iterator;
>
>import weblogic.management.WebLogicMBean;
>import weblogic.management.WebLogicObjectName;
>import javax.management.MBeanInfo;
>import javax.management.ObjectName;
>
>public class SimpleSecurityClient
>{
>
> public static void main(String[] args)
> {
> try {
> // change these to suit u'r environment...
> CommoMBeanServer mbs = Config.getMBeanServer("myserver","t3://localhost:7001",
>"system","gumby1234");
> // create your default authenticator instance
> ObjectInstance oi = mbs.createMBean(Commo.getTypeObjectName("weblogic.security.providers.authentication.DefaultAuthenticator"),
>
> new ObjectName("Security:Name=myrealm1DefaultAuthenticator"));
> // you can use straight JMX to set other attributes or use the
>CommoServer to get the stubs
> // using commo server
> weblogic.security.providers.authentication.DefaultAuthenticatorMBean
>bean =
> (weblogic.security.providers.authentication.DefaultAuthenticatorMBean)
>mbs.getMBean(oi.getObjectName());
> // now call the methods on this bean ...
> // bean.setControlFlag("REQUIRED");
>
> // using staright JMX
> mbs.setAttribute(oi.getObjectName(), new Attribute("ControlFlag","REQUIRED"));
>
> // thats it u r done!
>
>
> } catch (Exception e) {
> e.printStackTrace();
> }
>
>
> }
>}
>