Uploaded image for project: 'Byteman'
  1. Byteman
  2. BYTEMAN-183

Null Pointer Exception when trying to get the stack trace on java.lang.String$CaseInsensitiveComparator.compare method

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical Critical
    • 2.0.0
    • 1.6.0
    • Trigger Injection
    • None
    • Hide

      Use the script I reference in the problem description, and add the javaagent line I show in the description, and boot AS 7.1.0.CR1* (have to build from source), using standalone.sh.

      Show
      Use the script I reference in the problem description, and add the javaagent line I show in the description, and boot AS 7.1.0.CR1* (have to build from source), using standalone.sh.
    • Workaround Exists
    • Hide

      Change the METHOD clause to a specific matching method

      METHOD compare(String,String)

      Show
      Change the METHOD clause to a specific matching method METHOD compare(String,String)

      I have been attempting to get the call stack from AS 7.1.0.CR1-SNAPSHOT (built on December 8, 2011), on the compare method of the inner class String$CaseInsensitiveComparator.compare(String, String). This method is the number one consumer of CPU in my profiling, and I want to see who is calling it.

      I created the following script:

      RULE String Inner Class CaseInsensitiveComparator call stack
      CLASS java.lang.String$CaseInsensitiveComparator
      METHOD compare
      AT EXIT
      IF TRUE
      DO traceStack("*** Called compare(" + $1 + ") in thread " + Thread.currentThread().getName() + "\n", 20)
      ENDRULE

      I have the following command line options from standalone.conf:

      JAVA_OPTS="-Xms11264m -Xmx11264m -XX:+UseLargePages -XX:+UseCompressedOops -XX:+UseParallelOldGC -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Dorg.apache.coyote.http11.HttpProtocol.MAX_KEEP_ALIVE_REQUESTS=-1 -javaagent:${BYTEMAN_HOME}/lib/byteman.jar=script:${BYTEMAN_HOME}/CaseInsensitiveCompareCallStack.btm,boot:${BYTEMAN_HOME}/lib/byteman.jar -Dorg.jboss.byteman.transform.all"

      I actually received the first call stack output on boot of the application server, as follows:

          • Called compare(originalType) in thread main
            java.lang.String$CaseInsensitiveComparator.compare(String.java:1240)
            java.lang.String$CaseInsensitiveComparator.compare(String.java:1220)
            java.util.TreeMap.put(TreeMap.java:547)
            javax.management.ImmutableDescriptor.makeMap(ImmutableDescriptor.java:166)
            javax.management.ImmutableDescriptor.<init>(ImmutableDescriptor.java:73)
            com.sun.jmx.mbeanserver.MXBeanIntrospector.typeDescriptor(MXBeanIntrospector.java:296)
            com.sun.jmx.mbeanserver.MXBeanIntrospector.getMBeanAttributeInfo(MXBeanIntrospector.java:159)
            com.sun.jmx.mbeanserver.MXBeanIntrospector.getMBeanAttributeInfo(MXBeanIntrospector.java:51)
            com.sun.jmx.mbeanserver.MBeanIntrospector$MBeanInfoMaker.visitAttribute(MBeanIntrospector.java:311)
            com.sun.jmx.mbeanserver.MBeanAnalyzer.visit(MBeanAnalyzer.java:70)
            com.sun.jmx.mbeanserver.MBeanIntrospector.makeInterfaceMBeanInfo(MBeanIntrospector.java:207)
            com.sun.jmx.mbeanserver.MBeanIntrospector.getPerInterface(MBeanIntrospector.java:182)
            com.sun.jmx.mbeanserver.MBeanSupport.<init>(MBeanSupport.java:136)
            com.sun.jmx.mbeanserver.MXBeanSupport.<init>(MXBeanSupport.java:66)
            javax.management.StandardMBean.construct(StandardMBean.java:177)
            javax.management.StandardMBean.<init>(StandardMBean.java:270)
            sun.management.ManagementFactory.addMXBean(ManagementFactory.java:267)
            sun.management.ManagementFactory.createPlatformMBeanServer(ManagementFactory.java:322)
            java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:521)
            org.jboss.modules.Main.main(Main.java:292)

      But right after that I get the following null pointer exception:

      Exception in thread "main" java.lang.IllegalArgumentException: javax.management.NotCompliantMBeanException: java.lang.management.ClassLoadingMXBean: null
      at javax.management.StandardMBean.<init>(StandardMBean.java:272)
      at sun.management.ManagementFactory.addMXBean(ManagementFactory.java:267)
      at sun.management.ManagementFactory.createPlatformMBeanServer(ManagementFactory.java:322)
      at java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:521)
      at org.jboss.modules.Main.main(Main.java:292)
      Caused by: javax.management.NotCompliantMBeanException: java.lang.management.ClassLoadingMXBean: null
      at com.sun.jmx.mbeanserver.Introspector.throwException(Introspector.java:419)
      at com.sun.jmx.mbeanserver.MBeanIntrospector.getPerInterface(MBeanIntrospector.java:189)
      at com.sun.jmx.mbeanserver.MBeanSupport.<init>(MBeanSupport.java:136)
      at com.sun.jmx.mbeanserver.MXBeanSupport.<init>(MXBeanSupport.java:66)
      at javax.management.StandardMBean.construct(StandardMBean.java:177)
      at javax.management.StandardMBean.<init>(StandardMBean.java:270)
      ... 4 more
      Caused by: java.lang.NullPointerException
      at org.jboss.byteman.rule.Rule.installParameters(Rule.java:595)
      at org.jboss.byteman.rule.Rule.typeCheck(Rule.java:519)
      at org.jboss.byteman.rule.Rule.ensureTypeCheckedCompiled(Rule.java:449)
      at org.jboss.byteman.rule.Rule.execute(Rule.java:670)
      at org.jboss.byteman.rule.Rule.execute(Rule.java:651)
      at java.lang.String$CaseInsensitiveComparator.compare(String.java:1220)
      at java.util.TreeMap.put(TreeMap.java:547)
      at javax.management.ImmutableDescriptor.makeMap(ImmutableDescriptor.java:166)
      at javax.management.ImmutableDescriptor.<init>(ImmutableDescriptor.java:73)
      at com.sun.jmx.mbeanserver.MXBeanIntrospector.typeDescriptor(MXBeanIntrospector.java:296)
      at com.sun.jmx.mbeanserver.MXBeanIntrospector.getMBeanAttributeInfo(MXBeanIntrospector.java:159)
      at com.sun.jmx.mbeanserver.MXBeanIntrospector.getMBeanAttributeInfo(MXBeanIntrospector.java:51)
      at com.sun.jmx.mbeanserver.MBeanIntrospector$MBeanInfoMaker.visitAttribute(MBeanIntrospector.java:311)
      at com.sun.jmx.mbeanserver.MBeanAnalyzer.visit(MBeanAnalyzer.java:70)
      at com.sun.jmx.mbeanserver.MBeanIntrospector.makeInterfaceMBeanInfo(MBeanIntrospector.java:207)
      at com.sun.jmx.mbeanserver.MBeanIntrospector.getPerInterface(MBeanIntrospector.java:182)
      ... 8 more

            rhn-engineering-adinn Andrew Dinn
            rhn-engineering-anmiller Andrig Miller (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: