How to configure WebSphere Application Server JVM setting using wsadmin
Purpose – Configuring WebSphere Application Server JVM setting using wsadmin
Creating JVM
################################################################################################
wsadmin>nodeName=AdminControl.getNode()
wsadmin>print nodeName
desktop1Node01
wsadmin>print AdminServerManagement.createApplicationServer(nodeName,”novicejava2″,”default”)
—————————————————————
AdminServerManagement: Create an application server on a given node
Node name: desktop1Node01
New Server name: novicejava2
Optional parameter:
Template name: default
Usage: AdminServerManagement.createApplicationServer(“desktop1Node01”, “novicejava2”, “default”)
Return: The configuration ID of the new application server.
—————————————————————-
novicejava2(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#Server_1466562188235)
Setting HTTP Session ID Reuse
################################################################################################
wsadmin>server = AdminConfig.getid(“/Server:novicejava2/”)
wsadmin>print server
novicejava2(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#Server_1466562188235)
wsadmin>serverSessionManager = AdminConfig.list(“SessionManager”,server)
wsadmin>print serverSessionManager
(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#SessionManager_1466562188237)
wsadmin>print AdminConfig.create(“Property”,serverSessionManager,'[[name “HttpSessionIdReuse”] [value “true”] [required “false”]]’)
HttpSessionIdReuse(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#Property_1466562586717)
wsadmin>print AdminConfig.save()
Setting cookie name
################################################################################################
wsadmin>server = AdminConfig.getid(“/Server:novicejava2/”)
wsadmin>print server
novicejava2(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#Server_1466562188235)
wsadmin>serverWebContainer = AdminConfig.list(“WebContainer”,server)
wsadmin>print serverWebContainer
(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#WebContainer_1466562188237)
wsadmin>sessman = AdminConfig.list(“SessionManager”,serverWebContainer)
wsadmin>print sessman
(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#SessionManager_1466562188237)
wsadmin>cookies = AdminConfig.showAttribute(sessman,’defaultCookieSettings’)
wsadmin>print cookies
JSESSIONID(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#Cookie_1466562188237)
wsadmin>print AdminConfig.showall(cookies)
[domain []]
[httpOnly true]
[maximumAge -1]
[name JSESSIONID]
[path /]
[secure false]
[useContextRootAsPath false]
wsadmin>print AdminConfig.modify(cookies,'[[name “novicejava2_JESSIONID”]]’)
wsadmin>print AdminConfig.showall(cookies)
[domain []]
[httpOnly true]
[maximumAge -1]
[name novicejava2_JESSIONID]
[path /]
[secure false]
[useContextRootAsPath false]
Setting HTTP Session cloneid
################################################################################################
wsadmin>server = AdminConfig.getid(“/Server:novicejava2/”)
wsadmin>print server
novicejava2(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#Server_1466562188235)
wsadmin>serverWebContainer = AdminConfig.list(“WebContainer”,server)
wsadmin>print serverWebContainer
(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#WebContainer_1466562188237)
wsadmin>print AdminConfig.create(“Property”,serverWebContainer,'[[name “HttpSessionCloneId”] [description “HTTP Session clone id”] [value “novicejava2_cloneid”] [required “false”]]’)
HttpSessionCloneId(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#Property_1466564416330)
wsadmin>print AdminConfig.save()
Custom JVM property
################################################################################################
wsadmin>jvm = AdminConfig.getid(“/Server:novicejava2/JavaProcessDef:/JavaVirtualMachine:/”)
wsadmin>print jvm
(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#JavaVirtualMachine_1466562188237)
wsadmin>print AdminConfig.create(“Property”,jvm,'[[name “java.home”] [value “NA”] [required “false”] [description “java home”]]’)
java.home(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#Property_1466566025277)
Setting JVM Heap Size
################################################################################################
wsadmin>server = AdminConfig.getid(“/Server:novicejava2/”)
wsadmin>print server
novicejava2(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#Server_1466562188235)
wsadmin>print AdminTask.setJVMProperties(‘[-serverName “novicejava2” -nodeName “desktop1Node01” -initialHeapSize 512 -maximumHeapSize 512]’)
Setting JVM ClassLoading Policy
################################################################################################
wsadmin>ApplicationServer = AdminConfig.getid(“/Server:novicejava2/ApplicationServer:/”)
wsadmin>print ApplicationServer
(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#ApplicationServer_1466562188237)
wsadmin>print AdminConfig.modify(ApplicationServer,'[[applicationClassLoaderPolicy “SINGLE”] [name “novicejava2”] [applicationClassLoadingMode “PARENT_LAST”] [id “-1”]]’)
wsadmin>print AdminConfig.save()
Setting Generic JVM arguments
################################################################################################
wsadmin>server = AdminConfig.getid(“/Server:novicejava2/”)
wsadmin>print server
novicejava2(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#Server_1466562188235)
wsadmin>genericargs = “-XX:ParallelGCThreads=8 -server -Xverify:none -XX:MaxPermSize=256m -XX:NewSize=384m -XX:MaxNewSize=384m -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+PrintGCDetails -Dfile.encoding=ISO-8859-1 -Duser.language=en -Duser.region=US -Dlogging.level=DEBUG -Dlogging.level.thirdparty=ERROR -Dlogging.level.thirdparty.http=ERROR -Dlogging.level.thirdparty.hibernate=ERROR -Dlogging.level.interaction.cache=AUDIT
wsadmin>print genericargs
-XX:ParallelGCThreads=8 -server -Xverify:none -XX:MaxPermSize=256m -XX:NewSize=384m -XX:MaxNewSize=384m -XX:SurvivorRatio=8 -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+PrintGCDetails -Dfile.encoding=ISO-8859-1 -Duser.language=en -Duser.region=US -Dlogging.level=DEBUG -Dlogging.level.thirdparty=ERROR -Dlogging.level.thirdparty.http=ERROR -Dlogging.level.thirdparty.hibernate=ERROR -Dlogging.level.interaction.cache=AUDIT
wsadmin>print AdminTask.setJVMProperties(‘[-nodeName “desktop1Node01” -serverName “novicejava2” -genericJvmArguments “‘ + genericargs + ‘”]’)
true
wsadmin>print AdminConfig.save()
Setting JVM classpath
################################################################################################
wsadmin>server = AdminConfig.getid(“/Server:novicejava2/”)
wsadmin>print server
novicejava2(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#Server_1466562188235)
wsadmin>classpath = ‘/opt/WebSphere85/lib/myjar.jar’
wsadmin>print classpath
/opt/WebSphere85/lib/myjar.jar
wsadmin>print AdminTask.setJVMProperties(‘[-nodeName “desktop1Node01” -serverName “novicejava2” -classpath “‘ + classpath + ‘”]’)
wsadmin>print AdminConfig.save()
Setting JVM Boot classpath
################################################################################################
wsadmin>server = AdminConfig.getid(“/Server:novicejava2/”)
wsadmin>print server
novicejava2(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#Server_1466562188235)
wsadmin>bootclasspath = ‘/opt/WebSphere85/lib/mybootjar.jar’
wsadmin>print bootclasspath
/opt/WebSphere85/lib/mybootjar.jar
wsadmin>print AdminTask.setJVMProperties(‘[-nodeName “desktop1Node01” -serverName “novicejava2” -bootClasspath “‘ + bootclasspath + ‘”]’)
true
wsadmin>print AdminConfig.save()
Setting JVM PORTS
################################################################################################
wsadmin>print AdminControl.getNode()
desktop1Node01
wsadmin>print AdminTask.modifyServerPort(“novicejava2”,'[-nodeName “desktop1Node01” -endPointName “WC_defaulthost” -port “4849” -modifyShared “true”]’)
[[WC_defaulthost [[[host *] [node desktop1Node01] [server novicejava2] [port 4849] ]]] ]
wsadmin>print AdminConfig.save()
Setting Virtual HostAlias Ports
################################################################################################
wsadmin>print AdminControl.getCell()
desktop1Node01Cell
wsadmin>virtualhost = AdminConfig.getid(“/Cell:desktop1Node01Cell/VirtualHost:/”)wsadmin>print virtualhost
admin_host(cells/desktop1Node01Cell|virtualhosts.xml#VirtualHost_2)
default_host(cells/desktop1Node01Cell|virtualhosts.xml#VirtualHost_1)
wsadmin>virtualhost = AdminConfig.getid(“/Cell:desktop1Node01Cell/VirtualHost:default_host/”)
wsadmin>print virtualhost
default_host(cells/desktop1Node01Cell|virtualhosts.xml#VirtualHost_1)
wsadmin>print AdminConfig.create(“HostAlias”,virtualhost,'[[hostname “*”] [port “5302”]]’)
(cells/desktop1Node01Cell|virtualhosts.xml#HostAlias_1466579966892)
wsadmin>print AdminConfig.save()
Enabling HTTP access logging in JVM
################################################################################################
wsadmin>server = AdminConfig.getid(“/Server:novicejava2/”)
wsadmin>print server
novicejava2(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#Server_1466562188235)
wsadmin>logservice = AdminConfig.list(“HTTPAccessLoggingService”,server)
wsadmin>print logservice
(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#HTTPAccessLoggingService_1466562188236)
wsadmin>print AdminConfig.modify(logservice,'[[accessLog [[filePath ${SERVER_LOG_ROOT}/http_access.log] [maximumSize 10]]] [enable true] [enableAccessLogging true] [enableErrorLogging true] [errorLog [[filePath ${SERVER_LOG_ROOT}/http_error.log] [maximumSize 10]]]]’)
wsadmin>print AdminConfig.save()
Setting WebContainer ThreadPool
################################################################################################
wsadmin>AdminServerManagement.configureThreadPool(“desktop1Node01″,”novicejava2″,”ThreadPoolManager”,”WebContainer”,”100″,”55″,”60000″)
—————————————————————
AdminServerManagement: Configuring ThreadPool
nodeName: desktop1Node01
serverName: novicejava2
parentType: ThreadPoolManager
threadPoolName: WebContainer
maximumSize: 100
minimumSize: 55
inactivityTimeout: 60000
Optional Attributes:
otherAttributeList []
Usage: AdminServerManagement.configureThreadPool(“desktop1Node01”, “novicejava2”, “ThreadPoolManager”, “WebContainer”, “‘100′”, “’55′”, “‘60000′”)
Return: If the command is successful, a value of 1 is returned.
—————————————————————
[customProperties []]
[inactivityTimeout 60000]
[isGrowable false]
[maximumSize 100]
[minimumSize 55]
[name WebContainer]
1
Setting Plugin Configuration properties
################################################################################################
wsadmin>server = AdminConfig.getid(“/Server:novicejava2/”)
wsadmin>print server
novicejava2(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#Server_1466562188235)
wsadmin>wsplugin = AdminConfig.list(“WebserverPluginSettings”,server)
wsadmin>print wsplugin
(cells/desktop1Node01Cell/nodes/desktop1Node01/servers/novicejava2|server.xml#WebserverPluginSettings_1466562188237)
wsadmin>print AdminConfig.modify(wsplugin,'[[ExtendedHandshake false] [ConnectTimeout 5] [WaitForContinue false] [ServerIOTimeout 60] [MaxConnections 0]]’)
wsadmin>print AdminConfig.save()
Hope you enjoyed reading this article. Thank you.
Leave a Reply
You must be logged in to post a comment.