Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to to programmatically create diagnostic profile : Please , Help!

938644Sep 26 2012 — edited Oct 3 2012
Hi,
I already opened a question about that , but since I got a wrong answer ( I think , or i did something wrong ..) , and , since it is very
important for me :
May I have a full example showing how to create diagnostic profile programmatically ?
I tried many ways to do that , but nothing works !
Among the things i did was ( for example ) , something like this :

.......

DiagnosticProfileBean bean=new DiagnosticProfileBean();

// setting the bean ..
bean.setLatency(latency);
bean.setThroughput(throughput);
String profileName="EyalProfile";



//DataAggregation d;
bean.setProfileName(profileName);
bean.setApplicationId("com.oracle.training.jms@defaultserver");
//bean.setApplicationId("Application");
bean.setState(true);
bean.setStageObjectName(this.stageObjectIn);
bean.setServerId("defaultserver");
.... and so on ..


try {

dataServiceName =ObjectName.getInstance("com.bea.wlevs:Name=DataServiceFactory,Type=DataServiceFactory,Application=com.oracle.cep.training.jms");

// DataServiceFactoryMBeanImpl dsfmb= (DataServiceFactoryMBeanImpl) MBeanServerInvocationHandler.newProxyInstance(connection,dataServiceName, "com.bea.wlevs:Name=DataServiceFactory,Type=DataServiceFactory,Application=com.oracle.cep.training.jms", ObjectName.class, false);
} catch (Exception e) {
throw new RuntimeException(e);
}
DataServiceFactoryMBean dataServiceFactory=null;
DiagnosticProfileBean bean=new DiagnosticProfileBean();

try {

dataServiceFactory=(DataServiceFactoryMBean) MBeanServerInvocationHandler.newProxyInstance(connection, dataServiceName, DataServiceFactoryMBean.class, false);
// dataServiceFactory=(DataServiceFactoryMBean) MBeanServerInvocationHandler.newProxyInstance(connection, dataServiceName, DataServiceFactoryMBean.class, false);

it all works fine untul now , but when the program runs this :
dataServiceFactory.createDiagnosticProfileMBean(bean, bean.getServerId());

I got the "InstanceNotFoundException " ..

It seems that the problem related to the connection object , but I'm not sure about it.
The connection was created in 2 different ways , neither of them worked.

1. ..
connector = JMXConnectorFactory.newJMXConnector(serviceUrl, env);

connector.connect(env);
connection = connector.getMBeanServerConnection();
....
2.
...............

MBeanServer connection =ManagementFactory.getPlatformMBeanServer();
....

Does anyone have a clue about it??
Example ( that works ..) will be appriciated !

If someone has anothar way that works, it is OK to.just something to create a profile ..

Again, it very important for me, i'm stuck because of that .
Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 31 2012
Added on Sep 26 2012
6 comments
565 views