How to access "Active Sessions" using MBeans
Hi all,
I have deployed an application at EM (Enterprise Manager).
when I logged into EM and click the application I can see the number of active sessions under "Servlets and JSPs" topic.
how can I access that parameter at application level..??
(I want to access that parameter *"x"* at my web application and display Logged in users : x )
EM shows that the number of active sessions. it updates too.. so there must be some bean or record for that parameter..
how can I access that....??
Regards,
Dinuka.
You can use something like the following:
package middleware.magic;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
import javax.naming.Context;
import java.io.IOException;
import java.util.Hashtable;
public class Browse {
private String hostname = "172.31.0.106";
private Integer port = 7001;
private String username = "weblogic";
private String password = "transfer11g";
private String protocol = "t3";
private String jndiRoot = "/jndi/";
private String mBeanServer = "weblogic.management.mbeanservers.domainruntime";
private String serviceName = "com.bea:Name=DomainRuntimeService,Type=weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean";
private JMXConnector connector;
public static void main(String[] args) {
Browse test = new Browse();
try {
MBeanServerConnection connection = test.getMBeanServerConnection();
test.getSomeInformation(connection);
test.closeJmxConnector();
} catch (Exception e) {
e.printStackTrace();
public void getSomeInformation(MBeanServerConnection connection) throws Exception {
ObjectName service = new ObjectName(serviceName);
ObjectName[] serverRunTimes = (ObjectName[]) connection.getAttribute(service, "ServerRuntimes");
for (int i = 0; i < serverRunTimes.length; i++) {
String name = (String) connection.getAttribute(serverRunTimes, "Name");
String version = (String) connection.getAttribute(serverRunTimes[i], "WeblogicVersion");
String state = (String) connection.getAttribute(serverRunTimes[i], "State");
System.out.println("Server name: " + name + ", Version: " + version + ", Server state: " + state);
for (int i = 0; i < serverRunTimes.length; i++) {
ObjectName[] applicationRuntimes = (ObjectName[]) connection.getAttribute(serverRunTimes[i], "ApplicationRuntimes");
for (int j = 0; j < applicationRuntimes.length; j++) {
String name = (String) connection.getAttribute(applicationRuntimes[j], "Name");
ObjectName[] componentRuntimes = (ObjectName[]) connection.getAttribute(applicationRuntimes[j], "ComponentRuntimes");
System.out.println("Application name: " + name);
for (int k = 0; k < componentRuntimes.length; k++) {
if (connection.getAttribute(componentRuntimes[k], "Type").equals("WebAppComponentRuntime")) {
String componentName = (String) connection.getAttribute(componentRuntimes[k], "Name");
Integer sessionsCurrent = (Integer) connection.getAttribute(componentRuntimes[k], "OpenSessionsCurrentCount");
Integer sessionsHigh = (Integer) connection.getAttribute(componentRuntimes[k], "OpenSessionsHighCount");
System.out.println(" - Component Name: " + componentName + ", Sessions Current: " + sessionsCurrent + ", Sessions High: " + sessionsHigh);
public MBeanServerConnection getMBeanServerConnection() throws IOException {
return getJmxConnector().getMBeanServerConnection();
public JMXConnector getJmxConnector() throws IOException {
JMXServiceURL serviceURL = new JMXServiceURL(protocol, hostname, port, jndiRoot + mBeanServer);
Hashtable hashtable = new Hashtable();
hashtable.put(Context.SECURITY_PRINCIPAL, username);
hashtable.put(Context.SECURITY_CREDENTIALS, password);
hashtable.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, "weblogic.management.remote");
connector = JMXConnectorFactory.connect(serviceURL, hashtable);
return connector;
public void closeJmxConnector() throws IOException {
connector.close();
Information regarding runtimeMBean can be found here: http://download.oracle.com/docs/cd/E12839_01/apirefs.1111/e13951/core/index.html.
Open the tree Runtime MBeans, ServerRuntimeMBean and click attributes to see the available attributes (such as Name, WeblogicVersion, State etcetera).
An example output of the program above:Server name: AdminServer, Version: WebLogic Server 10.3.2.0 Tue Oct 20 12:16:15 PDT 2009 1267925 , Server state: RUNNING
Server name: soa_server1, Version: WebLogic Server 10.3.2.0 Tue Oct 20 12:16:15 PDT 2009 1267925 , Server state: RUNNING
Application name: FMW Welcome Page Application_11.1.0.0.0
- Component Name: AdminServer__11.1.0.0.0, Sessions Current: 0, Sessions High: 0
Application name: Module-FMWDFW
Application name: bea_wls_internal
- Component Name: AdminServer_/bea_wls_internal, Sessions Current: 0, Sessions High: 0
Application name: mds-soa
Application name: bea_wls_deployment_internal
- Component Name: AdminServer_/bea_wls_deployment_internal, Sessions Current: 0, Sessions High: 0
Application name: wsil-wls
- Component Name: AdminServer_/inspection.wsil, Sessions Current: 0, Sessions High: 0
Application name: bea_wls_diagnostics
- Component Name: AdminServer_/bea_wls_diagnostics, Sessions Current: 0, Sessions High: 0
Application name: mejb
Application name: bea_wls9_async_response
- Component Name: AdminServer_/_async, Sessions Current: 0, Sessions High: 0
Application name: uddiexplorer
- Component Name: AdminServer_/uddiexplorer, Sessions Current: 0, Sessions High: 0
Application name: mds-owsm
Application name: bea_wls_management_internal2
- Component Name: AdminServer_/bea_wls_management_internal2, Sessions Current: 0, Sessions High: 0
Application name: consoleapp
- Component Name: AdminServer_/console, Sessions Current: 0, Sessions High: 2
- Component Name: AdminServer_/consolehelp, Sessions Current: 0, Sessions High: 1
Application name: DMS Application_11.1.1.1.0
- Component Name: AdminServer_/dms_11.1.1.1.0, Sessions Current: 0, Sessions High: 0
Application name: em
- Component Name: AdminServer_/em, Sessions Current: 0, Sessions High: 0
Application name: uddi
- Component Name: AdminServer_/uddi, Sessions Current: 0, Sessions High: 0
Application name: MQSeriesAdapter
Application name: OraSDPMDataSource
Application name: JmsAdapter
Application name: uddi
- Component Name: soa_server1_/uddi, Sessions Current: 0, Sessions High: 0
Application name: wsil-wls
- Component Name: soa_server1_/inspection.wsil, Sessions Current: 0, Sessions High: 0
Application name: SOAJMSModule
Application name: DbAdapter
Application name: bea_wls9_async_response
- Component Name: soa_server1_/_async, Sessions Current: 0, Sessions High: 0
Application name: composer
- Component Name: soa_server1_/soa/composer, Sessions Current: 0, Sessions High: 0
Application name: DMS Application_11.1.1.1.0
- Component Name: soa_server1_/dms_11.1.1.1.0, Sessions Current: 0, Sessions High: 0
Application name: Module-FMWDFW
Application name: usermessagingdriver-email
- Component Name: soa_server1_/sdpmessagingdriver/email-mbeanlifecycle, Sessions Current: 0, Sessions High: 0
Application name: UMSJMSSystemResource
Application name: AqAdapter
Application name: FtpAdapter
Application name: OracleBamAdapter
Application name: SOADataSource
Application name: usermessagingserver
- Component Name: soa_server1_/sdpmessaging/mbeanlifecycle, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/sdpmessaging/parlayx, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/sdpmessaging/userprefs-ui, Sessions Current: 0, Sessions High: 0
Application name: bea_wls_internal
- Component Name: soa_server1_/bea_wls_internal, Sessions Current: 0, Sessions High: 0
Application name: SocketAdapter
Application name: SOALocalTxDataSource
Application name: FileAdapter
Application name: DefaultToDoTaskFlow
- Component Name: soa_server1_/DefaultToDoTaskFlow, Sessions Current: 0, Sessions High: 0
Application name: soa-infra
- Component Name: soa_server1_/soa-infra, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/TaskService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/TaskMetadataService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/TaskQueryService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/TaskReportService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/IdentityService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/UserMetadataService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/RuntimeConfigService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/TaskEvidenceService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/CompositeMetadataService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/b2b, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/b2b, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/AGMetadataService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/AGQueryService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/AGAdminService, Sessions Current: 0, Sessions High: 0
Application name: wsm-pm
- Component Name: soa_server1_/wsm-pm, Sessions Current: 0, Sessions High: 0
Application name: mds-owsm
Application name: b2bui
- Component Name: soa_server1_/b2bconsole, Sessions Current: 0, Sessions High: 0
Application name: bea_wls_diagnostics
- Component Name: soa_server1_/bea_wls_diagnostics, Sessions Current: 0, Sessions High: 0
Application name: bea_wls_cluster_internal
- Component Name: soa_server1_/bea_wls_cluster_internal, Sessions Current: 0, Sessions High: 0
Application name: EDNLocalTxDataSource
Application name: EDNDataSource
Application name: uddiexplorer
- Component Name: soa_server1_/uddiexplorer, Sessions Current: 0, Sessions High: 0
Application name: bea_wls_deployment_internal
- Component Name: soa_server1_/bea_wls_deployment_internal, Sessions Current: 0, Sessions High: 0
Application name: worklistapp
- Component Name: soa_server1_/integration/worklistapp, Sessions Current: 0, Sessions High: 0
Application name: mds-soa
Application name: OracleAppsAdapter
Similar Messages
-
Guys,
Am having hung sessions in memory, wondering if anyone knows how to kill
them programatically using MBeans. In other words is there a MBean class which
gives me list of all active sessions in memory ?
ThanksGuys,
Am having hung sessions in memory, wondering if anyone knows how to kill
them programatically using MBeans. In other words is there a MBean class which
gives me list of all active sessions in memory ?
Thanks -
How to find active sessions count on a server in weblogic server console
Hi All,
I would like to know how to find active sessions count on a server in weblogic console. I am using weblogic 11g.
Regards,
Sunil.On the deployment, monitoring tab, you can select web applications. Here the number of current sessions are listed per web application deployed on the domain.
The deployment itself (deployments, application, monitoring, sessions) shows a list of sessions and where it is located. Unfortunately, there is no aggregation (but that is something you can so yourself as well).
When you are using a load balancer in front, the count of sessions on per web application on the domain gives you some clue how many sessions there are present on each server.
That is to say, when load balancer is using round-robin (and does that correct), you can take the total number of sessions divide it by the number of servers. -
How to monitor active sessions in a cluster
Hi all,
we currently test failover of our WLS 11g cluster.
How can I see in the Console to which managed server a client is connected?
Thank you in advance
Regards
Rolftoday i found a way to get the name of the server in a cluster which handles the active session, using a managed bean in my application.
There i added a getter method
public String getServerName() {
return System.getProperty("weblogic.Name");
and then I used an af:outputText with
#{<mybean>.serverName}
See this blog entry http://theblasfrompas.blogspot.com/2009/05/adf-failover-within-weblogic-103.html
Is there realy no way to get something like client-ip:<managed server> using WLS console?
I only found the number of requests (which is incrementing after reloading the console) in Deployments-> <application> -> Monitoring - Workload
Regards Rolf
Best Regards -
How to access Acrobat Plugin using GetInterface?
Hi
I'm trying to access a C++ plug-in written for Adobe Acrobat from a C# program. Following is my code, which I found elsewhere in this forum (LINK).
Type acroApp;
acroApp = Type.GetTypeFromProgID("AcroExch.App");
object oAcroObject = Activator.CreateInstance(acroApp);
object[] param = new object[1];
param[0] = "MyPlugin";
object pluginRef = oAcroObject.GetType().InvokeMember("GetInterface",BindingFlags.Invoke Method, null, oAcroObject, param);
Here, MyPlugin is the name of the plugin (without extension) which I've placed in the Acrobat plug-ins folder. But this way, InvokeMember returns a NULL object instead of the expected interface of my plugin.
What am I doing wrong? Any help would be greatly appreciated.You don't do it that way.
You need to use standard "inter application communication" methods such as (but not limited to): COM, DDE, shared memory, shared files, named pipes, etc.
From: Adobe Forums <[email protected]<mailto:[email protected]>>
Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
Date: Wed, 1 Feb 2012 20:20:23 -0800
To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
Subject: How to access Acrobat Plugin using GetInterface?
How to access Acrobat Plugin using GetInterface?
created by Sachintha81<http://forums.adobe.com/people/Sachintha81> in Acrobat SDK - View the full discussion<http://forums.adobe.com/message/4180327#4180327 -
How to access xml file using c
how to access xml file using c. are there any libraries regarding xml fastinfoset in c? Please let me know about any resources if u know? thanks!!!
samithaThere are different methods to access XML data which have pro's and cons. Let us know more about what you want to do and we can help you.
-
How to get the extension Info from firefox? Do we have any firefox API to communicate with the browser? I couldnt see the HTML of the widget displayed in the toolbar how to access the widget using JS or any way
Hi,
Thanks for the suggestion. I've been playing around with some of the classes of the java.net package and java.io
Using the URL class i can get the content of the data from a STATIC page and output that response to file so that is does not display to the client broswer.
But this only works if the URL i give points to a static html page.
So the problem i'm getting is if i'm righting in arguments in the URL, this means that server needs to process the arguments i give and its sends back a dynamic result. Because its dynamic the URL class can not handle this and throws me an exception everytime :(
Have u ever tried to do some things like this?
Rahul -
How can I enable session(using url) tracking in home page
i am developing bidding application. How can I enable session(using url) tracking in home page ?
for example :
http://mydomine.com/index.jsp;jsessionid=4A38A4496F6862681DFD09CD6D648485.tomcat75
please help me.Doubleposted. Please continue here: [http://forum.java.sun.com/thread.jspa?threadID=5308686&tstart=0]
In the future, do not use the back button to edit the message, but use the edit button instead. Otherwise you're reposting the form again. You should know that better as being a web developer. -
How to access the mysql using ordinary command line in Azure Website?
Hi
I deploying Django project on Azure. I created project and MySQL db according this method: https://pytools.codeplex.com/wikipage?title=PollsDjangoSql . I can create tables using django command "syncdb" in Visual Studio. I see
db structure in SQL Explorer. All works. But now I need to get access directly to mysql. For example with a view to set encoding of some column, or set permissions, change user password, etc.
I found about many different tools and methods in Microsoft portal. But the purpose of these tools, how to install it and how to use it is a very entangled (After several attempts to find out what's what two weeks later I found on my computer
three dozen programs with unknown purpose. I doubt that I need to install so many tools to just add the user in mysql).
How to access the mysql using ordinary command line (or the same simple tool) in my case?Hi pvgdrk,
To get access directly to a mysql database, you can use the commandline tool(open a cmd window-->type mysql the commadline ) or the
GUI MySQL workbench.
Since this is a question about MySQL, I would suggest you post your question in a dedicated MySQL forum. You will get more prompt response.
If you have any feedback on our support, please click
here.
Eric Zhang
TechNet Community Support -
How to remove the Sessions used in the application
Hai Techies,,,
i am using many number of sessions in my application, for example i am using 5 sessions in reports module
my application is a web based application
if can't remove the sessions it contains the huge amount of data , my application is going into mess, and the application performance will be decreased..
Can anybody tell the solution for this Problem
How to remove the Sessions used in the application
Hoping a reply
Thanks & Regards
Krishna mangamuriHai Gita,
i am not able to do the session invalidate method bcoz, i am mainatainting the session from login along with the current userid who is login into the system and putting some of the data in session....
thats session is to be valid upto when i click on logoff link
except that i have to remove the sessions in my application
while navigating from one jsp to another i have to remove the sessions, bit somes times that sessions may be used somewhere
Can u Understand My problem
session remove method may also helpful to me but some times it will casue some prob to me
Is there any other Way to remove the sessions in the Application ????
Thanks & Regards
Krishna Mangamuri -
How to create a session using call transaction method.
hi , this is nagaraju,
How to create a session using call transaction method.Hi,
About Data Transfer In R/3 System
When a company decides to implement the SAP R/3 to manage business-critical data, it usually does not start from a no-data situation. Normally, a SAP R/3 project comes into replace or complement existing application.
In the process of replacing current applications and transferring application data, two situations might occur:
The first is when application data to be replaced is transferred at once, and only once.
The second situation is to transfer data periodically from external systems to SAP and vice versa.
There is a period of time when information has to be transferred from existing application, to SAP R/3, and often this process will be repetitive.
The SAP system offers two primary methods for transferring data into SAP systems. From non-SAP systems or legacy system. These two methods are collectively called batch input or batch data communication.
1. SESSION METHOD
2. CALL TRANSACTION
3. DIRECT INPUT
First step for both the methods is to upload the data to internal table. From Internal Table, the data is transferred to database table by two ways i.e., Session method and Call transaction.
Session is intermediate step between internal table and database table. Data along with its action is stored in session i.e., data for screen fields, to which screen it is passed, the program name behind it, and how the next screen is processed.
When the program has finished generating the session, you can run the session to execute the SAP transactions in it. Unless session is processed, the data is not transferred to database table.
A technique similar to SESSION method, while batch input is a two-step procedure, Call Transaction does both steps online, one after the other. In this method, you call a transaction from your program.
SESSION METHOD
Data is not updated in database table unless Session is processed.
No sy-subrc is returned.
Error log is created for error records.
Updation in database table is always synchronous
CALL TRANSACTION
Immediate updation in database table.
Sy-subrc is returned.
Errors need to be handled explicitly
Updation in database table can be synchronous Or Asynchronous.
Regards,
Sruthi. -
How to access remote database using applet
hi all,
I want to know how to access remote database using applet,
Please help me anybody.
Regards
JesuIf the database is on a public server, you probably can't access it directly (security wise). You can make your applet talk to a server-side application, which makes the database calls on behalf of the applet. But even in an intranet environment this setup is often preferable, because you don't need to distribute a JDBC driver to all your clients.
-
How to get active session details
Dear all
in my application i want to display number of users online in a list and their details,for that how can i get the active session details in a jsp , or any other ways to do this.any suggestion regarding this is very much helpful to me. thanks in advance
thanking u
yours
kumaran ramuHi,
You can use a Listener class for track the sessions and do some logic when a session is created/destroyed. See HttpSessionListener interface. You can save the session IDs and session objects when a session is created, for example in a hashmap. Save the hashmap in application context. In your JSP get the hashmap and get its key/values. See thread safe problems if you are using a hashmap in application context. -
How to access a session variable just before rendering a JSF page???
Dear Sirs...
i am using jdeveloper 10.1.3.2 with JSF and ADF faces. i want to access a session variable and perform some processing just before rendering a page. how can i achieve this????
i am a little new to jsf, so i feel a little lost
thanks for any help in advance, and best regards<p>
Hi,
</p>
<p>
See example 60 "<strong>Triggering OnPageLoad-Style Code in a JSF Backing Bean Using ADF PagePhaseListener or PageController</strong>" on Steve's Muench blog.
</p>
<p>
Kuba
</p> -
How to store php sessions using memcached and unix socket
I am running Arch linux with systemd, nginx, and php with php-fpm. I am trying (and failing) to configure memcached to store sessions using a unix socket. I have memcached installed and active, however, I am unable to disable networking. I added the following line to /etc/conf.d/memcached
MEMCACHED_ARGS="-s unix:///tmp/memcached.sock -a 666"
I also tried:
MEMCACHED_ARGS="-s /tmp/memcached.sock -a 666"
MEMCACHED_ARGS="-s unix:/tmp/memcached.sock -a 666"
when I restart memcached I always get:
memcached.service - Memcached Daemon
Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled)
Active: active (running) since Sat 2013-01-19 17:41:15 PST; 5min ago
Main PID: 773 (memcached)
CGroup: name=systemd:/system/memcached.service
└─773 /usr/bin/memcached -l 127.0.0.1
when I run php script with sessions php error log shows (not surprisingly):
[19-Jan-2013 16:46:45 America/Los_Angeles] PHP Warning: Unknown: Failed to write session data (memcached). Please verify that the current setting of session.save_path is correct (unix:/tmp/memcached.sock) in Unknown on line 0
I also installed the php-memcached package but I don't what it does or how to get it going. I uncommented the following line in /etc/php/conf.d/memcached.ini:
extension=memcached.so
but that didn't change anything.
Any insights or suggestions would be greatly appreciated.Look at this link -http://odiexperts.com/getting-one-or-several-unknown-files-from-a-directory
change the command to fetch the ls command and write into File and then using either java or jython break the data and fetch the file name and date and insert into log table.
(or)
you can use the os.system command and get the complete ls command into string and then process and insert it.
Let us know if you need any other help.
Maybe you are looking for
-
Microsoft Outlook marking received email as spam
Hi Guys, I am facing problem when i am sending email to my outlook Email account. Sender email id is like [email protected] for the http://mycampaignsemail.co.in i have configured A record and SPF record. But Problem is when outlook marks my email as
-
I know about standard tools for capturing screenshots of: • whole screen • a given window • a given selected area drawn with the mouse But oftentimes I have a window that has content outside the visible area - where I'd have to scroll
-
Keynot '08: "Move" Action to scroll text
Sorry for this stupid question, but I'm baffled as to how to use the Action "Move". I have a block of text I want to scroll from the bottom to the top of the page. The little "Option Click the Selected Path" "hint" just isn't very helpful. Can anyone
-
IRWebclient: error when uncompressing data retrieved: *Data Error*!
We experience a sporadic "error when uncompressing data retrieved: *Data Error*!" while processing a query with IR webclient 931. The problem occurs on several webclients but on other desktops it does not. The IHTML processes fine. Any one an idea? r
-
Latest Modeling Statement of Direction now available on this site
Just published: http://otn.oracle.com/products/designer/mod_strat_apr_03.html Regards Simon W Day Oracle Tools Product Management