Changed Jira client import script fails after update to 2022.1

I've applied changes to some of the Jira client import scripts. Those changes worked with YT releases 2021.3 and 2021.4.

Now I'm using 2022.1 and an import from Jira fails.

I'm starting the import wizard, enter my connection information as usual and click next expecting to get a list of Jira projects to choose from.

But the wizard stepping fails. I get this message just above the Back/Next/Cancel bottons: 

class jetbrains.youtrack.scripts.model.MiscellaneousObject cannot be cast to class jetbrains.youtrack.imports.model.ScriptingClientFactory (jetbrains.youtrack.scripts.model.MiscellaneousObject and jetbrains.youtrack.imports.model.ScriptingClientFactory are in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @33f57cbc)

In order to narrow down the issue I've started with a new Docker container of YT 2022.1.

Without any changes to the OOTB Jira client import scripts (i.e. none of my changes applied) the wizard step works well. I get the list of Jira projects to choose from. As it is just a test of the step in the wizard I cancel the import.

Now, in the workflow editor I applied one small of my changes that used to work. In @jetbrains/youtrack-jira-client/links I've changed line 18 to be a comment:

If I start the wizard again I run into the same error mentioned above.

It feels like any changes to the OOTB script triggers some compile step that fails for some dependency issue. But this is just a vague guess.

Any hint how to solve or workaround this issue are very welcome!

 

0
8 comments

