Error starting Jetty after building with IntelliJ 15

I am trying to start developing in IntelliJ 15 using the OpenMRS Core. I imported the project from github, went to “Run”->“Edit Configurations”, added the webapp folder to the working directory and under command line added “jetty:run”.

When I attempt to run the project I get this:

/opt/java/jdk1.8.0_73/bin/java -Dmaven.home=/opt/idea/plugins/maven/lib/maven3 -Dclassworlds.conf=/opt/idea/plugins/maven/lib/maven3/bin/m2.conf -Didea.launcher.port=7532 -Didea.launcher.bin.path=/opt/idea/bin -Dfile.encoding=UTF-8 -classpath /opt/idea/plugins/maven/lib/maven3/boot/plexus-classworlds-2.4.jar:/opt/idea/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=15.0.4 jetty:run
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building openmrs-webapp 2.1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> jetty-maven-plugin:9.3.3.v20150827:run (default-cli) @ openmrs-webapp >>>
[INFO] 
[INFO] --- buildnumber-maven-plugin:1.1:create (default) @ openmrs-webapp ---
[INFO] Checking for local modifications: skipped.
[INFO] Updating project files from SCM: skipped.
[INFO] ShortRevision tag detected. The value is '6'.
[INFO] Executing: /bin/sh -c cd /root/IdeaProjects/openmrs-core/webapp && git rev-parse --verify --short=6 HEAD
[INFO] Working directory: /root/IdeaProjects/openmrs-core/webapp
[INFO] Storing buildNumber: 9122a9 at timestamp: 1457327658108
[INFO] ShortRevision tag detected. The value is '6'.
[INFO] Executing: /bin/sh -c cd /root/IdeaProjects/openmrs-core/webapp && git rev-parse --verify --short=6 HEAD
[INFO] Working directory: /root/IdeaProjects/openmrs-core/webapp
[INFO] Storing buildScmBranch: UNKNOWN
[INFO] 
[INFO] --- build-helper-maven-plugin:1.5:parse-version (parse-version) @ openmrs-webapp ---
[INFO] 
[INFO] --- maven-resources-plugin:2.4:resources (default-resources) @ openmrs-webapp ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] Copying 1 resource to ../jetty
[INFO] 
[INFO] --- maven-antrun-plugin:1.4:run (default) @ openmrs-webapp ---
project.artifactId
[INFO] Executing tasks
    [unzip] Expanding: /root/IdeaProjects/openmrs-core/webapp/src/main/resources/liquibase-demo-data.zip into /root/IdeaProjects/openmrs-core/webapp/target/classes
