Getting version mismatch error while updating into DCTM using java - java

I am trying to update into DCTM through java code, below is the code snippet
IDfDocument communication = (IDfDocument) getDfSession().getObject(DfId.valueOf(communicationId));
communication.setString(ATTR_STATUS, status);
communication.save();
but I am getting the below error
Caused by: DfException:: THREAD: be.ing.ca.xpression.DCTM001P-1; MSG: [DM_OBJ_MGR_E_VERSION_MISMATCH]error: "save of object
090283e589bf689d of type xx_document failed because of version
mismatch: old version was 4"; ERRORCODE: 100; NEXT: null
I thinki am getting this error because there is another process which is trying to modify the object ,and when more than one process try to modify anyobject DCTM throws this exception,
But after lot of searching i dident found any solution which can solve this error
If anyone knows the solution please reply..
Link that i refer
http://www.javablog.fr/?s=version+mismatch

Try calling a fetch() on the object before doing updates.
communication.fetch()
There are some optional parameters AFAIK, but it's been a while since I've been fiddling with DCTM.
Best of luck!

Related

Nashorn failed to call a static method of a 3rd party Java class, any solutions?

The code in Nashorn is to parse a very simple JSON string into a JSONObject (com.alibaba.fastjson.JSONObject), simply going as:
var jso = Java.type('com.alibaba.fastjson.JSONObject').parseObject('{"name": "nothing"}');
But when ran the Java project, I received below error message:
Exception in thread "main" javax.script.ScriptException: TypeError: Java.type("com.alibaba.fastjson.JSONObject").parseObject is not a function in <eval> at line number 1
at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:470)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:454)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:406)
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:402)
at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:155)
at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:233)
...
I tried to print(Java.type('com.alibaba.fastjson.JSONObject')), and the class is obviously there with output [JavaClass com.alibaba.fastjson.JSONObject]
Anybody knows what's the root cause of this error, and how to fix it?

java.lang.UnsupportedOperationException: option is not a supported field type

Using the following library
<dependency>
<groupId>net.rcarz</groupId>
<artifactId>jira-client</artifactId>
<version>0.5</version>
</dependency>
I am getting error while executing below code:
BasicCredentials creds = new BasicCredentials("username", "password");
JiraClient jira = new JiraClient("xyz/rest/api/2/issue", creds);
Issue newIssue = jira.createIssue("XYZ", "Bug")
.field(Field.SUMMARY, "tEST bUG")
.field("customfield_20200","No STeps")
.field("customfield_20202","No actual")
.field("customfield_25600",Field.valueById("35650"))
.execute();
Getting error for field("customfield_25600",Field.valueByID("35650"))
Error Description :
java.lang.UnsupportedOperationException: option is not a supported
field type
This is customized field in JIRA.
Please let me know if required more information.
Thanks in advance.
Field#toJson() method had not know about option type in v0.5, it was added later. That is why method throws UnsupportedOperationException. Try to use the latest version from GitHub: https://github.com/rcarz/jira-client
Seems to be a known issue with the library,the field you try to add is probably an option and it is not supported
The error was already reported here:
https://github.com/rcarz/jira-client/issues/123
Hi,
trying to use custom fields, I encounter the following issue :
For a "Select List (single choice)" type of field, I get the following exception when trying to create an issue :
Exception: java.lang.UnsupportedOperationException: option is not a supported field type
at net.rcarz.jiraclient.Field.toJson(Field.java:655)
at net.rcarz.jiraclient.Issue$FluentCreate.executeCreate(Issue.java:104)
at net.rcarz.jiraclient.Issue$FluentCreate.execute(Issue.java:59)
I'm using JIRA v7.1.0-OD-05-006
It seems to have to do with the JIRA version.
Following the link to #154, it seems that it was not fixed.
https://github.com/rcarz/jira-client/pull/154
The issue still persists
Caused by: java.lang.UnsupportedOperationException: option is not a supported field type
at net.rcarz.jiraclient.Field.toJson(Field.java:737)
at net.rcarz.jiraclient.Issue$FluentCreate.executeCreate(Issue.java:102)
at net.rcarz.jiraclient.Issue$FluentCreate.execute(Issue.java:57)
Here is my snippet code looks like. The customfield_12133 is an options.
JiraClient jiraClient;
Issue issue = jiraClient.createIssue("MYPROJECT", "Internal Bug")
.field(Field.SUMMARY, summary)
.field(Field.DESCRIPTION, summary)
.field("customfield_12133", "Other")
.execute();
Finally pull #176 should actually have fixed it:
https://github.com/rcarz/jira-client/pull/176
might be fixed in the next version (0.6) of the library

