Install a .jar file in Jira for generating QR codes

Harald Mayer January 26, 2023

Hey all!

we want to create a scripted custom field via script runner.
This should create a QR image with information from a text custom field.

I use this code here:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue

import com.atlassian.jira.issue.MutableIssue

import com.atlassian.jira.issue.fields.CustomField

import net.glxn.qrgen.QRCode

import net.glxn.qrgen.image.ImageType

def issue = issue as MutableIssue

def customFieldManager = ComponentAccessor.getCustomFieldManager()

def qrCodeField = customFieldManager.getCustomFieldObjectByName("QR Code")

def fkLeitzahlField = customFieldManager.getCustomFieldObjectByName("FKLeitzahl")

def fkLeitzahl = issue.getCustomFieldValue(fkLeitzahlField)

def qrCode = QRCode.from(fkLeitzahl).to(ImageType.PNG)

def qrCodeImage = qrCode.stream()

issue.setCustomFieldValue(qrCodeField, qrCodeImage)

issue.save()


and put the jar file "qrgen-1.3" in atlassian-jira/WEB-INF/lib/ and restarted our two nodes.

Unfortunately, when testing, I get the error that it cannot find this jar file "java.lang.NoClassDefFoundError: net/glxn/qrgen/QRCode".

 

Br Harald

1 answer

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.
January 26, 2023

Hi @Harald Mayer

If you want to add an extern jar file to your Jira instance, you shouldn't add it to the WEB-INF/lib folder.

Instead, you should add it to the <JIRA_HOME>/lib/ folder, for example, /opt/atlassian/jira/lib/ and you will need to restart your Jira instance.

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

Thank you and Kind regards,

Ram

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events