Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello World Example Fails to Run #11893

Closed
LovingSalamander opened this issue Jun 9, 2024 · 3 comments · Fixed by #11896
Closed

Hello World Example Fails to Run #11893

LovingSalamander opened this issue Jun 9, 2024 · 3 comments · Fixed by #11896
Labels
Bug For general bugs on Jetty side Documentation

Comments

@LovingSalamander
Copy link

Jetty version(s)

jetty-12

Jetty Environment

core?

Java version/vendor (use: java -version)
openjdk 22.0.1 2024-04-16
OpenJDK Runtime Environment Temurin-22.0.1+8 (build 22.0.1+8)
OpenJDK 64-Bit Server VM Temurin-22.0.1+8 (build 22.0.1+8, mixed mode)

OS type/version
macOS 14.4.1 (23E224)

Description

Following the steps of https://jetty.org/docs/jetty/12/programming-guide/maven-jetty/jetty-maven-helloworld.html#configuring-embedded-jetty-with-maven gives error:

[ERROR] Failed to execute goal on project hello-world: Could not resolve dependencies for project org.example:hello-world:jar:0.1-SNAPSHOT: The following artifacts could not be resolved: org.eclipse.jetty:jetty-server:jar:12.0.10-SNAPSHOT (absent): Could not find artifact org.eclipse.jetty:jetty-server:jar:12.0.10-SNAPSHOT 

I looked up the latest version of this artifact at https://mvnrepository.com/artifact/org.eclipse.jetty/jetty-server/12.0.10, so I tried using 12.0.10 instead of 12.0.10-SNAPSHOT, and got a new error:

[ERROR]   symbol:   class HttpServletRequest
[ERROR]   location: class org.example.HelloWorld
[ERROR] /Users/LovingSalamander/development/java/maven-jetty-example/src/main/java/org/example/HelloWorld.java:[16,24] cannot find symbol
[ERROR]   symbol:   class HttpServletResponse
[ERROR]   location: class org.example.HelloWorld
[ERROR] /Users/LovingSalamander/development/java/maven-jetty-example/src/main/java/org/example/HelloWorld.java:[17,29] cannot find symbol
[ERROR]   symbol:   class ServletException
[ERROR]   location: class org.example.HelloWorld
[ERROR] /Users/LovingSalamander/development/java/maven-jetty-example/src/main/java/org/example/HelloWorld.java:[11,8] org.example.HelloWorld is not abstract and does not override abstract method handle(org.eclipse.jetty.server.Request,org.eclipse.jetty.server.Response,org.eclipse.jetty.util.Callback) in org.eclipse.jetty.server.Request.Handler
[ERROR] /Users/LovingSalamander/development/java/maven-jetty-example/src/main/java/org/example/HelloWorld.java:[20,28] cannot find symbol
[ERROR]   symbol:   variable HttpServletResponse
[ERROR]   location: class org.example.HelloWorld
[ERROR] /Users/LovingSalamander/development/java/maven-jetty-example/src/main/java/org/example/HelloWorld.java:[21,20] cannot find symbol
[ERROR]   symbol:   method setHandled(boolean)
[ERROR]   location: variable baseRequest of type org.eclipse.jetty.server.Request

How to reproduce?

Follow the steps of the tutorial

@LovingSalamander LovingSalamander added the Bug For general bugs on Jetty side label Jun 9, 2024
@joakime
Copy link
Contributor

joakime commented Jun 9, 2024

We need to get rid of the "-SNAPSHOT" portion of that example.

Use <jettyVersion>12.0.10</jettyVersion> for now.

@LovingSalamander
Copy link
Author

We need to get rid of the "-SNAPSHOT" portion of that example.

Use <jettyVersion>12.0.10</jettyVersion> for now.

When I use that version and run the example as-is, I get the following error:

[ERROR]   symbol:   class HttpServletRequest
[ERROR]   location: class org.example.HelloWorld
[ERROR] /Users/LovingSalamander/development/java/maven-jetty-example/src/main/java/org/example/HelloWorld.java:[16,24] cannot find symbol
[ERROR]   symbol:   class HttpServletResponse
[ERROR]   location: class org.example.HelloWorld
[ERROR] /Users/LovingSalamander/development/java/maven-jetty-example/src/main/java/org/example/HelloWorld.java:[17,29] cannot find symbol
[ERROR]   symbol:   class ServletException
[ERROR]   location: class org.example.HelloWorld
[ERROR] /Users/LovingSalamander/development/java/maven-jetty-example/src/main/java/org/example/HelloWorld.java:[11,8] org.example.HelloWorld is not abstract and does not override abstract method handle(org.eclipse.jetty.server.Request,org.eclipse.jetty.server.Response,org.eclipse.jetty.util.Callback) in org.eclipse.jetty.server.Request.Handler
[ERROR] /Users/LovingSalamander/development/java/maven-jetty-example/src/main/java/org/example/HelloWorld.java:[20,28] cannot find symbol
[ERROR]   symbol:   variable HttpServletResponse
[ERROR]   location: class org.example.HelloWorld
[ERROR] /Users/LovingSalamander/development/java/maven-jetty-example/src/main/java/org/example/HelloWorld.java:[21,20] cannot find symbol
[ERROR]   symbol:   method setHandled(boolean)
[ERROR]   location: variable baseRequest of type org.eclipse.jetty.server.Request

@janbartel
Copy link
Contributor

@LovingSalamander oops, looks like that documentation has not been ported to jetty-12. A better guide is to look at the javadoc, particularly for eg the Request.Handler which has a simple HelloWorld example: https://javadoc.jetty.org/jetty-12/org/eclipse/jetty/server/Request.Handler.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For general bugs on Jetty side Documentation
Projects
No open projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

3 participants