RuntimeException: org/zeromq/ZMQ

I'm trying to use a library that includes the jzmq library. IntelliJ doesn't notice any problems with my usages of that library and the code builds fine with "atlas-run". However, when the hook plugin that includes this code is run, I get a run time exception referencing zeromq. Here's the stack trace:

java.lang.RuntimeException: org/zeromq/ZMQ
    at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:54) ~[atlassian-event-2.3.5.jar:na]
    at com.atlassian.stash.internal.event.AsyncBatchingInvokersTransformer$AsyncInvokerBatch.invoke(AsyncBatchingInvokersTransformer.java:100) ~[stash-platform-3.10.2.jar:na]
    at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:48) [atlassian-event-2.3.5.jar:na]
    at com.atlassian.sal.core.executor.ThreadLocalDelegateRunnable.run(ThreadLocalDelegateRunnable.java:38) [sal-core-2.13.4.jar:na]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_45]
    at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
    ... 1 frame trimmed
Caused by: java.lang.NoClassDefFoundError: org/zeromq/ZMQ
    at org.fedoraproject.fedmsg.FedmsgConnection.connect(FedmsgConnection.java:36) ~[na:na]
    at com.atlassian.stash.plugin.fedmsghook.hook.FedmsgPostReceiveHook.postReceive(FedmsgPostReceiveHook.java:29) ~[na:na]
    at com.atlassian.stash.internal.hook.repository.AsyncPostReceiveRepositoryHookAdapter$1.visit(AsyncPostReceiveRepositoryHookAdapter.java:49) ~[stash-service-impl-3.10.2.jar:na]
    at com.atlassian.stash.internal.hook.repository.AsyncPostReceiveRepositoryHookAdapter$1.visit(AsyncPostReceiveRepositoryHookAdapter.java:45) ~[stash-service-impl-3.10.2.jar:na]
    at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService$RepositoryHookPagedTransactionCallback.doInTransaction(DefaultRepositoryHookService.java:611) ~[stash-service-impl-3.10.2.jar:na]
    at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService$RepositoryHookPagedTransactionCallback.doInTransaction(DefaultRepositoryHookService.java:587) ~[stash-service-impl-3.10.2.jar:na]
    at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) ~[spring-tx-4.1.6.RELEASE.jar:4.1.6.RELEASE]
    at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService.visitEnabledHooks(DefaultRepositoryHookService.java:304) ~[stash-service-impl-3.10.2.jar:na]
    at com.atlassian.stash.internal.hook.repository.AsyncPostReceiveRepositoryHookAdapter.postReceive(AsyncPostReceiveRepositoryHookAdapter.java:45) ~[stash-service-impl-3.10.2.jar:na]
    at com.atlassian.stash.internal.hook.repository.AsyncPostReceiveRepositoryHookAdapter.onRefsChangedEvent(AsyncPostReceiveRepositoryHookAdapter.java:40) ~[stash-service-impl-3.10.2.jar:na]
    at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:36) ~[atlassian-event-2.3.5.jar:na]
    ... 6 common frames omitted
Caused by: java.lang.ClassNotFoundException: org.zeromq.ZMQ not found by com.atlassian.stash.plugin.fedmsghook.fedmsghook-plugin [53]
    at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:812) ~[org.apache.felix.framework-3.2.2.jar:na]
    ... 17 common frames omitted

It seems that the atlassian SDK is incapable of finding the zeromq libraries, so I tried to add the the location of the libraries to my PATH variable, but that didn't seem to make a difference. Any ideas?

Thanks!

3 answers

1 accepted

I defined my dependencies like this and then it worked:

<dependency>
    <groupId>org.zeromq</groupId>
    <artifactId>jeromq</artifactId>
    <version>0.3.3</version>
    <scope>runtime</scope>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.3.0</version>
    <scope>runtime</scope>
</dependency>
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.3.0</version>
    <scope>runtime</scope>
</dependency>
<dependency>
    <groupId>org.bouncycastle</groupId>
    <artifactId>bcpkix-jdk15on</artifactId>
    <version>1.50</version>
    <scope>runtime</scope>
</dependency>
<dependency>
    <groupId>org.functionaljava</groupId>
    <artifactId>functionaljava</artifactId>
    <version>3.1</version>
    <scope>runtime</scope>
</dependency>

The key was stating the scope as runtime.

0 vote

Hi Scott,

 

how did you define the dependency on the ZeroMQ library in your pom?

Cheers,

Stefan

I don't think I defined it at all. Here's what I did exactly: 1. I cloned this: https://github.com/fedora-infra/fedmsg-java 2. I built it to generate a .jar for source, doc, and classes. 3. I imported all of those .jars into IntelliJ, and all of my references to the classes that I was using from that library worked. 4. Built it with atlassian-sdk 5. Runtime exception I'll look into defining dependencies in the pom.xml

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

1,995 views 1 5
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you