Skip to main content

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.

Jump to: navigation, search

Difference between revisions of "EclipseLink/DesignDocs/235168"

m (Runtime Services MBean)
m (Runtime Services MBean)
Line 76: Line 76:
 
=====Runtime Services MBean=====
 
=====Runtime Services MBean=====
 
*public boolean getShouldLogMessages()
 
*public boolean getShouldLogMessages()
*public void setShouldProfilePerformance(boolean shouldProfile)
+
*<font color="red">public void setShouldProfilePerformance(boolean shouldProfile)</red>
 
*public boolean getShouldProfilePerformance()
 
*public boolean getShouldProfilePerformance()
 
*public void setShouldLogPerformanceProfiler(boolean shouldLogPerformanceProfiler)
 
*public void setShouldLogPerformanceProfiler(boolean shouldLogPerformanceProfiler)
Line 84: Line 84:
 
*public void setStatementCacheSize(int size)
 
*public void setStatementCacheSize(int size)
 
*<font color="green">public int getStatementCacheSize()</font>
 
*<font color="green">public int getStatementCacheSize()</font>
*<font color="yellow">public void setSequencePreallocationSize(int size)</font>  
+
*<font color="green">public void setSequencePreallocationSize(int size)</font>  
 
*public int getSequencePreallocationSize()  
 
*public int getSequencePreallocationSize()  
 
*public void updatePoolSize(String poolName, int maxSize, int minSize)
 
*public void updatePoolSize(String poolName, int maxSize, int minSize)

Revision as of 11:11, 30 June 2008

Contents

Design Specification: WebLogic JMX MBean Support

This design doc is being finalized the week of June 23 2008

Bug# 235168

JMX MBean Tutorial for WebLogic

Document History

Date Author Version Description & Notes
2008-06-23 Michael O 0.1 Starting Draft

Project overview

We require a way to manage EclipseLink sessions using standard JMX API. This enhancement will add JMX MBean support to EclipseLink 1.0 by exposing select runtime and development attributes and methods to custom JMX client code or JConsole.

We will be adding the 2 MBeans below and their associated interfaces and platform support code.

org.eclipse.persistence.services.DevelopmentServices
org.eclipse.persistence.services.RuntimeServices

Concepts

Based on JMX 1.2 and JMX Remote API 1.0

References

ELUG Documentation JMX MBeans in WebLogic 10

Requirements

R1: Enable JMX MBean Support for WebLogic

R2: Enable JMX MBean support for generic J2EE servers - future

R3: MBeans have a 1:1 relationship with their session (multiple EARs=multiple beans)

R4: Clients can disable post login MBean registration (via SessionCustomizer)

R5: Clients can manage their own registration of EclipseLink MBeans (via ApplicationLifecycleListener)

Design Constraints

C1: MBeans are not available until the first login of a server application (lazy-loaded)

C2: Functions marked OBSOLETE will not be implemented if there is no suitable replacement

Design / Functionality

Design Issue 1: Obsolete/deprecated code

Some functions in the original generic MBean code use code that is no longer in Eclipse or was refactored - listed below

  • RuntimeServices
    • public void setSequencePreallocationSize(int size)
    • public int getSequencePreallocationSize()

((DatasourcePlatform)getSession().getDatasourcePlatform()).setSequencePreallocationSize(size);

replaces

((DatabaseLogin)getSession().getDatasourceLogin()).setSequencePreallocationSize(size);

  • DevelopmentServices
    • public void setChangeSetPropagationShouldBeAsynchronous(boolean isAsynchronous)
    • public boolean getChangeSetPropagationShouldBeAsynchronous()
    • public void setShouldRemoveConnectionOnError(boolean shouldRemoveConnection)
    • public boolean getShouldRemoveConnectionOnError()
    • public void updateSynchronizationDiscoveryMulticastGroup(String multicastIP, int multicastPort)
    • public void initializeCacheSynchronizationServices() throws SynchronizationException

The following classes were deprecated and removed after M1, replacement functionality is required see 238408.

org.eclipse.persistence.sessions.remote.CacheSynchronizationManager;
org.eclipse.persistence.sessions.remote.AbstractClusteringService;

Any inclusion of refactored code for the above functions will require a test setup that includes a cluster - see 238412

Included MBean Functions/Attributes

