Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "EclipseLink/DesignDocs/316513"
< EclipseLink | DesignDocs
m (→DI 3: MBean Registration and Deregistration) |
m (→Option 2: Direct factory reference via JMX API) |
||
Line 70: | Line 70: | ||
=====Option 1: JNDI Lookup===== | =====Option 1: JNDI Lookup===== | ||
=====Option 2: Direct factory reference via JMX API===== | =====Option 2: Direct factory reference via JMX API===== | ||
+ | *Get the first server in the list - usually the only one unless we are running on Oracle JRockit. | ||
+ | <source lang="java"> | ||
+ | mBeanServerRuntime = (MBeanServer) MBeanServerFactory.findMBeanServer(null).get(0); | ||
+ | </source> | ||
+ | |||
=====Option 3: Direct factory reference via JBoss API===== | =====Option 3: Direct factory reference via JBoss API===== | ||
Revision as of 13:10, 24 June 2010
Contents
- 1 Design Specification: Extend WebLogic 10.3 JMX MBean support to JBoss 5.1.0 and WebSphere 7 as generic API
- 1.1 Work in Queue
- 1.2 Completed Work
- 1.3 Document History
- 1.4 Project overview
- 1.5 Analysis
- 1.5.1 DI 1: Architecture for JMX Implementors
- 1.5.2 DI 2: Enabling JMX MBeans
- 1.5.3 DI 3: MBean Registration and Deregistration
- 1.5.4 DI 4: 20100624: Verify correct MBeanServer available when running JBoss on JRockit
- 1.6 Design
- 1.6.1 WebLogic JMX Integration
- 1.6.2 JBoss JMX Integration
- 1.6.2.1 Modules
- 1.6.2.1.1 NEW: core:services.mbean.jboss.MBeanJBossRuntimeServices.java
- 1.6.2.1.2 NEW: core:services.mbean.jboss.MBeanJBossRuntimeServicesMBean.java
- 1.6.2.1.3 NEW: core:services.mbean.jboss.JBossRuntimeServices.java
- 1.6.2.1.4 MOD: core:services.mbean.weblogic.ClassSummaryDetail.java moved up to parent package
- 1.6.2.1.5 MOD: core:platform.server.jboss.JBossPlatform.java
- 1.6.2.1.6 MOD: core:services.mbean.weblogic.WebLogic_10_platform.java
- 1.6.2.1 Modules
- 1.6.3 WebSphere JMX Integration
- 1.6.4 GlassFish JMX Integration
- 1.6.5 Design Issue NN:
- 1.7 Implementation
- 1.8 Testing
- 1.9 Open Issues
- 1.10 References
Design Specification: Extend WebLogic 10.3 JMX MBean support to JBoss 5.1.0 and WebSphere 7 as generic API
Work in Queue
- 316513: JMX: Refactor MBean support to include JBoss and WebSphere
- 316510: JMX: Add JMX MBean support to WebSphere 7
- 316511: JMX: Add JMX MBean support to JBoss 5.1.0 EAP
- 316512: JMX: Add JMX MBean support to Glassfish 3 - nofix
- 316509: JMX: Move JMX MBean support for WebLogic 10.3 to a generic ServerPlatformBase
- 265540: JMX: Add runtime services MBean monitoring to Java SE clients
Completed Work
- Design document for generic JMX MBeans for WebLogic
- Bug# 248748 - WebLogic extensions to generic JMX MBeans
- JMX MBean Tutorial for Oracle WebLogic Server
Document History
Date | Author | Version Description & Notes |
---|---|---|
2010-06-10 | Michael O'Brien | 0.1 Starting Draft for Generic JMX MBean support to extend WebLogic 10.3 support to JBoss 5.1.0 EAP and WebSphere 7 for ER 316513 |
2010-06-22 | Michael O'Brien | 0.2 Develop/Document JBoss 5.1.0 EAP JMX registration code ER 316511 as work has been approved for the next release. We will concentrate on a POC for both servers before examining a rearchitecture as we move from WebLogic to include JBoss and WebSphere possibly using a new JMXPolicy interface instead of refactoring up into ServerPlatformBase |
Project overview
- This document is an extension of the work done in enhancement 248748 that added JMX MBean support for EclipseLink to WebLogic 10.x.
Analysis
DI 1: Architecture for JMX Implementors
Option 1: Move everything generic up to ServerPlatformBase
- This issue with this is that we will only have 3 of the 6 platforms JMX enabled - by moving JMX code too high up in the class hierarchy we introduce functionality that OC4J, SAP and SUNAS support but not within the current EclipseLink version.
Option 2: Create a new JMXServer Policy or Interface
Decision DI 1:
- Currently option 2 - new JMX Policy
DI 2: Enabling JMX MBeans
- The following properties will continue to enable registration for any capable application server.
- No code changes required at this point.
WebLogic
rem set JAVA_OPTIONS=%JAVA_OPTIONS% -Declipselink.register.dev.mbean=true rem set JAVA_OPTIONS=%JAVA_OPTIONS% -Declipselink.register.run.mbean=true
JBoss
- jboss-eap-5.0/jboss/as/bin/run.bat:83
// after set JAVA_OPTS=%JAVA_OPTS% "-Djava.library.path=%JBOSS_NATIVE_HOME%;%PATH%;%SYSTEMROOT%" // add set JAVA_OPTS=%JAVA_OPTS% -Declipselink.register.run.mbean=true
WebSphere
DI 3: MBean Registration and Deregistration
- These steps are mostly the same for all servers
- 1) Get JNDI context to lookup an 'MBeanServer
- 2) Create a new ObjectName for the MBean
- 3) Create a server specific MBean via 1a) JNDI lookup or 1b) Direct API factory
- 4) call registerMBean using the MBean and ObjectName
- 5) discard the ObjectInstance return of registerMBean but cache the MBean*RuntimeServices MBean
JBoss MBean Registration
Option 1: JNDI Lookup
Option 2: Direct factory reference via JMX API
- Get the first server in the list - usually the only one unless we are running on Oracle JRockit.
mBeanServerRuntime = (MBeanServer) MBeanServerFactory.findMBeanServer(null).get(0);
Option 3: Direct factory reference via JBoss API
WebSphere MBean Registration
Option 1: JNDI Lookup
WebLogic MBean Registration
Option 1: JNDI Lookup
DI 4: 20100624: Verify correct MBeanServer available when running JBoss on JRockit
Design
WebLogic JMX Integration
JBoss JMX Integration
- 20100622: This section details the JMX registration code for EclipseLink MBeans on JBoss 5.1.0 EAP
- See jar signing and JMX prepending issues solved in bug# 305331 specific to the JBoss EAP edition that need to be covered off.
Modules
NEW: core:services.mbean.jboss.MBeanJBossRuntimeServices.java
NEW: core:services.mbean.jboss.MBeanJBossRuntimeServicesMBean.java
NEW: core:services.mbean.jboss.JBossRuntimeServices.java
MOD: core:services.mbean.weblogic.ClassSummaryDetail.java moved up to parent package
MOD: core:platform.server.jboss.JBossPlatform.java
MOD: core:services.mbean.weblogic.WebLogic_10_platform.java
- Move the now generic system properties up to ServerPlatformBase
/** This System property "eclipselink.register.dev.mbean" when set to true will enable registration/unregistration of the DevelopmentServices MBean */ public static final String JMX_REGISTER_DEV_MBEAN_PROPERTY = "eclipselink.register.dev.mbean"; /** This System property "eclipselink.register.run.mbean" when set to true will enable registration/unregistration of the RuntimeServices MBean */ public static final String JMX_REGISTER_RUN_MBEAN_PROPERTY = "eclipselink.register.run.mbean";
WebSphere JMX Integration
GlassFish JMX Integration
- No work scheduled at this point of 20100622
Design Issue NN:
Analysis NN:
Solution NN:
Implementation
Testing
JBoss Specific EAR Configuration
- The following scenario specifies @Remote on the remote interface and @Stateless on the stateless session bean.
- This results in the following JNDI name emitted by the server on EAR deploy
@Stateless(name="ApplicationService", mappedName="ApplicationService") @Remote(ApplicationServiceRemote.class) public class ApplicationService implements ApplicationServiceRemote { @PersistenceContext(unitName="example", type=PersistenceContextType.TRANSACTION) private EntityManager entityManager; ... } public class FrontController extends HttpServlet implements Servlet { public static final String APPLICATION_SERVICE_JNDI_NAME = "org.eclipse.persistence.example.jpa.server.jboss.EnterpriseEAR/ApplicationService/remote-org.eclipse.persistence.example.jpa.server.business.ApplicationServiceRemote"; /** * Get the SSB ApplicationService bean - using a JNDI context lookup (no EJB injection was used on this servlet) * @param viaJNDILookup * @return */ public ApplicationServiceRemote getApplicationService(boolean viaJNDILookup) { if(null == applicationService && viaJNDILookup) { try { Hashtable<String, String> env = new Hashtable<String, String>(); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); env.put(Context.PROVIDER_URL, "localhost"); env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" ); InitialContext ctx = new InitialContext(env); System.out.println("FrontController.getApplicationService() JNDI lookup of " + APPLICATION_SERVICE_JNDI_NAME); return (ApplicationServiceRemote) ctx.lookup(APPLICATION_SERVICE_JNDI_NAME); } catch (Exception e) { e.printStackTrace(); throw new RuntimeException("Exception looking up session bean: ", e); } } else { return applicationService; } } ... }
JBoss Proof of Concept Registration 1
- First POC results positive using a non-JNDI JMX spec findMBeanServer() first server returned lookup (fine only for non-JRockit JVMs)
JBoss JMX View of Services MBean after EM creation via EAR application run
- execute
- via the JBoss JMX console view
- Using the first server found via http://community.jboss.org/wiki/FindMBeanServer/diff?secondVersionNumber=19
mBeanServerRuntime = (MBeanServer) MBeanServerFactory.findMBeanServer(null).get(0);
- we register via
runtimeInstance = mBeanServerRuntime.registerMBean(runtimeServices, anObjectName);
- to
server MBeanServerImpl (id=400) classLoaderRepository UnifiedLoaderRepository3 (id=409) listeners MBeanServerListenerRegistry (id=417) outer MBeanServerImpl (id=400) classLoaderRepository UnifiedLoaderRepository3 (id=409) listeners MBeanServerListenerRegistry (id=417) outer MBeanServerImpl (id=400) registry BasicMBeanRegistry (id=419) defaultDomain "jboss" (id=426) delegate MBeanServerDelegate (id=427) domainMap ConcurrentReaderHashMap (id=432) fMbInfosToStore null loaderRepository UnifiedLoaderRepository3 (id=409) mbeanInfoService ObjectName (id=436) registrationNotificationSequence SynchronizedLong (id=439) server MBeanServerImpl (id=400) unregistrationNotificationSequence SynchronizedLong (id=444) registry BasicMBeanRegistry (id=419)
- giving us
16:56:54,376 INFO [STDOUT] [EL Finest]: 2010-06-22 16:56:54.376--Thread(Thread[http-127.0.0.1-8080-2,5,jboss])--Registered MBean: org.eclipse.persistence.services.jboss.MBeanJBossRuntimeServices[TopLink:Name=Session(vfszip_/C_/opt/jboss-eap-5.0b/jboss-as/server/default/deploy/org.eclipse.persistence.example.jpa.server.jboss.EnterpriseEAR.ear/org.eclipse.persistence.example.jpa.server.jboss.EnterpriseEJB.jar/_example)] runtimeInstance ServerObjectInstance (id=519) agentID "xps435_1277239942304" (id=436) className "org.eclipse.persistence.services.jboss.MBeanJBossRuntimeServices" (id=521) name ObjectName (id=501) _ca_array ObjectName$Property[1] (id=523) _canonicalName "TopLink:Name=Session(vfszip_/C_/opt/jboss-eap-5.0b/jboss-as/server/default/deploy/org.eclipse.persistence.example.jpa.server.jboss.EnterpriseEAR.ear/org.eclipse.persistence.example.jpa.server.jboss.EnterpriseEJB.jar/_example)" (id=524)
Example JMX MBean call - printAllIdentityMapTypes
11:37:53,836 INFO [STDOUT] [EL Info]: 2010-06-24 11:37:53.836--ServerSession(16405579)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--Identity Map [org.eclipse.persistence.example.jpa.server.business.Cell] class = class org.eclipse.persistence.internal.identitymaps.SoftCacheWeakIdentityMap 11:37:53,836 INFO [STDOUT] [EL Info]: 2010-06-24 11:37:53.836--ServerSession(16405579)--Thread(Thread[http-127.0.0.1-8080-1,5,jboss])--Identity Map [org.eclipse.persistence.example.jpa.server.business.CellAttribute] class = class org.eclipse.persistence.internal.identitymaps.SoftCacheWeakIdentityMap