Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Scriptrunner error when reading Table Grid Next Gen complaining of truffle-api.jar not in Classpath

Erwin Oliva March 15, 2023

When attempting to use scriptrunner scriptfield to read a Table Grid next gen field, we get the following error:

com.idalko.tgng.jira.server.api.GridException: evalBuildGrid: Error evaluating Javascript: No language and polyglot implementation was found on the classpath. Make sure the truffle-api.jar is on the classpath.!
at com.idalko.tgng.jira.server.api.GridServiceImpl$.com$idalko$tgng$jira$server$api$GridServiceImpl$$handleErrors(GridServiceImpl.scala:116)
at com.idalko.tgng.jira.server.api.GridServiceImpl.readFieldData(GridServiceImpl.scala:38)
at com.idalko.tgng.jira.server.api.GridService$readFieldData.call(Unknown Source)
at Script112.run(Script112.groovy:32)

Script looks like this...

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.plugin.PluginAccessor
import com.atlassian.jira.user.ApplicationUser

import org.apache.log4j.Category
def Category log = Category.getInstance("com.onresolve.jira.groovy.PostFunction")
log.setLevel(org.apache.log4j.Level.DEBUG)
log.debug "debug statements"

def issueManager = ComponentAccessor.getIssueManager();
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def issuetype = issue.getIssueType().name
def issueId = issue.getId()

// Set "Budget Estimate" field id
Long tgngCustomFieldId = 21000

ApplicationUser user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

// Get GridService - Ignore error messages for the plugin and service
PluginAccessor pluginAccessor = ComponentAccessor.getPluginAccessor()
Class apiServiceClass = pluginAccessor.getClassLoader().findClass("com.idalko.tgng.jira.server.api.GridService")
def gridService = ComponentAccessor.getOSGiComponentInstanceOfType(apiServiceClass)

// Read field data
def fieldData = gridService.readFieldData(issueId, tgngCustomFieldId, user, null)
def gridRows = fieldData.getRows()

StringBuilder result = new StringBuilder()
for (row in gridRows) {
def columns = row.getColumns()
result.append("${columns.get("Platform")};")
result.append("${columns.get("Type")};;")
result.append("${columns.get("Jan")};")
result.append("${columns.get("Feb")};")
result.append("${columns.get("Mar")};")
result.append("${columns.get("Apr")};")
result.append("${columns.get("May")};")
result.append("${columns.get("Jun")};")
result.append("${columns.get("Jul")};")
result.append("${columns.get("Aug")};")
result.append("${columns.get("Sep")};")
result.append("${columns.get("Oct")};")
result.append("${columns.get("Nov")};")
result.append("${columns.get("Dec")};")
result.append("${columns.get("EstComplete")};,")
}

return result

3 answers

0 votes
Polina Semykina April 13, 2023

Dear @Erwin Oliva ,

Have you found a solution to this error?

We have the same.

 

Thank you and Kind regards,

Polina

Erwin Oliva April 18, 2023

No, I'm afraid I have not found a solution to this error.

Polina Semykina April 19, 2023

I've created a ticket to the vendor describing this issue and got updates :

"It seems like the issue you are facing is related to a known bug. A corresponding internal ticket was created and forwarded to the development team for analysis and resolution.

I am attaching this ticket to the internal bug ticket so that you are notified as soon as new information is available or the fix is released as a part of a new version!

As a workaround we can provide you with a custom build that includes the fix for your issue, however, could you please let me know what version of Jira you use?"

:)

Like • Erwin Oliva likes this
Polina Semykina April 19, 2023

You can create yours to speed them up here :

https://support.idalko.com/plugins/servlet/desk/portal/5

Like • Erwin Oliva likes this
Erwin Oliva April 19, 2023

Thank you for your suggestion Polina.  I also raised the issue with Idalko.

Cheers, Erwin

Like • Polina Semykina likes this
0 votes
Connie H Johnston April 12, 2023