The following functions are supported in EclipseLink 1.0

Runtime Services MBean
  • public boolean getShouldLogMessages()
  • public void setShouldProfilePerformance(boolean shouldProfile)</red>
  • public boolean getShouldProfilePerformance()
  • public void setShouldLogPerformanceProfiler(boolean shouldLogPerformanceProfiler)
  • public boolean getShouldLogPerformanceProfiler()
  • public void setShouldCacheAllStatements(boolean shouldCacheAllStatements)
  • public boolean getShouldCacheAllStatements()
  • public void setStatementCacheSize(int size)
  • public int getStatementCacheSize()
  • public void setSequencePreallocationSize(int size)
  • public int getSequencePreallocationSize()
  • public void updatePoolSize(String poolName, int maxSize, int minSize)
  • public List getAvailableConnectionPools()
  • public List getSizeForPool(String poolName)
  • public void addNewConnectionPool(String poolName, int maxSize, int minSize, String platform, String driverClassName, String url, String userName, String password) throws ClassNotFoundException
  • public void resetAllConnections()
  • public List getClassesInSession()
  • public List getObjectsInIdentityMap(String className) throws ClassNotFoundException
  • public Integer getNumberOfObjectsInIdentityMap(String className) throws ClassNotFoundException
  • public List getObjectsInIdentityMapSubCacheAsMap(String className) throws ClassNotFoundException
  • public Integer getNumberOfObjectsInIdentityMapSubCache(String className) throws ClassNotFoundException
  • public int getLogLevel(String category)
  • public void setLogLevel(int level)
  • public boolean shouldLog(int Level, String category)
  • public void setProfileWeight(int weight)
  • public boolean getUsesBatchWriting()
  • public void setUsesJDBCBatchWriting(boolean usesJDBCBatchWriting)
  • public boolean getUsesJDBCBatchWriting()
  • public void setUsesByteArrayBinding(boolean usesByteArrayBinding)
  • public boolean getUsesByteArrayBinding()
  • public void setUsesNativeSQL(boolean usesNativeSQL)
  • public boolean getUsesNativeSQL()
  • public void setUsesStreamsForBinding(boolean usesStreamsForBinding)
  • public boolean getUsesStreamsForBinding()
  • public void setUsesStringBinding(boolean usesStringBinding)
  • public boolean getUsesStringBinding()
Development Services MBean
  • public void initializeIdentityMap(String className) throws ClassNotFoundException
  • public void initializeAllIdentityMaps()
  • public void setIdentityMapForClass(String className, String identityMapClassType, int maxSize) throws ClassNotFoundException
  • public void refreshProject(String projectFilePath)
  • public void updateCacheSize(String className, int newSize) throws ClassNotFoundException
  • public void setShouldBindAllParameters(boolean shouldBindAllParameters)
  • public boolean getShouldBindAllParameters()
  • public void setStringBindingSize(int size)
  • public int getStringBindingSize()
  • public void setUsesBatchWriting(boolean usesBatchWriting)

Obsolete MBean Functions/Attributes

The following functions are obsolete or deprecated and will not be included.

Runtime Services MBean
  • public void setShouldLogMessages(boolean shouldLogMessages) // Replaced by setLogLevel(int level)
  • public void setShouldLogDebug(boolean shouldLogDebug) // Replaced by setLogLevel(int level)
  • public boolean getShouldLogDebug() // Replaced by getLogLevel(String category)
  • public void setShouldLogExceptions(boolean shouldLogExceptions) // Replaced by setLogLevel(int level)
  • public boolean getShouldLogExceptions() // replaced by getLogLevel(String category)
  • public void setShouldLogExceptionStackTrace(boolean shouldLogExceptionStackTrace)
  • public boolean getShouldLogExceptionStackTrace()
  • public void setShouldPrintDate(boolean shouldPrintDate)
  • public boolean getShouldPrintDate()
  • public void setShouldPrintSession(boolean shouldPrintSession)
  • public boolean getShouldPrintSession()
  • public void setShouldPrintThread(boolean shouldPrintThread)
  • public boolean getShouldPrintThread()
  • public void setShouldPrintConnection(boolean shouldPrintConnection)
  • public boolean getShouldPrintConnection()
  • public void addNewConnectionPool(String poolName, int maxSize, int minSize, String platform, String driverClassName, String url, String userName, String password, String licencePath) throws ClassNotFoundException
  • public List getObjectsInIdentityMapSubCache(String className) throws ClassNotFoundException // replaced by getObjectsInIdentityMapSubCacheAsMap(String className)
