Starting Cockpit in Embedded mode

I’m trying to deploy Cockpit on jetty using embedded mode.
Here is the main class I used for this:

I run this class using these commands:
mvn exec:java -Dexec.mainClass=“org.camunda.bpm.Main”
but I got this exception:
2020-05-05 17:50:22.638:WARN:oejuc.AbstractLifeCycle:FAILED o.e.j.w.WebAppContext{/camunda,file:/home/shehab/git/webalo/camunda-bpm-webapp/src/main/java/org/camunda/bpm/cockpit/impl/web/bootstrap/}: java.lang.NoClassDefFoundError: org/camunda/bpm/engine/ProcessEngineException
java.lang.NoClassDefFoundError: org/camunda/bpm/engine/ProcessEngineException
at org.camunda.bpm.cockpit.impl.web.bootstrap.CockpitContainerBootstrap$CockpitEnvironment.setup(
at org.camunda.bpm.cockpit.impl.web.bootstrap.CockpitContainerBootstrap.contextInitialized(
at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(
at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(
at org.eclipse.jetty.server.handler.ContextHandler.startContext(
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(
at org.eclipse.jetty.webapp.WebAppContext.startContext(
at org.eclipse.jetty.server.handler.ContextHandler.doStart(
at org.eclipse.jetty.webapp.WebAppContext.doStart(
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(
at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(
at org.eclipse.jetty.server.Server.doStart(
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(
at org.camunda.bpm.Main.main(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.codehaus.mojo.exec.ExecJavaMojo$

If I had to guess, you’re missing a number of dependencies (e.g. camunda-engine). Take a closer look at the project dependencies and make sure you have the necessary ones available on your class path.

Maybe even start with mvn jetty:run -Pdevelop.

Thank you for your response.
I think I have included them all.

Actually this main runs well when using webAppContext.setWar(). So I think there isn’t any problem with the project configuration.

Do you think mvn jetty:run -Pdevelop will run my Main class too ?

No, I just meant mvn jetty:run -Pdevelop from the camunda-bpm-webapp project just to get you started with something, but it sounds like you have something running already.

The profile snippet you posted, is that from your pom? I wouldn’t expect those dependencies to be pulled in if you’re running mvn exec:java -Dexec.mainClass=“org.camunda.bpm.Main”.

Can you share your project on Github or somewhere similar? It’s hard to say without knowing more about your setup, but your stack is fairly straightforward with java.lang.NoClassDefFoundError.

Yes, It’s from my pom. I could run the project on jetty using mvn jetty:run -Pdevelop.
But I’m trying to run jetty in embedded mode so I made .war file from my project and make small main that uses webAppContext.setWar it works fine. But now I’m trying to make a self-executable war. So I added the main class into the camunda project it self.
The project tree is like:

This project was cloned from: git clone

I still think you’re having dependencies issues based on the maven command you’re running. Notice, mvn -Pdevelop exec:java -Dexec.mainClass=“org.camunda.bpm.Main” gives you a different result.

It’s hard to make a recommendation for a project structure without having a better idea of what you’re trying to achieve. Even harder trying to wedge it in the context of the camunda-bpm-webapp project.


Thanks this command works with me.