Since the last Table Grid Addon version update our script is now failing with the following error code: We have not made any changes to the script!  

Script function failed on Automation for Jira rule:

Script function failed on Automation for Jira rule: AUTOMATION RULE NAME, file: <inline script>, error: com.idalko.tgng.jira.server.api.GridException: evalBuildGrid: Error evaluating Javascript&colon; No language and polyglot implementation was found on the classpath. Make sure the truffle-api.jar is on the classpath.!

Was your script running correctly prior to the Table Grid Update?? 

Erwin Oliva April 18, 2023

Yes, my script was running previously, but in our case we upgraded to DataCenter JIRA so I am not sure if table grid was also updated.  But for sure, it was running previously.

0 votes
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 16, 2023

Hi @Erwin Oliva

Instead of using the:

Class apiServiceClass = pluginAccessor.getClassLoader().findClass("com.idalko.tgng.jira.server.api.GridService")
def gridService = ComponentAccessor.getOSGiComponentInstanceOfType(apiServiceClass)

Have you tried using the @WithPlugin and @PluginModulue annotations as shown in this ScriptRunner documentation?

You can refer to the sample code provided in the AdaptavistLibrary, which uses the @WithPlugin and @PluginModule annotations.

This community discussion has some examples of using @WithPlugin and @PluginModule for the Idalko plugin.

I hope this helps to answer your question. :-)

Thank you and Kind regards,

Ram

Erwin Oliva April 18, 2023

Hi @Ram Kumar Aravindakshan _Adaptavist_

Do I only use one or both?  Do I also need to add an import statement?

I am getting this error

General error during conversion: Requested plugin com.idalko.jira.plugins.igrid.api.data.TGEGridTableDataManager was not installed/enabled, compiling source unit Script42.groovy.

 when I try to add the following:

import com.idalko.jira.plugins.igrid.api.data.TGEGridTableDataManage
@WithPlugin("com.idalko.jira.plugins.igrid.api.data.TGEGridTableDataManager")
@PluginModule
TGEGridTableDataManager tgeGridDataManager
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 19, 2023

Hi @Erwin Oliva

To answer your question, yes you will need to use both.

Also, when using the @WithPlugin annotation, you will only need to specify the package name. The absolute class name is not required.

For example:

@WithPlugin("com.idalko.plugins.igrid.api.data")

@PluginModule
TGEGridTableDataManager tgeGridDataManager

I hope this helps to answer your question. :-)

Thank you and Kind regards,

Ram 

Like • 2 people like this
Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 26, 2023

Hi @Erwin Oliva

Is your question answered?

If yes kindly accept the solution provided.

Thank you and Kind regards,

Ram

Erwin Oliva April 26, 2023

Hi @Ram Kumar Aravindakshan _Adaptavist_ ,

Unfortunately it didn't work for me.  I have to open a support ticket with the Table Grid vendor and am waiting for its resolution still.

Regards,

Erwin

Erwin Oliva April 26, 2023

It appears that Idalko (vendor) wants us to upgrade to the latest version.  We are on 1.13.7, and latest version is 1.13.8

Ram Kumar Aravindakshan _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 26, 2023

Hi @Erwin Oliva

Thanks for the update.

It would be best to upgrade your plugin(s) to the latest release to ensure that you have all the new features and bug fixes.

Thank you and Kind regards,

Ram

Tamás Kiss _META-INF_
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 5, 2023

I had the same problem, and succesfully solved with the followings:

  • Update from 1.13.7 to 1.13.8
  • Used the following codes:

 

final Long tableGridCustomFieldId = 11107

import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.onresolve.scriptrunner.runner.customisers.PluginModule
import com.idalko.tgng.jira.server.api.GridService

@WithPlugin('tge.cloud')

@PluginModule
GridService gridService

...

def fieldData = gridService.readFieldData(issue.getId(), tableGridCustomFieldId, user, null)
def rows = fieldData.getRows()
Like • Polina Semykina likes this

Suggest an answer

Log in or Sign up to answer