BTM
  1. BTM
  2. BTM-9

BitronixTransactionManager JNDI reference throws NPE on toString()

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2
    • Fix Version/s: 1.3
    • Labels:
      None
    • Number of attachments :
      0

      Description

      The documented way to bind BTM in Jetty is as follows:

      <New class="org.mortbay.jetty.plus.naming.Transaction">
      <Arg><Call name="getTransactionManager" class="bitronix.tm.TransactionManagerServices" /></Arg>
      </New>

      but this throws a NPE on recent versions of Jetty (6.1.5+ are affected):

      java.lang.NullPointerException
      at javax.naming.Reference.toString(Unknown Source)
      at java.lang.String.valueOf(Unknown Source)
      at java.lang.StringBuffer.append(Unknown Source)
      at org.mortbay.naming.NamingContext.addBinding(NamingContext.java:1367)
      at org.mortbay.naming.NamingContext.rebind(NamingContext.java:1000)
      at org.mortbay.naming.NamingContext.rebind(NamingContext.java:1063)
      at org.mortbay.naming.local.localContextRoot.rebind(localContextRoot.java:213)
      at javax.naming.InitialContext.rebind(Unknown Source)
      at org.mortbay.naming.NamingUtil.bind(NamingUtil.java:80)
      at org.mortbay.jetty.plus.naming.NamingEntry.save(NamingEntry.java:511)
      at org.mortbay.jetty.plus.naming.NamingEntry.<init>(NamingEntry.java:360)
      at org.mortbay.jetty.plus.naming.Transaction.<init>(Transaction.java:57)
      ...

      See: http://www.nabble.com/Jetty-Problem-to15641646.html

        Activity

        Hide
        Ludovic Orban added a comment -

        Jetty acquires a javax.naming.Reference object of the BitronixTransactionManager, logs it then binds it to JNDI. The log is calling Reference.toString() which throws that NPE.

        A new StringRefAddr("TransactionManager", "BitronixTransactionManager") has been added to the generated javax.naming.Reference object created by BitronixTransactionManager.getReference().

        This prevents the Reference from throwing a NPE when toString() is called on it.

        Show
        Ludovic Orban added a comment - Jetty acquires a javax.naming.Reference object of the BitronixTransactionManager, logs it then binds it to JNDI. The log is calling Reference.toString() which throws that NPE. A new StringRefAddr("TransactionManager", "BitronixTransactionManager") has been added to the generated javax.naming.Reference object created by BitronixTransactionManager.getReference(). This prevents the Reference from throwing a NPE when toString() is called on it.

          People

          • Assignee:
            Ludovic Orban
            Reporter:
            Ludovic Orban
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: