OMGPOP
OMGPOP

Reputation: 952

How to run RESTEasy project

I have trying to learn RESTEasy using this repo:

https://github.com/dashorst/jaxrs-quickstart-resteasy

After cloning it, i run mvn clean package, and then I have tried

cd target and java -jar resteasy-quickstart-0.0.1-SNAPSHOT.war I got this error:

no main manifest attribute, in resteasy-quickstart-0.0.1-SNAPSHOT.war

I also tried directly run the test code in

cd target/test-classes

And run java Start, but I got this error:

Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jetty/server/Handler
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
    at java.lang.Class.getMethod0(Class.java:3018)
    at java.lang.Class.getMethod(Class.java:1784)
    at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.server.Handler
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 7 more

I am not using eclipse or intellij, I just want to launch the server from command line and visit the site from browser. I have searched several similar questions like Can't execute jar- file: "no main manifest attribute" but none of them works.

Upvotes: 0

Views: 164

Answers (1)

freedev
freedev

Reputation: 30067

You have to deploy resteasy-quickstart-0.0.1-SNAPSHOT.war file into an running application server.

For example, you could start Jetty and copy the file .war into the webapps directory.

Step 1

Here how to download the Jetty server: https://www.eclipse.org/jetty/download.html

Step 2

After uncompressing the archive (zip or tar.gz), open a shell, enter the Jetty home and run:

./bin/jetty.sh start

You'll see the Jetty through the url

http://localhost:8080/

Step 3

Then copy your .war file into ./webapps directory

Your project will be available following the url

http://localhost:8080/resteasy-quickstart-0.0.1-SNAPSHOT/

Upvotes: 1

Related Questions