Update: I tried it again with a new container this morning and after changing the import scripts in the workflow editorof YT the import wizard still worked and the actual import was successful as well. The difference I'm aware of is that the host for the Docker host (WSL/Ubuntu) was updated this morning. I'll test whether it does work with editing the scripts externally and uploading them (https://www.jetbrains.com/help/youtrack/devportal/js-workflow-external-editor.html) which is the usual approach I use to edit YT scripts.

0

Update 2: If I edit the scripts externally and upload them via npm as documented then I run into the error in the import wizard. So a development environment that worked fine for editing scripts for UT 2021.3 and 2021.4 seems not to be usable anymore after the YT system has been upgraded to 2022.1.

0

Hi Stefan,

I've just checked YouTrack 2022.1 in Docker but wasn't able to reproduce the problem. Let me please clarify a couple of details to investigate it further:

I tried it again with a new container this morning and after changing the import scripts in the workflow editorof YT the import wizard still worked and the actual import was successful as well

Am I right the customized import worked well when running a fresh 2022.1 installation? Is the problem reproduced only for upgraded YouTrack?

Also, am I right that uploading scripts via npm results in the error even on the fresh installation?

I'm looking forward to your reply. 

0

Hi Anastasia Bartasheva,

no, the problem happens with both, an upgraded installation as well as a new one.

Yes, the problem seems to happen only if I upload the script via npm, even on a fresh installation.

I re-checked this morning:

1. created new container from 2022.1 image

2. set up YouTrack freshly in the new container

3. opened workflow editor of YouTrack with the link in the the Jira import wizard

4. applied change (the small one mentioned in my OP)

5. in the Jira import wizard clicked Next on the host and credential step

=> no error, all fine

6. cancelled Jira import wizard

7. downloaded @jetbrains/youtrack-jira-client via npm

8. reverted the change I've made in step 4. in a local editor

9. uploaded @jetbrains/youtrack-jira-client via npm 

10. started the Jira import wizard again and clicked Next on the host and credential step

=> ERROR

Thanks!

Stefan

 

0

Anastasia Bartasheva: I've done the 10 steps documented in my previous post but with a 2021.4 container. Step 10 did not produce an error - all went fine.

0

Anastasia Bartasheva: Here is the error from the import.log:

 21/02/22 11:01:31,946 ERROR [@tzJobProcessor0] [ImportLogging                 ] [] Script failed with error: class jetbrains.youtrack.scripts.model.MiscellaneousObject cannot be cast to class jetbrains.youtrack.imports.model.ScriptingClientFactory (jetbrains.youtrack.scripts.model.MiscellaneousObject and jetbrains.youtrack.imports.model.ScriptingClientFactory are in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @7a401ae3)
 java.lang.ClassCastException: class jetbrains.youtrack.scripts.model.MiscellaneousObject cannot be cast to class jetbrains.youtrack.imports.model.ScriptingClientFactory (jetbrains.youtrack.scripts.model.MiscellaneousObject and jetbrains.youtrack.imports.model.ScriptingClientFactory are in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @7a401ae3)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt.getClientFactory(ImportExtensions.kt:62)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt.access$getClientFactory(ImportExtensions.kt:1)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt$doStart$3$1$1.invoke(ImportExtensions.kt:108)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt$doStart$3$1$1.invoke(ImportExtensions.kt:107)
    at com.jetbrains.teamsys.dnq.database.TransientEntityStoreExt.transactional(TransientEntityStoreExt.kt:51)
    at com.jetbrains.teamsys.dnq.database.TransientEntityStoreImpl.transactional(TransientEntityStoreImpl.kt:103)
    at jetbrains.exodus.database.TransientEntityStore$DefaultImpls.transactional$default(TransientEntityStore.kt:86)
    at jetbrains.youtrack.core.legacy.LegacySupportKt.transactional(LegacySupport.kt:19)
    at jetbrains.youtrack.core.legacy.LegacySupportKt.transactional$default(LegacySupport.kt:18)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt$doStart$3$1.invoke(ImportExtensions.kt:107)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt$doStart$3$1.invoke(ImportExtensions.kt:99)
    at jetbrains.youtrack.scripts.internals.ExceptionsProcessingKt.withScriptingAndDBExceptionsProcessing(ExceptionsProcessing.kt:77)
    at jetbrains.youtrack.scripts.internals.ExceptionsProcessingKt.withScriptingAndDBExceptionsProcessing$default(ExceptionsProcessing.kt:17)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt$doStart$3.invoke(ImportExtensions.kt:99)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt$doStart$3.invoke(ImportExtensions.kt:98)
    at jetbrains.youtrack.scripts.internals.RunInContextKt.runInContext(RunInContext.kt:17)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt.doStart(ImportExtensions.kt:98)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt$start$1.invoke(ImportExtensions.kt:79)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt$start$1.invoke(ImportExtensions.kt:78)
    at jetbrains.youtrack.scheduling.LocalQuartzExecutor$executeNonTransactional$1.invoke(LocalQuartzExecutor.kt:29)
    at jetbrains.youtrack.scheduling.LocalQuartzExecutor$executeNonTransactional$1.invoke(LocalQuartzExecutor.kt:28)
    at jetbrains.youtrack.core.jobProcessor.NamedThreadJobProcessorKt.withLocalName(NamedThreadJobProcessor.kt:39)
    at jetbrains.youtrack.scheduling.QuartzJobProcessorKt.asNonTxLocalRunnable$lambda-0(QuartzJobProcessor.kt:40)
    at jetbrains.exodus.core.execution.RunnableJob.execute(RunnableJob.java:41)
    at jetbrains.exodus.core.execution.Job.run(Job.java:135)
    at jetbrains.exodus.core.execution.ThreadJobProcessor.executeJob(ThreadJobProcessor.java:132)
    at jetbrains.exodus.core.execution.JobProcessorQueueAdapter.doExecuteJob(JobProcessorQueueAdapter.java:251)
    at jetbrains.exodus.core.execution.JobProcessorQueueAdapter.doJobs(JobProcessorQueueAdapter.java:161)
    at jetbrains.exodus.core.execution.ThreadJobProcessor.run(ThreadJobProcessor.java:110)
    at java.base/java.lang.Thread.run(Thread.java:829)
21/02/22 11:01:31,960 ERROR [@tzJobProcessor0] [ImportLogging                 ] [] Import failed with error: class jetbrains.youtrack.scripts.model.MiscellaneousObject cannot be cast to class jetbrains.youtrack.imports.model.ScriptingClientFactory (jetbrains.youtrack.scripts.model.MiscellaneousObject and jetbrains.youtrack.imports.model.ScriptingClientFactory are in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @7a401ae3)
 jetbrains.youtrack.scripts.sandbox.EvaluationException: class jetbrains.youtrack.scripts.model.MiscellaneousObject cannot be cast to class jetbrains.youtrack.imports.model.ScriptingClientFactory (jetbrains.youtrack.scripts.model.MiscellaneousObject and jetbrains.youtrack.imports.model.ScriptingClientFactory are in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @7a401ae3)
    at jetbrains.youtrack.scripts.internals.ExceptionsProcessingKt.withScriptingAndDBExceptionsProcessing$createException(ExceptionsProcessing.kt:28)
    at jetbrains.youtrack.scripts.internals.ExceptionsProcessingKt.withScriptingAndDBExceptionsProcessing$wrapSpecifically(ExceptionsProcessing.kt:61)
    at jetbrains.youtrack.scripts.internals.ExceptionsProcessingKt.withScriptingAndDBExceptionsProcessing(ExceptionsProcessing.kt:86)
    at jetbrains.youtrack.scripts.internals.ExceptionsProcessingKt.withScriptingAndDBExceptionsProcessing$default(ExceptionsProcessing.kt:17)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt$doStart$3.invoke(ImportExtensions.kt:99)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt$doStart$3.invoke(ImportExtensions.kt:98)
    at jetbrains.youtrack.scripts.internals.RunInContextKt.runInContext(RunInContext.kt:17)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt.doStart(ImportExtensions.kt:98)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt$start$1.invoke(ImportExtensions.kt:79)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt$start$1.invoke(ImportExtensions.kt:78)
    at jetbrains.youtrack.scheduling.LocalQuartzExecutor$executeNonTransactional$1.invoke(LocalQuartzExecutor.kt:29)
    at jetbrains.youtrack.scheduling.LocalQuartzExecutor$executeNonTransactional$1.invoke(LocalQuartzExecutor.kt:28)
    at jetbrains.youtrack.core.jobProcessor.NamedThreadJobProcessorKt.withLocalName(NamedThreadJobProcessor.kt:39)
    at jetbrains.youtrack.scheduling.QuartzJobProcessorKt.asNonTxLocalRunnable$lambda-0(QuartzJobProcessor.kt:40)
    at jetbrains.exodus.core.execution.RunnableJob.execute(RunnableJob.java:41)
    at jetbrains.exodus.core.execution.Job.run(Job.java:135)
    at jetbrains.exodus.core.execution.ThreadJobProcessor.executeJob(ThreadJobProcessor.java:132)
    at jetbrains.exodus.core.execution.JobProcessorQueueAdapter.doExecuteJob(JobProcessorQueueAdapter.java:251)
    at jetbrains.exodus.core.execution.JobProcessorQueueAdapter.doJobs(JobProcessorQueueAdapter.java:161)
    at jetbrains.exodus.core.execution.ThreadJobProcessor.run(ThreadJobProcessor.java:110)
    at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.ClassCastException: class jetbrains.youtrack.scripts.model.MiscellaneousObject cannot be cast to class jetbrains.youtrack.imports.model.ScriptingClientFactory (jetbrains.youtrack.scripts.model.MiscellaneousObject and jetbrains.youtrack.imports.model.ScriptingClientFactory are in unnamed module of loader org.eclipse.jetty.webapp.WebAppClassLoader @7a401ae3)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt.getClientFactory(ImportExtensions.kt:62)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt.access$getClientFactory(ImportExtensions.kt:1)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt$doStart$3$1$1.invoke(ImportExtensions.kt:108)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt$doStart$3$1$1.invoke(ImportExtensions.kt:107)
    at com.jetbrains.teamsys.dnq.database.TransientEntityStoreExt.transactional(TransientEntityStoreExt.kt:51)
    at com.jetbrains.teamsys.dnq.database.TransientEntityStoreImpl.transactional(TransientEntityStoreImpl.kt:103)
    at jetbrains.exodus.database.TransientEntityStore$DefaultImpls.transactional$default(TransientEntityStore.kt:86)
    at jetbrains.youtrack.core.legacy.LegacySupportKt.transactional(LegacySupport.kt:19)
    at jetbrains.youtrack.core.legacy.LegacySupportKt.transactional$default(LegacySupport.kt:18)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt$doStart$3$1.invoke(ImportExtensions.kt:107)
    at jetbrains.youtrack.imports.model.ImportExtensionsKt$doStart$3$1.invoke(ImportExtensions.kt:99)
    at jetbrains.youtrack.scripts.internals.ExceptionsProcessingKt.withScriptingAndDBExceptionsProcessing(ExceptionsProcessing.kt:77)
    ... 18 more 
1

Hi Stefan,

I appreciate your patience. I have reproduced the issue and filed a bug: https://youtrack.jetbrains.com/issue/JT-68744. Please feel free to follow it to receive further updates. Thank you for reporting about it!

0

Please sign in to leave a comment.