Plugin signing not working pemObject must not be null

Answered

I tried to setup plugin signing as shown here: https://plugins.jetbrains.com/docs/intellij/plugin-signing.html#signing-methods

I have also seen this thread: https://intellij-support.jetbrains.com/hc/en-us/community/posts/4408839632146-Signing-Plugin-always-throws-NullPointerException-pemObject-must-not-be-null?input_string=Plugin%20signing%20not%20working%20pemObject%20must%20not%20be%20null

 

However i can not get it to work, instead i get this exception when i run the signPlugin task:

 

2022-12-17 22:52:16,276 [   2018] SEVERE - #c.i.i.p.PluginManager - Current thread: Thread[AWT-EventQueue-1,6,main]; expected: Thread[AWT-EventQueue-0,6,]
java.lang.IllegalStateException: Current thread: Thread[AWT-EventQueue-1,6,main]; expected: Thread[AWT-EventQueue-0,6,]
    at com.intellij.openapi.application.impl.ReadMostlyRWLock.checkWriteThreadAccess(ReadMostlyRWLock.java:287)
    at com.intellij.openapi.application.impl.ReadMostlyRWLock.writeIntentLock(ReadMostlyRWLock.java:196)
    at com.intellij.openapi.application.impl.ApplicationImpl.acquireWriteIntentLock(ApplicationImpl.java:944)
    at com.intellij.openapi.application.impl.ApplicationImpl.lambda$new$2(ApplicationImpl.java:181)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:393)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
2022-12-17 22:52:16,281 [   2023] SEVERE - #c.i.i.p.PluginManager - IntelliJ IDEA 2022.1.4  Build #IC-221.6008.13
2022-12-17 22:52:16,286 [   2028] SEVERE - #c.i.i.p.PluginManager - JDK: 11.0.15; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o.
2022-12-17 22:52:16,288 [   2030] SEVERE - #c.i.i.p.PluginManager - OS: Linux

Start Failed
Internal error. Please refer to https://jb.gg/ide/critical-startup-errors

java.lang.IllegalStateException: Current thread: Thread[AWT-EventQueue-1,6,main]; expected: Thread[AWT-EventQueue-0,6,]
    at com.intellij.openapi.application.impl.ReadMostlyRWLock.checkWriteThreadAccess(ReadMostlyRWLock.java:287)
    at com.intellij.openapi.application.impl.ReadMostlyRWLock.writeIntentLock(ReadMostlyRWLock.java:196)
    at com.intellij.openapi.application.impl.ApplicationImpl.acquireWriteIntentLock(ApplicationImpl.java:944)
    at com.intellij.openapi.application.impl.ApplicationImpl.lambda$new$2(ApplicationImpl.java:181)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:393)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

-----
Your JRE: 11.0.15+10-b2043.56 amd64 (JetBrains s.r.o.)
/home/xps/.gradle/caches/modules-2/files-2.1/com.jetbrains/jbre/jbr_jcef-11_0_15-linux-x64-b2043.56/extracted/jbr

> Task :buildSearchableOptions FAILED
12 actionable tasks: 12 executed

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':buildSearchableOptions'.
> Process 'command '/home/xps/.gradle/caches/modules-2/files-2.1/com.jetbrains/jbre/jbr_jcef-11_0_15-linux-x64-b2043.56/extracted/jbr/bin/java'' finished with non-zero exit value 3

 

0
8 comments

I am unable to edit the post..... Title not up to date.

0

It turned out that it is impossible to provide environment variables (i.e., through IntelliJ IDEA run configuration) as multiline strings.

With the Gradle IntelliJ Plugin 1.11.1, it'll be possible to pass the base64-encoded values to preserve new lines necessary for correctly interpreting the certificate chain and private key.

0

Thank you for your answer but it has nothing to do with the env variables or plugin signing. My plugin signing works just fine if i set the key and the cert in the build.gradle.kts inside triple quotation marks.

The problem is the buildSearchableOptions task, it failes with the above exception most of the time, after some retries or a IDE restart it works sometimes.

 

What can cause such a problem?

0

The buildSearchableOptions has nothing in common with the plugin signing. Can you please provide your build configuration?

0

build.gradle.kts:

plugins {
    id("java")
    id("org.jetbrains.intellij") version "1.11.0"
    id("io.freefair.lombok") version "6.6"
}

group = "org.test"
version = "0.1.1"

repositories {
    mavenCentral()
}
dependencies {
    implementation("org.projectlombok:lombok:1.18.24")
}

// Configure Gradle IntelliJ Plugin
// Read more: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html
intellij {
    version.set("2022.1.4")
    type.set("IC") // Target IDE Platform

    plugins.set(listOf(/* Plugin Dependencies */))
}

tasks {
    // Set the JVM compatibility versions
    withType<JavaCompile> {
        sourceCompatibility = "11"
        targetCompatibility = "11"
    }

    patchPluginXml {
        sinceBuild.set("221")
        untilBuild.set("231.*")
    }

    signPlugin {
        certificateChain.set(System.getenv("CERTIFICATE_CHAIN"))
        privateKey.set(System.getenv("PRIVATE_KEY"))
        password.set(System.getenv("PRIVATE_KEY_PASSWORD"))
    }

    publishPlugin {
        token.set(System.getenv("PUBLISH_TOKEN"))
    }
}

 

project structure settings:

0

Any update on how to fix this problem ?

0

base64 CERTIFICATE_CHAIN text and PRIVATE_KEY

0

Still getting: pemObject must not be null
PUBLISH_TOKEN="perm:Z…vv2";PRIVATE_KEY="LS…LS0t";CERTIFICATE_CHAIN="LS0t…LS0txLQ==";PRIVATE_KEY_PASSWORD="m0ypass"


 

0

Please sign in to leave a comment.