2 Replies Latest reply on Jan 3, 2012 2:19 PM by frankie007

    Stacktrace of failed operation (management api)

    frankie007 Newbie

      Hello,

       

      I would like to now if it is possible to get the full stacktrace of the reason of why the execution of an operation failed?

      In the case I'm currently facing I only get a short error message in the failure-description.

       

      I'll try to explain my problem in short.

      I'm trying to add a jms connection factory using the native management api.

      The result of the operation I'm executing is the following:

      ...

      ModelNode returnVal = client.execute(operation);

      String failure = returnVal.get("failure-description").asString();

      results in the following output:

      [JBAS014671: Failed services={"jboss.messaging.default.jms.connection-factory.testConnectionFactory" => "org.jboss.msc.service.StartException in service jboss.messaging.default.jms.connection-factory.testConnectionFactory: JBAS011639: Failed to create connection-factory"}]

       

      I would like to now if it is possible to get the full stacktrace of the reason of why the operation failed. When I dive into the code I think that this is the place where this exception is raised. I would like to get access to the full stacktrace of this startexception. How should I do this?

       

       

      package org.jboss.as.messaging.jms;

      ...

      class ConnectionFactoryService implements Service<Void> {

      ...

         /** {@inheritDoc} */

          public synchronized void start(StartContext context) throws StartException {

              final JMSServerManager jmsManager = jmsServer.getValue();

              try {

                  MockContext.pushBindingTrap();

                  try {

                      jmsManager.createConnectionFactory(false, configuration, configuration.getBindings());

                  } finally {

                      final ServiceTarget target = context.getChildTarget();

                      final Map<String, Object> bindings = MockContext.popTrappedBindings();

                      for(Map.Entry<String, Object> binding : bindings.entrySet()) {

                          final ContextNames.BindInfo bindInfo = ContextNames.bindInfoFor(binding.getKey());

                          final BinderService binderService = new BinderService(bindInfo.getBindName());

                          target.addService(bindInfo.getBinderServiceName(), binderService)

                              .addDependency(bindInfo.getParentContextServiceName(), ServiceBasedNamingStore.class, binderService.getNamingStoreInjector())

                              .addInjection(binderService.getManagedObjectInjector(), new ValueManagedReferenceFactory(Values.immediateValue(binding.getValue())))

                              .setInitialMode(ServiceController.Mode.ACTIVE)

                              .install();

                      }

                  }

              } catch (Exception e) {

                  throw new StartException("failed to create connection-factory", e);

              }

          }

       

      Thanks a lot