How to prepend or append classpath using weblogic.Admin or WLST

When I call weblogic.Admin or WLST, is there any way to append or prepend to the existing classpath?
Currently I am calling weblogic.Admin with the following argument:
set -mbean base_domain:Name=base-server,Server=base-server,Type=ServerStart -property ClassPath "C:\test\test.jar"
But this overwrite the Server classpath with the new entry.
I want to keep the existing entries as it is and add the new one. Is it possible with Weblogic 8.1 or Weblogic 9.1

fyi
A tricky SQL statement issue was fixed in the example application
at http://www.consideringred.com/files/oracle/2011/SQLAuthenticatorApp-v0.03.zip
So, it allows for the setup of a SQLAuthenticator (see README.txt for details), but in short : run Ant target "wlst.create-domain" (possibly preceded by Ant target "delete.domain-dir"), Ant target "create.wls-start-stop-bat-files", run wls-start.bat, setup tables TS_USER, TS_GROUP and TS_GROUPMEMBER, Ant target "wlst.create-datasource", Ant target "wlst.create-authentication-provider", run wls-stop.bat, run wls-start.bat, Ant target "wlst.create-user", Ant target "wlst.create-group.sqla-groupname", Ant target "wlst.add-user-member-to-group", deploy SQLAuthenticatorApp (using JDeveloper or otherwise), try http://localhost:7001/sqlauthenticatorweb , try to authenticate using tsusertwo/welcome1
Several Ant targets calling OPSS MBeans API were added (e.g. "wlst.opss.printmembersforallapplicationroles"), to review adding a SQLAuthenticator group as member to an application role, resulting in the forum thread "OPSS : addMembersToApplicationRole : The search for role failed"
at OPSS : addMembersToApplicationRole : The search for role failed
So, suggestions to resolve that grant application role issue are welcome in that forum thread.
regards
Jan