Development Services MBean
  • public void setChangeSetPropagationShouldBeAsynchronous(boolean isAsynchronous)
  • public boolean getChangeSetPropagationShouldBeAsynchronous()
  • public void setShouldRemoveConnectionOnError(boolean shouldRemoveConnection)
  • public boolean getShouldRemoveConnectionOnError()
  • public void updateSynchronizationDiscoveryMulticastGroup(String multicastIP, int multicastPort)
  • public void initializeCacheSynchronizationServices() throws SynchronizationException

Disabling EclipseLink Managed Lazy Registration

By default MBean registration is disabled for WebLogic. This registration would occur as a post step during the first login to the session when it is enabled.

Application Managed Lazy Registration

Disabling MBean Registration

If MBean registration is not required, or the application will be handling registration then you may disable automatic registration at the first login by setting up the following.

  • System properties

MBean registration is disabled by ommitting one or both of the two mbean system properties If [eclipselink.register.dev.mbean] or [eclipselink.register.run.mbean] properties are missing then MBean registration will not proceed for that bean.

rem set JAVA_OPTIONS=%JAVA_OPTIONS% -Declipselink.register.dev.mbean=true
rem set JAVA_OPTIONS=%JAVA_OPTIONS% -Declipselink.register.run.mbean=true


  • sessions.xml property
WebLogic ApplicationLifecycleListener Example

Here the application can manage registration/deregistration of the MBeans by using a SessionCustomizer in conjunction with a listener on either a servlet or session bean within the JEE application.

  • SessionCustomizer
  • Listener

You must configure the EclipseLink Mbeans in the EAR/meta-inf via a weblogic-application.xml descriptor entry.

<!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"  "http://java.sun.com/dtd/application_1_3.dtd">
<weblogic-application xmlns="http://www.bea.com/ns/weblogic/10">
    <listener>
       <listener-class>org.eclipse.persistence.example.unified.integration.ApplicationLifecycleListenerImpl</listener-class>
    </listener>
</weblogic-application>

Design Issue 2: Session names in WebLogic 10.x

We can not use the session name as-is as part of the MBean registration name because the characters ":" and "'" are reserved in JMX. The session name will be undergo character replacement of ":," into "_"

EclipseLink_Domain:Name=Development_file_/C_/opt/wls103/user_projects/domains/base_domain/servers/AdminServer/tmp/_WL_user/_appsdir_weblogicEAR7_ear/jmidq0/weblogicEJB.jar-unifiedWebLogicEL7,Type=Configuration

Design Issue 3: Initial state of MBean registration

We will default to "registration" for the WebLogic platform. The server administrator can disable registration for either bean using the 2 system properties [eclipselink.register.dev.mbean] or [eclipselink.register.run.mbean]. At the user level, registration can also be disabled by setting the property [] in sessions.xml or using a SessionCustomizer for JPA applications.

Design Issue 4: MBean Unregistration

MBeans will be unregistered just before a session logout. This would occur on a server shutdown/restart, an EAR undeploy/redeploy or a programmatic session logout such as the one that occurs on the DevelopmentServices MBean action "refreshProject".

There is currently an issue #3 238343 with security on WebLogic 10.3 that may extend to 9.0 where we get a weblogic.management.NoAccessRuntimeException when we try mBeanServerRuntime.unregisterMBean(name).

Design Issue 5: Where to bootstrap MBean registration

In the past the MBeans were registered along with the CMP 2.x beans in ProjectDeployment.deployEJB(). In EclipseLink we need a suitable place for registration to occur.

Option 1: Register in JPA EM predeploy

The predeploy option is only available in pure JPA applications and is not available to EclipseLink ORM applications. Also, creating MBean instances requires a logged in session to associate with - we don't have any sessions at the predeploy stage to use

In Use - Option 2: Register in ServerPlatformBase during postLogin

