如何使用 IBM JAVA API 将 ManageModules 中的 Class 加载程序顺序更改为父顺序?
How to Change the Class loader order to parent last in ManageModules using IBM JAVA API?
我想使用 WebSphere Java 管理 API.
将 Web 应用程序的 class 加载器顺序更改为 PARENT_LAST
企业应用程序 > MyAppEAR > 管理模块 > MyApp.war
如何使用 ConfigService 获取要设置的属性。
尝试了以下抛出
的代码
java.lang.ClassCastException: java.util.ArrayList cannot be cast to javax.management.AttributeList
at com.kony.admin.deployment.websphere.KonyWebsphereDeployer.updateArtifact(KonyWebsphereDeployer.java:1854)
AttributeList clList = (AttributeList) configService.getAttribute (session, appDeplID, "modules");
ConfigServiceHelper.setAttributeValue (clList, "classloaderMode", "PARENT_LAST");
attrList.add (new Attribute ("modules", clList));
谢谢,
库苏马
下面是解决方法
private void updateArtifactConfig(String appName, DeploymentConfig dc)
throws DeploymentException {
Session session = new Session();
try {
ObjectName[] classLoadersId = configService.resolve(session,
"Deployment=" + appName + "\":ApplicationDeployment:WebModuleDeployment:");
AttributeList attrList = new AttributeList();
AttributeList clList = (AttributeList)configService.getAttribute(session, classLoadersId[0],
"classloader");
ConfigServiceHelper.setAttributeValue(clList, "mode",
"PARENT_LAST");
attrList.add(new Attribute("classloader", clList));
configService.setAttributes(session, classLoadersId[0], attrList);
configService.save(session, true);
} catch (Exception ex) {
LOGGER.error("Not able to update " + appName, ex);
} finally {
try {
configService.discard(session);
} catch (ConfigServiceException csEx) {
LOGGER.error("Not able to discard updateArtifact " + appName + " session", csEx);
} catch (ConnectorException cnEx) {
throw new DeploymentException("Unable to connect to IBM WebSphere Application Server @ "
+ dc.getHostname() + ":" + dc.getPort());
}
}
}
我想使用 WebSphere Java 管理 API.
将 Web 应用程序的 class 加载器顺序更改为 PARENT_LAST企业应用程序 > MyAppEAR > 管理模块 > MyApp.war
如何使用 ConfigService 获取要设置的属性。
尝试了以下抛出
的代码java.lang.ClassCastException: java.util.ArrayList cannot be cast to javax.management.AttributeList at com.kony.admin.deployment.websphere.KonyWebsphereDeployer.updateArtifact(KonyWebsphereDeployer.java:1854)
AttributeList clList = (AttributeList) configService.getAttribute (session, appDeplID, "modules");
ConfigServiceHelper.setAttributeValue (clList, "classloaderMode", "PARENT_LAST");
attrList.add (new Attribute ("modules", clList));
谢谢, 库苏马
下面是解决方法
private void updateArtifactConfig(String appName, DeploymentConfig dc)
throws DeploymentException {
Session session = new Session();
try {
ObjectName[] classLoadersId = configService.resolve(session,
"Deployment=" + appName + "\":ApplicationDeployment:WebModuleDeployment:");
AttributeList attrList = new AttributeList();
AttributeList clList = (AttributeList)configService.getAttribute(session, classLoadersId[0],
"classloader");
ConfigServiceHelper.setAttributeValue(clList, "mode",
"PARENT_LAST");
attrList.add(new Attribute("classloader", clList));
configService.setAttributes(session, classLoadersId[0], attrList);
configService.save(session, true);
} catch (Exception ex) {
LOGGER.error("Not able to update " + appName, ex);
} finally {
try {
configService.discard(session);
} catch (ConfigServiceException csEx) {
LOGGER.error("Not able to discard updateArtifact " + appName + " session", csEx);
} catch (ConnectorException cnEx) {
throw new DeploymentException("Unable to connect to IBM WebSphere Application Server @ "
+ dc.getHostname() + ":" + dc.getPort());
}
}
}