Similar Messages

  • How to use weblogic.Admin to set JMS ErrorDestination property on WLS 7?

    This thread is talking about using weblogic.Admin to set the ErrorDestination property.
              http://forums.bea.com/bea/thread.jspa?threadID=200036378&messageID=202187327&start=0
              We run the script against the WLS 7.0 server, script get 'OK' result but it didn't work (property wasn't set). Some error is reported in the admin.log on the server.
              We also run the scipt against the WLS 8 server. It worked perfectly.
              Does anyone know whether this works at all on WLS 7?

    The reason we are using weblogic.Admin is that we are using conf2admin to generate the scripts. weblogic.Admin seems to be the only option for WLS7. Thanks for your suggestion and will definitely check out WLST.
              The full error message is:
              ####<Aug 27, 2004 8:55:20 AM NZST> <Emergency> <Management> <rbd1> <admin> <ExecuteThread: '9' for queue: '__weblogic_admin_rmi_queue'> <kernel identity> <> <141067> <The value n204162:JMSServer=LAS2JMSServer,Name=FailedQueue,Type=JMSQueue specified for the ErrorDestination attribute is not valid. MBean: n204162:JMSServer=LAS2JMSServer,Name=FundingQueue,Type=JMSQueue. Method: setAttributes. Exception: javax.management.InvalidAttributeValueException: BeanShell Interpreter threw exception while evaluating (((value == void)?(true):(weblogic.management.configuration.JMSLegalHelper.legalErrorDestination(self, value)))) on value n204162:JMSServer=LAS2JMSServer,Name=FailedQueue,Type=JMSQueue, getLegalCheck() for attribute ErrorDestination of MBean "n204162:JMSServer=LAS2JMSServer,Name=FundingQueue,Type=JMSQueue", Sourced file: <Inline eval of: ((value == void)?(true):(weblogic.management.configuration.JMSLegalHelper.legalErrorDestination(self, value))); > : Method Invocation weblogic.management.configuration.JMSLegalHelper.legalErrorDestination : at Line: 1 : in file: <Inline eval of: ((value == void)?(true):(weblogic.management.configuration.JMSLegalHelper.legalErrorDestination(self, value))); > : weblogic .management .configuration .JMSLegalHelper .legalErrorDestination ( self , value )
              Target exception: java.lang.NullPointerException
              .>
              javax.management.InvalidAttributeValueException: BeanShell Interpreter threw exception while evaluating (((value == void)?(true):(weblogic.management.configuration.JMSLegalHelper.legalErrorDestination(self, value)))) on value n204162:JMSServer=LAS2JMSServer,Name=FailedQueue,Type=JMSQueue, getLegalCheck() for attribute ErrorDestination of MBean "n204162:JMSServer=LAS2JMSServer,Name=FundingQueue,Type=JMSQueue", Sourced file: <Inline eval of: ((value == void)?(true):(weblogic.management.configuration.JMSLegalHelper.legalErrorDestination(self, value))); > : Method Invocation weblogic.management.configuration.JMSLegalHelper.legalErrorDestination : at Line: 1 : in file: <Inline eval of: ((value == void)?(true):(weblogic.management.configuration.JMSLegalHelper.legalErrorDestination(self, value))); > : weblogic .management .configuration .JMSLegalHelper .legalErrorDestination ( self , value )
              Target exception: java.lang.NullPointerException
                   at weblogic.management.internal.DynamicMBeanImpl.checkAttributeValueIsLegal(DynamicMBeanImpl.java:1517)
                   at weblogic.management.internal.DynamicMBeanImpl.prepareForModification(DynamicMBeanImpl.java:1440)
                   at weblogic.management.internal.DynamicMBeanImpl.setAttribute(DynamicMBeanImpl.java:1004)
                   at weblogic.management.internal.ConfigurationMBeanImpl.setAttribute(ConfigurationMBeanImpl.java:353)
                   at weblogic.management.internal.DynamicMBeanImpl.setAttributes(DynamicMBeanImpl.java:827)
                   at com.sun.management.jmx.MBeanServerImpl.setAttributes(MBeanServerImpl.java:1475)
                   at weblogic.management.internal.RemoteMBeanServerImpl.setAttributes(RemoteMBeanServerImpl.java:905)
                   at weblogic.management.internal.RemoteMBeanServerImpl_WLSkel.invoke(Unknown Source)
                   at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:362)
                   at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:313)
                   at weblogic.security.service.SecurityServiceManager.runAs(SecurityServiceManager.java:785)
                   at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:308)
                   at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
                   at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:153)
                   at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:134)

  • Using weblogic.Admin utility with Weblogic 10.0

    I am trying to write a script which perform PING server to ensure weblogic servers are up before moving on to start another server (the script starts all managed and admin servers), i used to be able to PING server on weblogic 8.1 using weblogic.Admin utility but on weblogic 10.3 i am getting the following exception:
    java.lang.NoClassDefFoundError: weblogic/transaction/internal/TransactionHelperImpl
    at weblogic.jndi.spi.EnvironmentManager$DefaultFactoryMaker.<clinit>(EnvironmentManager.java:26)
    at weblogic.jndi.spi.EnvironmentManager.getInstance(EnvironmentManager.java:48)
    at weblogic.jndi.Environment.getContext(Environment.java:307)
    at weblogic.jndi.Environment.getContext(Environment.java:277)
    at weblogic.jndi.Environment.createInitialContext(Environment.java:200)
    at weblogic.jndi.Environment.getInitialContext(Environment.java:184)
    at weblogic.jndi.Environment.getInitialContext(Environment.java:162)
    at weblogic.management.commandline.tools.AdminToolHelper.getMBeanHome(AdminToolHelper.java:559)
    at weblogic.management.commandline.tools.ServerInfoCommandLineInvoker.doCommandline(ServerInfoCommandLineInvoker.java:920)
    at weblogic.management.commandline.tools.ServerInfoCommandLineInvoker.<init>(ServerInfoCommandLineInvoker.java:116)
    at weblogic.management.commandline.AdminMain.main(AdminMain.java:132)
    at weblogic.Admin.useAdminMain(Admin.java:43)
    at weblogic.Admin.main(Admin.java:22)
    java.lang.NoClassDefFoundError: weblogic/transaction/internal/TransactionHelperImpl
    at weblogic.jndi.spi.EnvironmentManager$DefaultFactoryMaker.<clinit>(EnvironmentManager.java:26)
    at weblogic.jndi.spi.EnvironmentManager.getInstance(EnvironmentManager.java:48)
    at weblogic.jndi.Environment.getContext(Environment.java:307)
    at weblogic.jndi.Environment.getContext(Environment.java:277)
    at weblogic.jndi.Environment.createInitialContext(Environment.java:200)
    at weblogic.jndi.Environment.getInitialContext(Environment.java:184)
    at weblogic.jndi.Environment.getInitialContext(Environment.java:162)
    at weblogic.management.commandline.tools.AdminToolHelper.getMBeanHome(AdminToolHelper.java:559)
    at weblogic.management.commandline.tools.ServerInfoCommandLineInvoker.doCommandline(ServerInfoCommandLineInvoker.java:920)
    at weblogic.management.commandline.tools.ServerInfoCommandLineInvoker.<init>(ServerInfoCommandLineInvoker.java:116)
    at weblogic.management.commandline.AdminMain.main(AdminMain.java:132)
    at weblogic.Admin.useAdminMain(Admin.java:43)
    at weblogic.Admin.main(Admin.java:22)
    The Classpath i am using:
    /ascddata3/olcppads-dev01/weblogic10/server/lib/weblogic.jar:/ascddata3/olcppads-dev01/weblogic10/user_projects/autosc_pss/lib:/ascddata3/olcppads-dev01/weblogic10/server/lib/xmlx.jar:/ascddata3/olcppads-dev01/weblogic10/server/lib/wls-api.jar:/ascddata3/olcppads-dev01/weblogic10/server/lib/wlclient.jar:/ascddata3/olcppads-dev01/weblogic10/server/lib/wljmsclient.jar
    The command i am using is:
    java weblogic.Admin -url ins2d.med.ge.com:9010 -username USERNAME -password PASSWORD PING -verbose
    In weblogic 8.1 the class weblogic/transaction/internal/TransactionHelperImpl used to be present in wljtaclient.jar but i can't locate the class anywhere in weblogic 10.3/server/lib. Kindly let me know how to use weblogic.Admin utility on weblogic 10.3

    Hi,
    First I ran the setDomainEnv.cmd script to set the environment and then executed the weblogic.Admin command and it worked for me.
    D:\wls103\user_projects\domains\816532Local>java weblogic.Admin -adminurl t3://localhost:7010 -username weblogic -password weblogic PING
    Sending 1 ping of 100 bytes.
    RTT = ~16 milliseconds, or ~16 milliseconds/packet
    D:\wls103\user_projects\domains\816532Local>
    Regards.

  • Unable to start Admin server by using weblogic.admin utility

    Hi,
    I stoped the admin server by using weblogic.admin utility command as bellow.
    java weblogic.Admin -url http://server1:8008 -username adminuser -password weblogic SHUTDOWN myserver
    It stopped successfully. But while starting as below i am getting error. Kindly help me out.
    java weblogic.Admin -url http://172.27.72.70:8008 -username adminuser -password weblogic START myserver
    <Warning> <Net> <BEA-000905> <Could not open connection with host: server1 and port: 8008.>
    Failed to connect to http://172.27.72.70:8008: Destination unreachable; nested exception is:
    java.net.ConnectException: Tried all: '1' addresses, but could not connect over HTTP to server: 'star', port: '8008'; No available router to destination
    Any suggestion is appreciated.
    Thanks,

    Hi,
    Thanks for your reply.
    Yes, Node Manager has configured on Managed Server's host machine.
    So can't we start admin server by using weblogic.admin utility if admin server is stopped?
    Thanks,

  • Can't add JMS topics using weblogic.Admin

    I have seen a similar problem being mentioned before on this board, except it occurred more directly through management APIs. I'm working with Weblogic 6.1, and trying to create a JMSTopic from command-line using weblogic.Admin
    First I create a JMSServer (using CREATE operation) and set its Targets attribute (using SET). Then I create a JMSTopic (again, using CREATE) and set its JNDIName attribute (again, using SET). All of this works fine, and I see the new JMSServer in the console correctly targeting the right server, and I see both the JMSServer and JMSTarget entries in the config.xml of my domain.
    Now, I try to add the topic under the server using addDestination method (through weblogic.Admin operation INVOKE). addDestination returns "false" with no further explanation or exceptions. If I try to go through the SET operation and target the Destinations property of JMSServer, again I get a silent failure with no further info.
    Is this a bug? Has someone ever succeeded in doing this before? Any Ideas?
    Thanks!
    -Boris

    I'm replying to my own message because a kind soul gave me the solution. Apparently
    it's not documented (or at least not well enough that I could find it), so I'm reiterating
    it for the benefit of others.
    In order to register a JMSTopic (or a JMSQueue) under a JMSServer, you do not use
    the addDestination or setDestinations methods on the JMSServer. Instead, you set
    the (un-exposed) Parent property on the topic or queue MBean. For example, if I
    had created a JMSServer MyJmsServer and a JMSTopic MyJmsTopic, I would need to issue
    the following command:
    weblogic.admin <usual url/username/password stuff> SET -mbean "mydomain:Name=MyJmsTopic,Type=JMSTopic"
    -property Parent "mydomain:Name=MyJmsServer,Type=JMSServer"
    My heartfelt thanks to you, Ajay!

  • How do i set the classpath in weblogic server

    hi,
    i am using weblogic SP2. in my application, i have some jars in the lib directory. currently my application is running fine. but when i add some new jars, it is throwing some exception. i guess that it may be because that in the classpath, these new jars might be before the other jars. how can i view the classpath and change it.
    thanks,
    prashant.

    java.net.URL urldir= new java.net.URL("file://C:/Downloads/");
    java.net.URL[] urlarr= new java.net.URL[1];
    urlarr[0]=urldir;
    java.net.URLClassLoader urlcl= new java.net.URLClassLoader(urlarr); +// Here I get the Error+
    url=urlcl.getResource("/lrp/utils/New.gif");
    *Error: java.security.AccessControlException: access denied (java.lang.RuntimePermission createClassLoader+                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Help !!  how to redeploy only an ejb using weblogic.Deployer ?

    Hi everyone, how to redeploy only one ejb (not the entire application) using weblogic.Deployer ? I executed the following command and getting wiered error !!! :
    java weblogic.Deployer -adminurl http://myadmin:7000 -username system -password weblogic -name myApp.ear -activate -targets testEJB.jar@jytServer -source myApp.ear
    I am getting the following error :
    weblogic.management.ApplicationException:
    [J2EE:160043]Missing deployment descriptor "META-INF/application.xml" at myApp.ear".
    The ear file very much contains the application.xml under META-INF directory and in the application.xml, there is an entry for myBean.jar.
    However if i try the following command, it will redeploy the EJB but it will deploy it as a separate application :
    java weblogic.Deployer -adminurl http://myadmin:10720 -username system -password weblogic -targets jytServer deploy testEJB.jar
    But I want to redeploly it as a part of .ear application.
    I would highly appreicate your help. (assume that admin console access is denied and i will have to use weblogic.Deployer to redeploy).
    thanks,
    jyothi

    Where do I specify the order of deployment? I have 2 EJB jar files and Web module, the order need to be Web module first, 2 EJB then EAR. In WebSphere it is defined in Deployment.xml file, where do I define Deployment.xml in WebLogic

  • How can I mapping directory by using Weblogic Server?

    Hi,
    We used to use iPlant as the web server. How can mapping directory using Weblogic
    server?
    $PATH=$wl_home/config/epdm/applications/DefaultWebApp/WEB-INF/classes
    such as to map the following:
    From To
    /rok/servlet $PATH/servlet-dev/WEB-INF/classes
    /rok/imagest $PATH/servlet-dev/images
    /rok/html $PATH/servlet-dev/htm
    /servlet $PATH/servlet-dev/servlet
    Thanks!
    Hanqing

    Use JMX. See http://dima.dhs.org.
    Peace,
    Cameron Purdy
    Tangosol, Inc.
    Clustering Weblogic? You're either using Coherence, or you should be!
    Download a Tangosol Coherence eval today at http://www.tangosol.com/
    "Nicole" <[email protected]> wrote in message
    news:3c4d6daa$[email protected]..
    >
    Hi all,
    in my EJBs I want to know, on which server instance I´m running. I needthis for
    logging info. How can I get the servers name?
    When I load the JNDI tree and select java:comp, an error occurs and a lotof information
    is printed. One is weblogic.Server and that is what I´m searching for.
    I use WLS 6.1 SP1
    Any ideas? Thanks,
    Nicole

  • Use WebLogic Admin defined role in EJB permission

    Hi all!
    Can someone please tell me how it's possible to:
    - Define a role in WebLogic Admin console and use it in the EJB permissions.
    OR
    - Define custom attributes (like hours of access) to the roles in the xml descriptors.
    thanks in advance,
    Richard

    Hi Slavik
    >Will it always work ?
    What do you mean?
    >Have I made everything to make it work ?
    Yes, it shall work.
    >Is there a way to make the role-group mapping programmatically ?
    In fact the operation belongs to administrative or configuration phase of your App's life cycle. Naturally It's not a developer's responsibility. From other point of view at development time you cannot predict UME roles/groups that will be on J2EE server during application deployment. Developer cannot predict even target J2EE server. Different servers can have own UME roles/groups.
    Still at development time it's possible to design very restricted mapping. There are three constants 'all', 'administrators', 'guests' which you can use in XML descriptors. These constants will be mapped to the corresponding UME roles during deployment.
    BR, Siarhei

  • Creating a Global Role using weblogic.Admin command

    Hi,
    Does anyone have an example of creating a global role using the weblogic.Admin commands? I think I have to use the INVOKE command with the DefaultRoleMapper and createRole method, but I'm not quite sure what the rest of the syntax is.
    Thanks,
    Gabriel

    Gabriel,
    The following works for me:
    weblogic.Admin -url t3://localhost:80 -username weblogic -password weblogic INVOKE -mbean "Security:Name=myrealmDefaultRoleMapper" -method createRole "" "MyGlobalRole" "Grp(Administrators)" ""
    The null first parameter identifies this role as a global role.
    The second param is the name of the role.
    The third parameter is the policy expression. Here, I've mapped the role to the Administrators group. You can also map it to users or a combo of the two. For example, to map it to the "weblogic" user, use "Usr(weblogic)" as the policy expression. If you leave this parameter empty, the role will be created but will not be mapped to anything.
    I'm not sure what the fourth parameter is for. It's not defined in the RoleEditorMBean docs but not including it causes an error. I suspect it's a description field because WLS does not seem to care what you put there.
    HTH,
    Mike

  • Jndi exception using weblogic.Admin

    I was trying out the commands offered by weblogic.Admin to manage the packaged petstore server. I tried the following command and got jndi exception (null):
    command:java weblogic.Admin -url petstoreServer.com:7001 GET -pretty -type Server
    Error:Exception in thread "main" java.lang.IllegalArgumentException: JNDI naming exception: null
    at weblogic.management.commandline.CommandLine.findMBeanHome(CommandLine.java:460)
    at weblogic.management.commandline.CommandLine.doCommandline(CommandLine.java:86)
    at weblogic.management.commandline.CommandLine.<init>(CommandLine.java:69)
    at weblogic.Admin.main(Admin.java:689)
    I checked in the console. A jndi name for petstoreServer does exist.

    The current WebLogic 6.0 Beta-1 documentation incorrectly specifies the following in its example.
    java weblogic.Admin -url xyz.com:7001 GET -pretty -type Server
    This example falsely gives the impression that you must append ".com" to your host name. We will correct the document in the next revision to look like:
    java weblogic.Admin -url hrserver:7001 GET -pretty -type Server
    The -url petstoreServer.com:7001 parameter is incorrect. The command requires you to specify the <HostName>:<PortNumber> for the -url parameter.
    Regards,
    -Sachin
    Helen Semus wrote:
    I was trying out the commands offered by weblogic.Admin to manage the packaged petstore server. I tried the following command and got jndi exception (null):
    command:java weblogic.Admin -url petstoreServer.com:7001 GET -pretty -type Server
    Error:Exception in thread "main" java.lang.IllegalArgumentException: JNDI naming exception: null
    at weblogic.management.commandline.CommandLine.findMBeanHome(CommandLine.java:460)
    at weblogic.management.commandline.CommandLine.doCommandline(CommandLine.java:86)
    at weblogic.management.commandline.CommandLine.<init>(CommandLine.java:69)
    at weblogic.Admin.main(Admin.java:689)
    I checked in the console. A jndi name for petstoreServer does exist.--
    Sachin Thatte, Senior Software Engineer
    BEA Systems, Inc
    WWW: http://www.bea.com
    [att1.html]

  • Using Weblogic 9.1 WLST to connect to WLS 8.1.5 Server

    Hello:
    I have 2 questions:
    Question 1: BEA documentation says WLST is support in version 8.*. However, I can't find weblogic.WLST class in v8.1 weblogic.jar. So do I need to get additional jars?
    Question 2: I can launch weblogic.WLST in Weblogic v9.1 and it works fine to connect to other v9.1 servers. However, when connecting to v8.1 servers, it complains MBean Server is not initially property and it can't find weblogic.management.MBeanServer in InitialContext. Does that mean I need to do some configuration change on v8.1 server in order to accept WLST commands?
    Thanks in advance!
    Jenny Chen

    Yes, you will need to download WLST for 8.1 from https://codesamples.projects.dev2dev.bea.com/servlets/Scarab?id=S13 and follow the directions to install in your environment.
    No, connecting to WLS 8.1 servers from a 9.x WLST is not supported.
    HTH,
    -satya
    BEA Blog:
    http://dev2dev.bea.com/blog/sghattu/
    Get Involved in CodeShare:
    https://wls-console-extensions.projects.dev2dev.bea.com/
    https://wlnav.projects.dev2dev.bea.com/
    https://eclipse-wlst.projects.dev2dev.bea.com/
    https://wlst.projects.dev2dev.bea.com/

  • How to get a thread dump from Weblogic 9.1

    Hi All,
    Can someone please walk me through how to configure a WLS9.1 server to generate thread dumps. Ideally I'd like to do this via the admin console. I read about the MagicThreadDumpFile property, but can't see where/how to set it.
    Many Thanks
    Stuart

    I only know how to do this in WLS 8.1, but it will likely work in 9.1. On UNIX, you can send a kill -QUIT to the pid and it will dump threads to standard output for the server. You can also use weblogic.Admin THREAD_DUMP (http://e-docs.bea.com/wls/docs92/admin_ref/cli.html#wp1197887) or whatever is the equivalent in WLST now that weblogic.Admin is deprecated in 9.x. I'm guessing it is the threadDump() method documented at http://e-docs.bea.com/wls/docs92/config_scripting/reference.html#wp1104314.
    I know of no way to do this through the console, unfortunately.

  • With out using Weblogic libraries to maintain the same functionality

    Hi,
    Please tell the solution of my problem.Here application developed in Weblogic,now we are migrating that applicationin jboss.Here one java servlet program is there which is using Weblogic libraries to get the connection pool .
    How can change the code without using Weblogic libraries to maintain the same funtionality. Is there any alternate method to get the connection pools in Jboss.
    Here I am attaching the code ,please go througth the code and provide me the correct solution.
    package gsk.servlets;
    import java.io.*;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import javax.naming.Context;
    import javax.naming.NamingException;
    import javax.management.*;
    import javax.management.InstanceNotFoundException;
    import javax.management.InvalidAttributeValueException;
    import javax.management.Notification;
    import javax.servlet.*;
    import javax.servlet.http.*;
    //Below lines are commnented by Anupama on 29-09-05 to avoid using Weblogic libraries.
    //import weblogic.jndi.Environment;
    //import weblogic.management.MBeanHome;
    //import weblogic.management.MBeanCreationException;
    //import weblogic.management.*;
    //import weblogic.management.runtime.*;
    //import weblogic.management.configuration.*;
    //import weblogic.management.RemoteNotificationListener;
    //import weblogic.management.logging.WebLogicLogNotification;
    //import javax.management.Notification.*;
    //below lines are added by Anupama T on 29-09-05 to run the same functionality without using Weblogic libraries
    import org.jboss.management.*;
    import org.jboss.jdbc.*;
    import org.jboss.naming.*;
    import org.jboss.management.j2ee.MBean;
    import javax.management.AttributeChangeNotification;
    import javax.management.JMException;
    import javax.management.MalformedObjectNameException;
    import javax.management.MBeanServer;
    import javax.management.NotificationListener;
    import javax.management.ObjectName;
    import org.jboss.logging.Logger;
    import org.jboss.system.ServiceMBean;
    import gsk.adip.portal.GKMProperties;
    import gsk.adip.dbconnectionservice.DatabaseConnector;
    * @author jjc18400
    * The ConnectionsManager class acts as a Servlet that listens and
    * responds to events that are thrown by WebLogic MBeans. In particular,
    * it listens for failures in WebLogic connection pools, and attempts to
    * restore these pools.
    public class ConnectionsManager extends HttpServlet implements NotificationListener {
         private static Context ctx;
         private static MBean managedHome;
         private static MBean adminHome;
         private static String SERVER_NAME;
         private static String DOMAIN_NAME;
         private static MBeanServer myServer;
         private JDBCConnectionPoolRuntimeMBean connectionPoolMBean;
         private JDBCConnectionPoolMBean jdbcConnPoolMBean;
         private JDBCConnectionPoolMBean myPool;
         private static ResultSet rset = null;
         public void init(ServletConfig config) throws ServletException {
              super.init(config);
              System.out.println("Initializing the ConnectionsManager servlet.");
              SERVER_NAME = GKMProperties.getProperty("GKM_SERVER_NAME");
              DOMAIN_NAME = GKMProperties.getProperty("DOMAIN_NAME");
              findMBeans();
              testConnectionPool("GENNETConnectionPool");
              try {
                   //findConnPool("GENNETConnectionPool").addNotificationListener(this, null, null);
                   RemoteMBeanServer rmbs = adminHome.getMBeanServer();
                   WebLogicObjectName oname =
                        new WebLogicObjectName("TheLogBroadcaster", "LogBroadcasterRuntime", DOMAIN_NAME, SERVER_NAME);
                   rmbs.addNotificationListener(oname, this, null, null);
              catch (IllegalArgumentException e) {}
              catch (MalformedObjectNameException e) {}
              catch (InstanceNotFoundException e) {}          
         public void handleNotification(Notification notification, Object obj) {
              WebLogicLogNotification wln = (WebLogicLogNotification)notification;
              System.out.println("\nWebLogicLogNotification");
              System.out.println(" type = " + wln.getType());
              System.out.println(" message id = " + wln.getMessageId());
              System.out.println(" server name = " + wln.getServername());
              System.out.println(" timestamp = " + wln.getTimeStamp());
              System.out.println(" message = " + wln.getMessage() + "\n");
         private void testConnectionPool(String poolName) {
              JDBCConnectionPoolMBean aPool = findConnPool(poolName);
              JDBCConnectionPoolRuntimeMBean aRuntimeMBean = findRuntimeMBean(poolName);
              /*while(aRuntimeMBean.getPoolState()) {
                   try {
                        Thread.sleep(6000);
                        System.out.println("Thread is sleeping.");
                   catch (InterruptedException ie) {
              retargetConnPool(aPool);
         private JDBCConnectionPoolRuntimeMBean findRuntimeMBean(String aPoolName) {
              JDBCConnectionPoolRuntimeMBean aRuntimeMBean = null;
              if (managedHome != null) {
                   try {
                        aRuntimeMBean = (JDBCConnectionPoolRuntimeMBean)managedHome.
                                  getRuntimeMBean(aPoolName, "JDBCConnectionPoolRuntime");
                   catch (InstanceNotFoundException e) {
                        System.out.println("Unable to find the JDBCConnectionPoolRuntimeMBean: " + e);
                        aRuntimeMBean = null;
              return aRuntimeMBean;
         private JDBCConnectionPoolMBean findConnPool(String poolName) {
              if (adminHome != null) {
                   try {
                        myPool = (JDBCConnectionPoolMBean)adminHome.getMBean(poolName, JDBCConnectionPoolMBean.class);
                   catch (InstanceNotFoundException e) {
                        System.out.println("Unable to find the JDBCConnectionPoolMBean: " + e);
                        myPool = null;
              return myPool;
         private void retargetConnPool(JDBCConnectionPoolMBean aPool) {
              //System.out.println("The connection pool: " + aPool.toString() + " is not responding.\nAttempting to retarget the pool...");
              try {
                   System.out.println("Attempting to remove " + myServer.toString() + " from the connection pool target list.");
                   aPool.removeTarget(myServer);
                   System.out.println("Removal successful: " + aPool.getTargets().toString());
                   aPool.addTarget(myServer);
                   System.out.println("Addition successful: " + aPool.getTargets().toString());
              catch (InvalidAttributeValueException e) {
                   System.out.println(e.toString());
              catch (DistributedManagementException e) {
                   System.out.println(e.toString());
         public void doPost(HttpServletRequest req, HttpServletResponse resp)
                   throws ServletException, IOException {
              String poolName = (String)req.getParameter("poolName");
              String dataSource = (String)req.getParameter("dataSource");
              //System.out.println("req.getAttribute(poolName) is: " + poolName);
              //System.out.println("req.getAttribute(dataSource) is: " + dataSource);
              String message = runTestQuery(dataSource);
              getConnectionPoolMBean(poolName);
              resp.setContentType("text/html");
              PrintWriter out = resp.getWriter();
              out.println("<html>");
              out.println(" <head><title>The ConnectionsManager Responds:</title></head>");
              out.println(" <body>");
              out.println(" <h1>" + message + "</h1>");
              out.println(" </body>");
              out.println("</html>");
         public void destroy() {
              System.out.println("Destroying the ConnectionsManager servlet.");
         public String getServletInfo() {
              return "This servlet monitors and corrects errors in WebLogic connection pools.";
         /**private void runTests() {
              while (false) {
                   rset = testConnection();
                   if (rset == null) {
                        resetConnectionPool();                    
                   try {
                        wait();
                   catch (InterruptedException e) {}
         private String runTestQuery(String dataSource) {
              String statusMessage = "";
              Connection conn = null;
              Statement stmt = null;
              ResultSet rset = null;
              //String aPoolName = "GENNETConnectionPool";
              String aSql = "select * from dual where 1 = 1";
              try {
                   conn = DatabaseConnector.getDatabaseConnection(dataSource);
                   System.out.println("Established database connection.");
                   if (conn != null) {
                        conn.setAutoCommit(false);
                        stmt = conn.createStatement();
                        rset = stmt.executeQuery(aSql);
                        statusMessage = "The connection \'" + dataSource + "\' is OK.";
              catch (Exception e) {
                   try {
                        conn.rollback();
                   catch (Exception e1) {}
                   e.printStackTrace();
                   statusMessage = "The connection \'" + dataSource + "\' has failed.\n" + e.toString();
              finally {
                   try {
                        if (stmt != null) stmt.close();
                        if (conn != null) conn.close();
                   catch (Exception e) {
                        e.printStackTrace();
                   return statusMessage;
         public void resetConnectionPool() {
         private void findConnPoolRuntimeMBean(String poolName) {
              try {
                   connectionPoolMBean = (JDBCConnectionPoolRuntimeMBean)managedHome.getRuntimeMBean(poolName, "JDBCConnectionPoolRuntime");
              catch (InstanceNotFoundException e) {
                   System.out.println("Unable to find the JDBCConnectionPoolRuntimeMBean: " + e);
         private void findMBeans() {
              Environment env = new Environment();
              try {
                   ctx = env.getInitialContext();
                   managedHome = (MBeanHome)ctx.lookup(MBeanHome.JNDI_NAME + "." + SERVER_NAME);
                   System.out.println(MBeanHome.JNDI_NAME + "." + SERVER_NAME + " -- managedHome found successfully.");
                   adminHome = (MBeanHome)ctx.lookup(MBeanHome.ADMIN_JNDI_NAME);
                   System.out.println(MBeanHome.ADMIN_JNDI_NAME + " -- adminHome found successfully.");
                   myServer = (ServerMBean)adminHome.getMBean(SERVER_NAME, ServerMBean.class );
                   System.out.println(MBeanHome.ADMIN_JNDI_NAME + " -- " + SERVER_NAME + " instance found successfully.");
                   ctx.close();
              catch (NamingException e) {
                   System.out.println("Naming Exception: " + e);
                   managedHome = null;
                   adminHome = null;
              catch (InstanceNotFoundException e) {
                   System.out.println("Unable to find the JDBCConnectionPoolMBean: " + e);
         public String displayHomeName() {
              getConnectionPoolMBean("GENNETConnectionPool");
              if (managedHome != null) {
                   return new String("MBeanHome found successfully.");
              else return new String("MBeanHome not found.\nSee WL Console for error.");
         private void getConnectionPoolMBean(String poolName) {
              String thisPoolName = poolName;
              connectionPoolMBean = null;
              if (managedHome != null) {
                   try {
                        connectionPoolMBean =
                             (JDBCConnectionPoolRuntimeMBean)managedHome.getRuntimeMBean(thisPoolName, "JDBCConnectionPoolRuntime");
                        if (connectionPoolMBean != null) {
                             System.out.println("JDBCConnectionPoolRuntime found successfully.");
                             System.out.println("connectionPoolMBean.toString() is: " + connectionPoolMBean.toString());
                             System.out.println("connectionPoolMBean.getFailuresToReconnectCount() is: " + connectionPoolMBean.getFailuresToReconnectCount());
                             System.out.println("connectionPoolMBean.getPoolState() is: " + connectionPoolMBean.getPoolState());
                   catch (InstanceNotFoundException e) {
                        System.out.println("Unable to find the JDBCConnectionPoolRuntimeMBean: " + e);
                        connectionPoolMBean = null;
              // Obtain MBeanHome for the administration server.
              /*JDBCConnectionPoolMBean mbean = (JDBCConnectionPoolMBean)home.
                        getConfigurationMBean(poolName, "JDBCConnectionPoolConfig");
              mbean.setConnLeakProfilingEnabled(true);
              mbean.setSqlStmtParamLoggingEnabled(true);
              mbean.setSqlStmtMaxParamLength(maxLen);*/
              /*try {
                   mypool = (JDBCConnectionPoolMBean)mbh.getMBean( "mypool",
                   JDBCConnectionPoolMBean.class );
              catch( javax.management.InstanceNotFoundException e ) {
                   mypool = (JDBCConnectionPoolMBean) mbh.createAdminMBean( "mypool",
                        "JDBCConnectionPool", "mydomain" );
                   mypool.addTarget( myserver );
                   mypool.setDriverName( "org.gjt.mm.mysql.Driver" );*/
              if (adminHome != null) {
                   try {
                        myPool = (JDBCConnectionPoolMBean)adminHome.getMBean(poolName, JDBCConnectionPoolMBean.class);
                   catch (InstanceNotFoundException e) {
                        System.out.println("Unable to find the JDBCConnectionPoolMBean: " + e);
              if (myPool != null) {
                   //System.out.println("myPool.getMaxCapacity() is: " + myPool.getMaxCapacity());
                   try {
                        myPool.setMaxCapacity(10);
                        System.out.println("Before: myPool.getMaxCapacity() is: " + myPool.getMaxCapacity());
                        myPool.setMaxCapacity(100);
                        System.out.println("After: myPool.getMaxCapacity() is: " + myPool.getMaxCapacity());
                   catch (InvalidAttributeValueException e) {
                        System.out.println("Max Capacity is an invalid value.");
                   //System.out.println("myPool.getMaxCapacity() is: " + myPool.getMaxCapacity());
    }

    Hy, i've got the same problem as you. Did you find out a solution.
    If so, please contact me. Thanks a lot.
    Lorenzo

  • Weblogic.Admin: How do I change the properties of the DefaultIdentityAsserter

    For the Default Identity Asserter, I need to add the X.509 to the "Chosen" list.
    How do I do it at the command line using weblogic.Admin?

    "Hari Menon" <[email protected]> wrote in message
    news:[email protected]..
    >
    For the Default Identity Asserter, I need to add the X.509 to the "Chosen"list.
    How do I do it at the command line using weblogic.Admin?
    C:\weblogic\dev\src810>java weblogic.Admin -url
    t3://localhost:7001 -username weblogic
    -password weblogic SET -mbean Security:Name=myrealmDefaultIdentityAsserter
    -commotype -property ActiveTypes "AuthenticatedUser|X.509"
    C:\weblogic\dev\src810>java weblogic.Admin -url
    t3://localhost:7001 -username weblogic
    -password weblogic -pretty GET -mbean
    Security:Name=myrealmDefaultIdentityAsserter

Maybe you are looking for