In DatabaseSessionImpl.postConnectDatasource() we execute getServerPlatform().registerMBean() which will run in the generic superclass ServerPlatformBase which will invoke a callback to WebLogic_10_Platform.serverSpecificRegisterMBean() that registers the 2 MBeans (UML Sequence diagram required)

In EclipseLink the MBean registration and unregistration occurs in the platform class. For WebLogic we have the following callback functions implemented.

org.eclipse.persistence.platform.server.wls.WebLogic_10_Platform extends WebLogic_9_Platform
public void serverSpecificRegisterMBean()
public void serverSpecificUnregisterMBean()

Design Issue 6: Exception Handling

We will log warning messages and the stack trace for exceptions involving naming, security and session collision

Use Cases

UC1: EclipseLink managed MBean registration

UC2: Application managed MBean registration

=== UC3: No MBean registration

UC3.1 No MBean registration because JVM properties and sessions.xml element are both not set

UC3.2 No MBean registration sessions.xml element is not set

UC3.3 No MBean registration because JVM properties are not set

UC4: Variant: Attempt to register 2 sessions with the same name

Fails before MBean registration step as expected with

Exception Description: Attempted to redeploy a session named eclipselinkwls without closing it.

UC5: Variant: Attempt to register with a default EAR session containing a ":"

Converted to to "_" and processed

UC6: Variant: Attempt to register with a named session containing a space

<property name="eclipselink.session-name" value="eclipselink wls"/>

Proceeds ok

UC7: Exception handling

UC7.1: NoAccessRuntimeException

weblogic.management.NoAccessRuntimeException: Access not allowed for subject: principals=[], on ResourceType: Reporting Action: unregister, Target: null

Testing

A formal JMX J2SE client test suite is required.

Manual Testing Results

Action: Runtime | resetAllConnections

[EL Config]: 2008.06.24 09:34:32.072--ServerSession(31078592)--Connection(4360542)--Thread(Thread[RMI TCP Connection(2)-10.156.52.98,5,RMI Runtime])--Connected: jdbc:bea:oracle://127.0.0.1:1521;CATALOGOPTIONS=2;CONNECTIONRETRYDELAY=1;SUPPORTLINKS=false;MAXPOOLEDSTATEMENTS=0;KEYSTORE=;ENABLECANCELTIMEOUT=false;TRUSTSTOREPASSWORD=;VALIDATESERVERCERTIFICATE=true;CODEPAGEOVERRIDE=;REFCURSORSUPPORT=true;KEYSTOREPASSWORD=;CONNECTIONRETRYCOUNT=5;SENDFLOATPARAMETERSASSTRING=false;COMMITBEHAVIOR=serverDefault;TNSSERVERNAME=;BATCHPERFORMANCEWORKAROUND=false;INITIALIZATIONSTRING=;RESULTSETMETADATAOPTIONS=0;QUERYTIMEOUT=0;HOSTNAMEINCERTIFICATE=;WIREPROTOCOLMODE=1;CATALOGINCLUDESSYNONYMS=true;JAVADOUBLETOSTRING=false;LOADLIBRARYPATH=;IMPORTSTATEMENTPOOL=;ALTERNATESERVERS=;KEYPASSWORD=;ENCRYPTIONMETHOD=noEncryption;CONVERTNULL=1;TRUSTSTORE=;TNSNAMESFILE=;AUTHENTICATIONMETHOD=auto;SERVICENAME=;SERVERTYPE=;LOADBALANCING=false;SID=orcl;WORKAROUNDS=0;INSENSITIVERESULTSETBUFFERSIZE=2048;SYSLOGINROLE=;FETCHTSWTZASTIMESTAMP=false

Action: Runtime | getNumberOfObjectsInIdentityMap(org.eclipse.persistence.example.unified.business.StatLabel) == 84