R Code from java giving error : Error in lev(modelFit) : could not find function "lev"

Am getting RConnection in java, am assigning data by following
rConnection.assign(".tmp.","'{json goes here}'");
rCon.parseAndEval("try(eval(parse(text=model_S(.tmp.))),silent=TRUE)");
when the above call is made am getting
Error in lev(modelFit) : could not find function "lev"
In R, I have installed Caret, Kernlab packages also. When I execute the same code in R, its working fine. but when the call is made from Java, its giving error.
Any inputs will be Helpful. Thankyou.
Using following statement :
rCon.parseAndEval("library(caret)")
resolved the issue.

setVerboseLoggingEnabled(boolean) is undefined for the type Cast.CastOptions.Builder

I am using the CastCompanionLibrary-android and it is throwing the following error all of a sudden. Any ideas ?
The method setVerboseLoggingEnabled(boolean) is undefined for the type
Cast.CastOptions.Builder VideoCastManager.java
/CastCompanionLibrary-android/src/com/google/sample/castcompanionlibrary/cast
Its shows taht this method does infact exist in :
http://developer.android.com/reference/com/google/android/gms/cast/Cast.CastOptions.Builder.html
But when I drill into CastOptions it is no longer there.
Its seems I did an update with the Android SDK manager, but neglected to replace the old jar with the newly update jar.
Did this and it fixed the issue :)

JCO transmits erroneous parameters to "CSAP_MAT_BOM_MAINTAIN"

I am trying to call the function module "CSAP_MAT_BOM_MAINTAIN" to create a BOM in SAP but i get error.
IFunctionTemplate ft = mRepository.getFunctionTemplate("CSAP_MAT_BOM_MAINTAIN");
System.out.println(" Functional Template Created ");
if (ft == null){return;}
JCO.Function function = ft.getFunction();
JCO.ParameterList importparams =function.getImportParameterList();
// Setting HeadData Structure Information
//importparams.setValue("C000000609", "CHANGE_NO");
importparams.setValue("CPF10104", "MATERIAL");
importparams.setValue("1", "BOM_USAGE");
importparams.setValue("0001", "PLANT");
importparams.setValue("01", "ALTERNATIVE");
importparams.setValue("11.11.2011", "VALID_FROM");
importparams.setValue("X", "FL_COMMIT_AND_WAIT");
importparams.setValue("X", "FL_BOM_CREATE");
importparams.setValue("X", "FL_NEW_ITEM");
importparams.setValue("X", "FL_COMPLETE");
importparams.setValue("X", "FL_DEFAULT_VALUES");
JCO.Structure headStructure = importparams.getStructure("I_STKO");
headStructure.setValue("01", "BOM_STATUS");
headStructure.setValue("1", "BASE_QUAN");
headStructure.setValue("KG", "BASE_UNIT");
headStructure.setValue("BOM01", "BOM_GROUP");
JCO.Table stpo = function.getTableParameterList().getTable("T_STPO");
stpo.appendRow();
stpo.setValue("BOM Position 2.1", "ITEM_TEXT1");
stpo.setValue("L", "ITEM_CATEG");
stpo.setValue("L", "ID_ITM_CTG");
stpo.setValue("0010", "ITEM_NO");
stpo.setValue("0010", "ID_ITEM_NO");
stpo.setValue("13", "COMP_QTY");
stpo.setValue("KG", "COMP_UNIT");
stpo.setValue("00000001", "ITEM_NODE");
stpo.setValue("00000001", "ITEM_COUNT");
stpo.setValue("000000000000000000", "DEP_LINK");
stpo.setValue("12345-R6000001", "COMPONENT");
//stpo.setValue("12345-R6000001", "ID_COMP");
JCO.Table stpu = function.getTableParameterList().getTable("T_STPU");
stpu.appendRow();
stpu.setValue("0", "POINTER");
stpu.setValue("00000000", "STLKN");
stpu.setValue("0010", "STPOZ");
stpu.setValue("0001", "UPOSZ");
stpu.setValue("46", "UPMNG");
stpu.setValue("T1", "EBORT");
I get error:
Exception in thread "main" com.sap.mw.jco.JCO$AbapException: (126) ERROR: Terminate processing.
After searching over the internet i found that this error comes when we have wrong input params.
But i am unable to find the error.
Please note that i have limited knowledge about ABAP programming.
Can any one help me?
(126) ABAP EXCEPTION: An exception has been thrown by a function module in the remote system.
I think you should carefully review all of these new parameters, since one is causing a bug in your function.
If you have access to the SAP system, you can run transaction ST22 to get a detailed error log. However, you may need to de-bug within SAP as per Raj's suggestion.

Categories

Resources