Expand my Community achievements bar.

NullPointerException when calling DataServiceTransaction.refreshFill

Avatar

Level 1
Hi,



I have tried almost every combination of possibilities and I
am still getting java.lang.NullPointerException on a refreshFill.



My Assembler fills are very generic, as in a lot of different
possible fillitems combinations. So, after an update (createItem or
deleteItem), I would like the Flex frontend determine which fills
need to be refreshed.



I created a RemoteObject on the same smtp channel as the
assemblers, in one of my assemblers. This remoteObject is working
well as other method are executing and returning correct results.



My RemoteObject method is the following:

public void redoFill(String destination, List fillParameters)

{

DataServiceTransaction dtx =
DataServiceTransaction.getCurrentDataServiceTransaction();

dtx.refreshFill( destination, fillParameters); // this line
consistently throws a NullPointerException

//even dtx.refreshFill(destination,
Arrays.asList(fillParameters) throws the same exception

}



A trace in this method shows that the correct destination is
transferred as well as the correct fillParameters



The parameters on the frontend are added to the calling
method like ("my.destination", ["fillparam1", 2, ...etc..])



What do I need to change in the java method to make this
work?



The relevant stackTrace on the java side is where
com.my.flex.assembler.SessionAssembler.redoFill is my
RemotingObject method:

java.lang.NullPointerException

at
com.my.flex.assembler.SessionAssembler.resetFill(SessionAssembler.java:60)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown
Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at
flex.messaging.services.remoting.adapters.JavaAdapter.invoke(JavaAdapter.java:168)

at
flex.messaging.services.RemotingService.serviceMessage(RemotingService.java:173)

at
flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java:1165)

at
flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndpoint.java:727)

at
flex.messaging.endpoints.rtmp.AbstractRTMPServer.dispatchMessage(AbstractRTMPServer.java:816)

at
flex.messaging.endpoints.rtmp.NIORTMPConnection$RTMPReader.run(NIORTMPConnection.java:424)

at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:665)

at
edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:690)

at java.lang.Thread.run(Unknown Source)



Thanks for any help,



-Rogier Doekes
2 Replies

Avatar

Former Community Member
The stack trace suggests that it's an error in
SessionAssembler line 60 which is your own class. Did you try
debugging through that class?

Avatar

Level 4
I'd hazard a get that this is returning null:



DataServiceTransaction dtx =
DataServiceTransaction.getCurrentDataServiceTransaction();



According to the javadocs (
http://livedocs.adobe.com/livecycle/es/sdkHelp/programmer/lcdsjavadoc/flex/data/DataServiceTransacti...
):

Returns:

the current DataServiceTransaction or null if there is no
transaction currently associated with the current thread.









I believe you must call the begin() method to create the
transaction if there is no transaction already associated with the
thread.