[EL Config]: 2008.06.24 09:34:32.072--ServerSession(31078592)--Connection(4360542)--Thread(Thread[RMI TCP Connection(2)-10.156.52.98,5,RMI Runtime])--Connected: jdbc:bea:oracle://127.0.0.1:1521;CATALOGOPTIONS=2;CONNECTIONRETRYDELAY=1;SUPPORTLINKS=false;MAXPOOLEDSTATEMENTS=0;KEYSTORE=;ENABLECANCELTIMEOUT=false;TRUSTSTOREPASSWORD=;VALIDATESERVERCERTIFICATE=true;CODEPAGEOVERRIDE=;REFCURSORSUPPORT=true;KEYSTOREPASSWORD=;CONNECTIONRETRYCOUNT=5;SENDFLOATPARAMETERSASSTRING=false;COMMITBEHAVIOR=serverDefault;TNSSERVERNAME=;BATCHPERFORMANCEWORKAROUND=false;INITIALIZATIONSTRING=;RESULTSETMETADATAOPTIONS=0;QUERYTIMEOUT=0;HOSTNAMEINCERTIFICATE=;WIREPROTOCOLMODE=1;CATALOGINCLUDESSYNONYMS=true;JAVADOUBLETOSTRING=false;LOADLIBRARYPATH=;IMPORTSTATEMENTPOOL=;ALTERNATESERVERS=;KEYPASSWORD=;ENCRYPTIONMETHOD=noEncryption;CONVERTNULL=1;TRUSTSTORE=;TNSNAMESFILE=;AUTHENTICATIONMETHOD=auto;SERVICENAME=;SERVERTYPE=;LOADBALANCING=false;SID=orcl;WORKAROUNDS=0;INSENSITIVERESULTSETBUFFERSIZE=2048;SYSLOGINROLE=;FETCHTSWTZASTIMESTAMP=false


Action: DevelopmentServices | initializeIdentityMap p1=org.eclipse.persistence.example.unified.business.StatLabel

[EL Finer]: 2008.06.24 08:58:13.722--ServerSession(32676101)--Thread(Thread[RMI TCP Connection(16)-10.156.52.98,5,RMI Runtime])--
initialize identitymaps
[EL Finer]: 2008.06.24 08:59:04.004--ServerSession(32676101)--Thread(Thread[RMI TCP Connection(18)-10.156.52.98,5,RMI Runtime])--
initialize identitymap: class org.eclipse.persistence.example.unified.business.StatLabel

Extended Manual Testing

We need access to a cluster and need to setup multiple connection pools.

API

No new jar dependencies.

The JMX API is included in J2SE 1.5 (new to J2SE 1.5 from J2EE 1.4) - the interfaces from this JMX API is used even though the implementation uses weblogic specific weblogic.management API during runtime.

There is a JMX server now in the 1.5 SE JRE

J2SE 1.5 JMX

JMX used to be in J2EE 1.4

J2EE 1.4 JMX


  • UML Class Diagram

Eclipselink uml design jmx.jpg

  • UML Sequence Diagram

GUI

<JAVA_HOME>/bin/JConsole client

You should see the following EclipseLink MBeans off the root of the JNDI tree. In this example there are 2 separate EARs deployed to WebLogic - each with its own set of MBeans based on the login session.

Eclipselink jmx mbeans in jconsole.jpg

Config files

Documentation

http://wiki.eclipse.org/Integrating_EclipseLink_with_an_Application_Server_(ELUG)#How_to_Integrate_JMX

- move and rewrite for WebLogic

http://wiki.eclipse.org/Configuring_a_Session_%28ELUG%29#Configuring_the_Server_Platform

- WebLogic replaces the other server in

"Check this field to configure the EclipseLink runtime to enable the deployment of a JMX MBean that allows monitoring of the EclipseLink session. Currently, this is only supported for "

Open Issues

Issue # Owner Description / Notes
I1 mobrien 238408 Add cache synchronization and clustering service functionality to developmentServices MBean
I2 238246 Wiki Documentation changes
I3 mobrien 238252 Method exceptions are not logged - they are only propagated to the client UI
I4 mobrien 238343 unregisterMBean() causes NoAccessRuntimeException after successful registration
I5 mobrien Investigate session timeout behavior
I6 mobrien Investigate if DevelopmentServices.refreshProject() should unregister MBean via its logout/login sequence
I7 mobrien 238412 - Add J2SE scriptable JMX Client test suite
I8 mobrien Test this MBean implementation on other application servers and WLS 6-9

Decisions

Issue # Description / Notes Decision

Future Considerations

During the research for this project the following items were identified as out of scope but are captured here as potential future enhancements. If agreed upon during the review process these should be logged in the bug system.

  • OC4J, WebSphere, JBoss, Geronimo specific MBean support

Copyright © Eclipse Foundation, Inc. All Rights Reserved.