on 10-05-2007 12:03 PM
Hi All,
We are trying to implement code at client AWT application side where we want
everytime client wins in case of CONFLICT situation. We tried to use the following code
(taken from javadoc) - This code is applied at activateApplication() method:
try {
MeIterator it =
SmartSyncRuntime
.getInstance()
.getInboxNotifier()
.getErrorConflictInbox()
.getSyncBoResponses(
SyncBoStatic
.syncBoDescriptorFacade
.getSyncBoDescriptor(
"ZOR_T"),
SyncBoResponseType.CONFLICT);
while (it.hasNext()) {
SyncBoResponse resp = (SyncBoResponse) it.next();
resp.acceptClientSyncBo();
}
} catch (SmartSyncException e) {
} catch (PersistenceException e) {
}
But when we try to run the application through SAP Netweaver Studio following error at
console is displayed and application also does not start:
com.sap.ip.me.utils.NestableRuntimeException: Error during query creation: AttributeDescriptor descriptor is NULL
at com.sap.ip.me.persist.core.SingleConditionImpl.<init>(SingleConditionImpl.java:45)
at com.sap.ip.me.persist.core.QueryRuntimeImpl.createICondition(QueryRuntimeImpl.java:170)
at com.sap.ip.me.smartsync.data.SyncBoResponseImpl.createConditionForSyncBoDescriptor(SyncBoResponseImpl.java:156)
at com.sap.ip.me.smartsync.data.ErrorInboxImpl.getSyncBoResponsesWithoutTx(ErrorInboxImpl.java:171)
at com.sap.ip.me.smartsync.data.ErrorInboxImpl.getSyncBoResponses(ErrorInboxImpl.java:194)
at com.meridium.ui.UIFactory.getPanel(UIFactory.java:179)
at com.meridium.OperatorRounds.getRootPanel(OperatorRounds.java:29)
at com.sap.ip.me.awtapps.home.HomeFrame.makeAppVisible(HomeFrame.java:1265)
at com.sap.ip.me.awtapps.home.HomeFrame.startApp(HomeFrame.java:2673)
at com.sap.ip.me.awtapps.home.HomeFrame.action(HomeFrame.java:707)
at java.awt.Component.handleEvent(Component.java:5341)
at com.sap.ip.me.awtapps.home.HomeFrame.handleEvent(HomeFrame.java:1012)
at java.awt.Window.postEvent(Window.java:1614)
at java.awt.Component.postEvent(Component.java:3895)
at java.awt.Component.postEvent(Component.java:3895)
at java.awt.Component.postEvent(Component.java:3895)
at java.awt.Component.dispatchEventImpl(Component.java:3631)
at java.awt.Component.dispatchEvent(Component.java:3477)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:480)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
At MI Server side, we have set the <b>Conflict Handling and Error Handling</b> option to
"APPLICATION".
We are using MI 7.0 SP 9.
Can anybody please guide us where we are going wrong?
Regards,
Gopal
Hi,
could you run
SyncBoStatic.syncBoDescriptorFacade.getSyncBoDescriptor("ZOR_T")
in separate Line? It seems this returns NULL - is your parameter "ZOR_T" correct?
But if you have a general rule anyway, why do you not setup the server then a general "Client Wins"?
Hope this helps you to continue in your project.
Have fun,
Oliver
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Oliver,
Thanks for reply. Yes you were right that exception was pointing to line
"SyncBoStatic.syncBoDescriptorFacade.getSyncBoDescriptor("ZOR_T") " . But
parameter "ZOR_T is absolutely right.
Now we have declared syncBoDescriptor as class variable and when I used this
class variable, no exception is showing up. I declared syncBoDescriptor as follows:
private static final SyncBoDescriptor syncBoDescriptor = SyncBoStatic
.syncBoDescriptorFacade
.getSyncBoDescriptor("ZOR_T");
We used this syncBoDescriptor varaiable to obtain syncBoResponses with
respect to ZOR_T syncBos.
Though code is now not throwing any exception but still our code is not
accepting client side syncBos. It is being replaced by server syncBos for ZOR_T
syncBos.
Now we are trying to do some other workaround to resolve this problem. Now
we are trying to avoid the conflict altogether so such situation does not arise at all.
Regards,
Gopal
hi gopal,
since you are including your code inside the activateApplication method, i think
this will not work in some or most cases. initApplication is called first then the
activateApplication where the context switching is being handled. this is something
not quite documented on what is being made available right after your app is activated.
in your case, it looks like the repositories are not yet ready or switched to your
application context before your application is activated. i would suggest to have
your code move into the doHandleEvent method where you will be processing that
for the default event when your application is first invoked. I just listed up the order
of methods getting invoked when an app is started.
MyApplication.Constructor invoked.
MyApplication.init invoked.
MyApplication.getApplicationName invoked.
MyApplication.initApplication invoked.
MyApplication.activateApplication invoked.
MyApplication.getApplicationName invoked.
MyApplication.doHandleEvent invoked.
regards
jo
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Oliver and Jo,
We are very very thankful to you people for suggesting us the solutions. Even though we were not able to test what have been suggested by you as we found out the workaround to avoid conflict altogether and thus make the application work smoothly. But the answers provided by you people were great and certainly increased our knowledge. It will certainly help us in future. If any similiar situation arises, certainly the solution provided by you people will be used to resolve the issue.
Regards,
Gopal
Hi Gopal,
just to get you right: You do not have this error if you get an item from the server, but you get your Exception when you have created an item of this SyncBO on the client? So lets say we have SyncBO Z_EXAMPLE. If I get an instance of Z_EXAMPLE from the server to the client and change it, everything is ok. But if I create an instance of Z_EXAMPLE on the client then I run into that exception?
Well, in this case, I would ask for the status of the SyncBO. If you get an item from the Server it is in State G.
Well, I think if you get the message only on locally created objects, these are either of status I, L or S. After the second sync circle this item is in state G as well and then everything should be fine.
The following stati are available:
Z_EXAMPLEItem.getSyncStatus() == BusinessObject.STATUS_GLOBAL
BusinessObject is of type: com.sap.mbs.core.api.BusinessObject
Status could be:
STATUS_INITIAL
STATUS_LOCAL
STATUS_UNLINKED
STATUS_IN_SYNC
STATUS_GLOBAL
ONLY apply Conflict handler it if it is STATUS_GLOBAL
Hope this helps to solve your problem!
Regards,
Oliver
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.