2 Replies Latest reply on Feb 15, 2011 2:55 AM by Nourso

    NPE in JavaAdpater


      Hello all,


      This is a more precise question than my other one : http://forums.adobe.com/message/3462732#3462732


      Can someone tell me what the causes can be that I get a NullPointer Exception in  flex.data.adapters.JavaAdapter which ships with Adobe LCDS 3.1?


      Log :

          at flex.data.adapters.JavaAdapter.invokeAssemblerSync(JavaAdapter.java:1 741)


      I really need to go on on this one.


      The other question is left open to be able to post the entire solution when it is done


      Thank you in advance!

        • 1. Re: NPE in JavaAdpater
          Ashish Vashisht Level 1



          Looks like the DataServiceTransaction is null.


          Before you begin interacting with a DMS destination, you need to start a DataServiceTransaction using DST.begin() http://help.adobe.com/en_US/LiveCycleDataServicesES/3.1/Javadoc/flex/data/DataServiceTrans action.html#begin(boolean)


          After you are done, you should use commit() or rollback() to finish the transaction as applicable.




          Ashish Vashisht

          1 person found this helpful
          • 2. Re: NPE in JavaAdpater
            Nourso Level 1

            [Ashish Vashisht : reply to this so that I can give you the correct answer points]


            This was the problem, effectively. I had to code a bit more to get it working (compared to the doc examples...) :


            // One MUST instantiate a DataServiceTransaction to be able to send anything (NullPointerException)
            DataServiceTransaction dtx = null;
            boolean isOwnerOfTx = false;
            try {
                // if already in an Assembler, we do have a tx ==> no commit nor rollback!
                dtx = DataServiceTransaction.getCurrentDataServiceTransaction();
                if (dtx == null) {
                    // new one, no JTA ==> ourselves : commit or rollback
                    isOwnerOfTx = true;
                    dtx = DataServiceTransaction.begin(FlexUtils.LCDS_MESSAGEBROKER_NAME, false);
            <use dtx  or simply send a DataMessage via the MessageBroker>

            } catch (Exception e) {
                // Log exception, but no impact on the business
                LOG.error("Could not send the creation to LCDS", e);
                if (isOwnerOfTx) {
            } finally {
                try {
                    if (isOwnerOfTx && (dtx != null)) {
                } catch (Exception e) {
                    // swallow
                    LOG.error("Could not send the creation to LCDS (@commit of the DataServiceTransaction)", e);


            Super-thanks, anyways!