[INFO] Executed tasks
[INFO] 
[INFO] --- maven-compiler-plugin:2.1:compile (default-compile) @ openmrs-webapp ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-resources-plugin:2.4:testResources (default-testResources) @ openmrs-webapp ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:2.1:testCompile (default-testCompile) @ openmrs-webapp ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] <<< jetty-maven-plugin:9.3.3.v20150827:run (default-cli) @ openmrs-webapp <<<
[INFO] 
[INFO] --- jetty-maven-plugin:9.3.3.v20150827:run (default-cli) @ openmrs-webapp ---
2016-03-06 23:14:19.440:INFO::main: Logging initialized @3950ms
[INFO] Configuring Jetty for project: openmrs-webapp
[INFO] webAppSourceDirectory not set. Trying src/main/webapp
[INFO] Reload Mechanic: automatic
[INFO] Classes = /root/IdeaProjects/openmrs-core/webapp/target/classes
[INFO] Context path = /openmrs
[INFO] Tmp directory = /root/IdeaProjects/openmrs-core/webapp/target/tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides = src/test/resources/override-web.xml
[INFO] web.xml file = /root/IdeaProjects/openmrs-core/webapp/target/jetty/WEB-INF/web.xml
[INFO] Webapp directory = /root/IdeaProjects/openmrs-core/webapp/src/main/webapp
2016-03-06 23:14:19.567:INFO:oejs.Server:main: jetty-9.3.3.v20150827
2016-03-06 23:14:25.239:INFO:/openmrs:main: No Spring WebApplicationInitializer types detected on classpath
2016-03-06 23:14:25.580:INFO:/openmrs:main: Initializing log4j from [classpath:log4j.xml]
WARN - OpenmrsUtil.getRuntimePropertiesFilePathName(2109) |2016-03-06 23:14:25,659| Unable to find a runtime properties file at /root/IdeaProjects/openmrs-core/webapp/openmrs-runtime.properties
WARN - OpenmrsUtil.getRuntimePropertiesFilePathName(2137) |2016-03-06 23:14:25,676| Unable to find properties file: /root/.OpenMRS/openmrs-runtime.properties
WARN - OpenmrsUtil.getRuntimeProperties(2071) |2016-03-06 23:14:25,676| Unable to find a runtime properties file. Initial setup is needed. View the webapp to run the setup wizard.
WARN - OpenmrsUtil.getRuntimePropertiesFilePathName(2109) |2016-03-06 23:14:25,844| Unable to find a runtime properties file at /root/IdeaProjects/openmrs-core/webapp/openmrs-runtime.properties
WARN - OpenmrsUtil.getRuntimePropertiesFilePathName(2137) |2016-03-06 23:14:25,844| Unable to find properties file: /root/.OpenMRS/openmrs-runtime.properties
WARN - OpenmrsUtil.getRuntimeProperties(2071) |2016-03-06 23:14:25,845| Unable to find a runtime properties file. Initial setup is needed. View the webapp to run the setup wizard.
2016-03-06 23:14:25.951:INFO:oejsh.ContextHandler:main: Started o.e.j.m.p.JettyWebAppContext@bb9ab64{/openmrs,file:///root/IdeaProjects/openmrs-core/webapp/src/main/webapp/,AVAILABLE}{file:///root/IdeaProjects/openmrs-core/webapp/src/main/webapp/}
2016-03-06 23:14:25.992:INFO:oejs.ServerConnector:main: Started ServerConnector@62b790a5{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
[INFO] Started Jetty Server
2016-03-06 23:14:25.994:INFO:oejs.Server:main: Started @10503ms
[INFO] Jetty server exiting.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.305s
[INFO] Finished at: Sun Mar 06 23:14:26 CST 2016
[INFO] Final Memory: 78M/530M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.eclipse.jetty:jetty-maven-plugin:9.3.3.v20150827:run (default-cli) on project openmrs-webapp: Failure: /root/IdeaProjects/openmrs-core/api/target -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
2016-03-06 23:14:26.297:INFO:oejs.ServerConnector:Thread-5: Stopped ServerConnector@62b790a5{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
ERROR - Context.getServiceContext(250) |2016-03-06 23:14:26,811| serviceContext is null.  Creating new ServiceContext()
Listener.contextDestroyed: Error while shutting down openmrs: 
ERROR - Listener.contextDestroyed(551) |2016-03-06 23:14:26,821| org.openmrs.api.APIException: Service not found: interface org.openmrs.messagesource.MessageSourceService
2016-03-06 23:14:26.822:INFO:oejsh.ContextHandler:Thread-5: Stopped o.e.j.m.p.JettyWebAppContext@bb9ab64{/openmrs,file:///root/IdeaProjects/openmrs-core/webapp/src/main/webapp/,UNAVAILABLE}{file:///root/IdeaProjects/openmrs-core/webapp/src/main/webapp/}

Process finished with exit code 1

Can you run again using the -X switch to enable full debug logging?

Just for keeps, can you get it to run on Tomcat? That way you can setup your server and get to work till you/we can figure out what the problem is.

Did you actually first build the project with mvn clean install or mvn clean install -DskipTests in case you don’t want to run the tests?

Yep, here it is (i hosted it in a .txt so I didn’t flood the post with a ton of lines)

http://pastebin.com/PVZJ0Na4

@bholagabbar How would I put the Core on tomcat? I have been able to get the reference app running on tomcat fine, but I wasn’t aware I could do it with the github openmrs-core.

@wyclif yes, first used mvn clean install and this was the output http://pastebin.com/PVZJ0Na4

@brameye Have you read the developer documentation carefully?

  1. Run mvn clean install -DskipTests=true on whatever branch of core you want to evaluate. Consider 1.11.x since you don’t need any extra modules like the legacyui modules or those needed for building the ref app (2.0+)

  2. After a successful build, go to to the /webapp/target assuming you’re already in the opemrs-core directory where you ran the build

  3. See the openmrs.war file? Copy that

  4. Go to your Tomcat folder, open the webapps folder, delete any .war files if they exist.

  5. Finally, paste the openmrs.war file you copied here.

  6. Now go back and go to the bin folder of Tomcat and run the startup.sh/startup.bat depending of Linux/Windows

  7. Wait for the server to setup up. Then go to localhost:8080/openmrs. Should work fine.

Looks like the build failed from the logs, so you can’t run jetty:run after a build failed. Can you turn off the verbose flag? i.e run mvn clean install -DskipTests otherwise the logs you shared are too verbose to pin point the issue