NullPointerException thrown when using TransactionMonitor

Asked by JakubM

When I'm trying to use TransactionMonitor with the following code:

  TransactionMonitor txnmonitor = new TransactionMonitor(getClass(), "sometexthere", MonitoringLevel.INFO);
                ...
  txnmonitor.succeeded();
  txnmonitor.done();

I get the following exception:

[MonitoringEngine:623] [class com.orbitz.monitoring.api.monitor.TransactionMonitor attributes={sequenceId=m, threadId=11768ab, createdAt=Thu Sep 04 15:11:07 WAT 2008, name=[some.secret.here]}level=INFO] will be processed by [com.orbitz.monitoring.lib.processor.AsyncMonitorProcessor@1cc4e47]
[MonitoringEngine:631] Throwable caught while processing [class com.orbitz.monitoring.api.monitor.TransactionMonitor attributes={sequenceId=m, threadId=11768ab, createdAt=Thu Sep 04 15:11:07 WAT 2008, name=[some.secret.here]}level=INFO]; application is unaffected:
java.lang.NullPointerException
 at com.orbitz.monitoring.api.monitor.AbstractCompositeMonitor.getSerializableMomento(AbstractCompositeMonitor.java:97)
 at com.orbitz.monitoring.lib.processor.AsyncMonitorProcessor.monitorCreated(AsyncMonitorProcessor.java:61)
 at com.orbitz.monitoring.api.MonitoringEngine$1.processWithProcessor(MonitoringEngine.java:225)
 at com.orbitz.monitoring.api.MonitoringEngine.handleMonitor(MonitoringEngine.java:629)
 at com.orbitz.monitoring.api.MonitoringEngine.monitorCreated(MonitoringEngine.java:218)
 at com.orbitz.monitoring.api.monitor.AbstractMonitor.init(AbstractMonitor.java:255)
 at com.orbitz.monitoring.api.monitor.AbstractMonitor.<init>(AbstractMonitor.java:57)
 at com.orbitz.monitoring.api.monitor.AbstractCompositeMonitor.<init>(AbstractCompositeMonitor.java:38)
 at com.orbitz.monitoring.api.monitor.TransactionMonitor.<init>(TransactionMonitor.java:51)
 at com.orbitz.monitoring.api.monitor.TransactionMonitor.<init>(TransactionMonitor.java:91)
        [... some secret stack continuation ...]

The _childMonitors member seems to be null.

Cheers,
Jakub

Question information

Language:
English Edit question
Status:
Solved
For:
ERMA Edit question
Assignee:
No assignee Edit question
Solved by:
Matthew Kemp
Solved:
Last query:
Last reply:
Revision history for this message
Stephen Mullins (smullins7) said :
#1

Jakub,
Can you provide me with the code (bootstrap class or Spring wiring) that you used to initialize ERMA?

Revision history for this message
JakubM (jakub-matias) said :
#2

Stephen,

sure:

 <bean class="com.orbitz.monitoring.lib.BaseMonitoringEngineManager" init-method="startup" destroy-method="shutdown">
   <constructor-arg ref="mpf"/>
   <!-- constructor-arg ref="decomposer"/ -->
 </bean>

 <bean id="mpf" class="com.orbitz.monitoring.lib.factory.SimpleMonitorProcessorFactory">
   <constructor-arg>
     <list>
       <ref bean="routeToLog"/>
     </list>
   </constructor-arg>
 </bean>

 <bean id="routeToLog" class="com.orbitz.monitoring.lib.factory.ProcessGroup">
   <description>
     Routes all monitoring events to the log files for easy development testing of instrumentation
   </description>
   <constructor-arg ref="AsyncProcessor"/>
 </bean>

 <bean id="AsyncProcessor" class="com.orbitz.monitoring.lib.processor.AsyncMonitorProcessor">
   <constructor-arg>
     <list>
       <ref bean="LogProcessor"/>
     </list>
   </constructor-arg>
 </bean>

 <bean id="LogProcessor" class="com.orbitz.monitoring.lib.processor.LoggingMonitorProcessor"/>

Revision history for this message
JakubM (jakub-matias) said :
#3

When I switched to this:

 <bean id="routeToLog" class="com.orbitz.monitoring.lib.factory.ProcessGroup">
   <description>
     Routes all monitoring events to the log files for easy development testing of instrumentation
   </description>
   <constructor-arg ref="LogProcessor"/>
 </bean>

 <bean id="LogProcessor" class="com.orbitz.monitoring.lib.processor.LoggingMonitorProcessor"/>

everything is fine.

In first case startup method of LoggingMonitorProcessor was not called.

Jakub

Revision history for this message
Best Matthew Kemp (mattkemp) said :
#4

The reason the second case works is because you a directly supplying the LoggingMonitorProcessor versus going through the AsyncMonitorProcessor. The SimpleMonitorProcessorFactory normally calls startup/shutdown on every MonitorProcessor, but when you're using the AsyncMonitorProcessor it doesn't have a reference to LoggingMonitorProcessor. That fact that AsyncMonitorProcessor does not forward the startup/shutdown calls is a bug. For now just use the LoggingMonitorProcessor.

Revision history for this message
Matt O'Keefe (mokeefe) said :
#5

Concerning the fact that a bug has been exposed, I'm happy to report that a Jira project URL will soon be provided with an estimated delivery by 9/15. This Jira instance will be hosted by Orbitz Worldwide, thanks to corporate support of our open source initiatives. The fact that existing ERMA team members are familiar with Jira will hopefully be beneficial in terms of response to bug and enhancement request reports.

Revision history for this message
JakubM (jakub-matias) said :
#6

Thanks guys for such a quick response - I was going to raise this bug in here but I think I'll wait for Jira to avoid mess.

Don't know though how to classify this on launchpad answers as problem is not solved but I don't need an answer anymore.

Revision history for this message
Matthew Kemp (mattkemp) said :
#7

You can probably classify as solved since we did answer your question. We will add the bug to jira when it comes online.

Revision history for this message
JakubM (jakub-matias) said :
#8

Thanks Matthew Kemp, that solved my question.

Revision history for this message
Matt O'Keefe (mokeefe) said :
#9

Jira is available now, and I created http://code.orbitz.net/browse/ERMA-1 for this issue.