No video

Java RESTful Web Services Tutorial for Beginner with Jersey and Tomcat

  Рет қаралды 40,481

Code Java

Code Java

Күн бұрын

This video tutorial helps you get started with Java RESTful web services by developing a web application running on Apache Tomcat server - this web application hosts Java Restful web services powered by Jersey - an open source framework for developing RESTful web services in Java. Jersey is a reference implementation of JAX-RS (Java API for RESTful Web Services).
You will also learn to test RESTful web services using cURL and Postman tools, and code a RESTful web services client program using Jersey client API.
* Software programs used:
- Java Development Kit (JDK) 11
- Eclipse IDE 2019-09
- Apache Tomcat 9.0
- curl
- Postman
* Steps:
- Create Project & Specify Jersey Dependency
- Code Hello world Java RESTful Web Services
- Configure Jersey Servlet Container
- Test: Chrome, curl, Postman
- Use JSON for RESTful Web Services
- Code Client program
Read the text-based tutorial and download Java RESTful webservices sample project here: www.codejava.net/java-ee/web-...
Recommendation: Take this course www.udemy.com/course/spring-b... to learn Hands-on REST API Development with Spring Boot: Design, Implement, Document, Secure, Test, Consume RESTful APIs.
Timestamps
0:00 Introduction
0:22 What is RESTful Web Service?
4:20 Create Project and Specify Jersey Dependency
8:54 Code Hello World RESTful Web Services
13:44 Configure Jersey Servlet Container
17:31 Test RESTful Web Service using Chrome Browser
22:28 Test RESTful Web Service using curl
28:38 Test RESTful Web Service using Postman
34:12 Use JSON for RESTful Web Services
41:23 Code Client Program Consuming RESTful Web Services
49:34 Summary

Пікірлер: 88
@scientist_nick
@scientist_nick 3 жыл бұрын
I originally spent more than 24 hours trying to understand REST Web Services with Eclipse Jersey (I work mostly with mobile and web apps as a developer). When I went through your video and your webpage on this, I could replicate everything and understand all of the things you mentioned. You deserve an accolade what can I say, thanks a bunch. I will recommend your video to my colleagues as well which are learning this.
@CodeJava
@CodeJava 3 жыл бұрын
I'm very glad that you found my video helpful. Thanks and come to my channel more often.
@GhanaTableTennis
@GhanaTableTennis 4 жыл бұрын
Thanks a million for this tutorial. The tools I use are Glassfish 5.0, Java 8, Netbeans 11, and JEE8. Following your tutorial with such a setup works like charm. Thanks for sharing your knowledge.
@CodeJava
@CodeJava 4 жыл бұрын
Glad it helped
@Sirmontmanful
@Sirmontmanful 3 жыл бұрын
Great tutorial, man, video is almost 2 years old and it's still relevant
@CodeJava
@CodeJava 3 жыл бұрын
Glad to know that. Happy coding!
@amaryadav8703
@amaryadav8703 3 жыл бұрын
Thank you for this simple and clear tutorial, you are a saviour!
@CodeJava
@CodeJava 3 жыл бұрын
You're welcome!
@arunprajapati6445
@arunprajapati6445 Жыл бұрын
Thank you for such an explanatory tutorial ! You deserve a big clap .
@CodeJava
@CodeJava Жыл бұрын
You are welcome!
@ahmadjk
@ahmadjk 2 жыл бұрын
Great tutorial, simple and practical. Thanks for the efforts!
@CodeJava
@CodeJava 2 жыл бұрын
You're welcome!
@tausifiqbal9451
@tausifiqbal9451 Жыл бұрын
Thank you so much for such great video , finally I created REST Web Services with jersey without any error😊.
@CodeJava
@CodeJava Жыл бұрын
Welcome 👍
@arulmurugan6878
@arulmurugan6878 4 жыл бұрын
Thank you so much for this video
@fernandolivia1571
@fernandolivia1571 3 жыл бұрын
Thank you so much, this tuturial is excellent ...it helped me a lot.
@CodeJava
@CodeJava 3 жыл бұрын
Glad it helped! Also check my playlist for Web Services here: kzfaq.info/get/bejne/mraajdqTs8_Gc30.html
@tsuiben6528
@tsuiben6528 Жыл бұрын
Thank you for the tutorial.
@CodeJava
@CodeJava Жыл бұрын
you're welcome.
@HariHaran-wv4pz
@HariHaran-wv4pz 7 ай бұрын
Thank you , such a great video...👌
@CodeJava
@CodeJava 7 ай бұрын
Glad you liked it!
@jinbeanpark9021
@jinbeanpark9021 2 жыл бұрын
Thanks for sharing the good tutorial video!
@CodeJava
@CodeJava 2 жыл бұрын
Glad it was helpful!
@kamilrozwaka5221
@kamilrozwaka5221 2 жыл бұрын
Thanks a lot, your videos saved my life again!
@CodeJava
@CodeJava 2 жыл бұрын
Glad I could help!
@1995taunus
@1995taunus 4 жыл бұрын
Thank you! Great tutorial!
@CodeJava
@CodeJava 4 жыл бұрын
You're very welcome!
@skhandle123
@skhandle123 4 жыл бұрын
Finally got no 404 error after watching your video. Thanks a ton😄
@CodeJava
@CodeJava 4 жыл бұрын
Happy to help
@carloseduardorodriguezlope3542
@carloseduardorodriguezlope3542 2 жыл бұрын
How did you do it? I'm still receiving the 404 error, I follow the example with Netbeans 12.4 using jersey 3.0.2
@christiancamilogutierrezmo3329
@christiancamilogutierrezmo3329 3 жыл бұрын
Awesome tutorial!!! It would be great, that you teach how to consume the web service with a web-form...!!! Greetings from Colombia!!!
@CodeJava
@CodeJava 3 жыл бұрын
then you need to use AJAX with Javascript/jQuery. This video will give you some ideas: kzfaq.info/get/bejne/bdNja5l4qrC1pHU.html
@karlaaraujo6077
@karlaaraujo6077 3 жыл бұрын
Thank you for this tutorial
@CodeJava
@CodeJava 3 жыл бұрын
You're welcome 😊
@ansar6662
@ansar6662 Жыл бұрын
Concise👍
@CodeJava
@CodeJava Жыл бұрын
thanks for watching.
@ruixue6955
@ruixue6955 4 жыл бұрын
3:36 steps 5:16 convert project to Maven 5:50 add Jersey API 14:52 parameter config for org.glassfish.jersey.servlet.ServletContainer
@vauvau1823
@vauvau1823 4 жыл бұрын
Thank you for the dedication to French people i'm from belgium and i'm following your course on udemy. Thanks again. it would be great to make the same e-commerce web application using Spring ,hibernate and if possible create and consume a web service. I would be taker. Merci beaucoup
@CodeJava
@CodeJava 4 жыл бұрын
I'm currently making such a course as you mentioned, with Spring Boot, Thymeleaf, Bootstrap, jQuery and Restful Webservices.
@vauvau1823
@vauvau1823 4 жыл бұрын
@@CodeJava Nice!!!!!!!!!!! We are waiting
@yashbansal1548
@yashbansal1548 3 жыл бұрын
Can you please give some insights on what does , , tags signifies and from where do u got their values.
@CodeJava
@CodeJava 3 жыл бұрын
That XML stuff is used to declare a Servlet (Jersey Servlet Container in this case) to intercept the requests to handle incoming connections from the clients. Jersey Servlet Container will identify if the requests are for the RESTful webservices or not, and handle accordingly. You can find the values in the official Jersey document.
@ucmanhpham5647
@ucmanhpham5647 3 жыл бұрын
From Vietnam with love
@CodeJava
@CodeJava 3 жыл бұрын
Thank you. Enjoy learning & happy coding!
@arulmurugan6878
@arulmurugan6878 4 жыл бұрын
please give me spring mav using restful web services complete video sir.
@case406
@case406 4 жыл бұрын
Thank you so much!!
@CodeJava
@CodeJava 4 жыл бұрын
You're welcome!
@case406
@case406 4 жыл бұрын
@@CodeJava Is there some sort of problem if you want to display a mediatype.application_xml because i it gives me the error 500 and I have no clue?
@CodeJava
@CodeJava 4 жыл бұрын
It should give the reason for 500 error. What is it?
@dickyr4437
@dickyr4437 3 жыл бұрын
I followed your steps to create the Dynamic Web Project and after I clicked Finish, I got the following error in web.xml: Multiple annotations found at this line: - There is '1' error in 'javaee_7.xsd'. - schema_reference.4: Failed to read schema document 'platform:/plugin/org.eclipse.xsd/cache/www.w3.org/2001/xml.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not . I have the latest versions of Tomcat (10.0.6) and Eclipse (2021-03). I see that my Dynamic Web Module Version is 4.0 (default) whereas yours is 3.0. Can you help resolve the error?
@CodeJava
@CodeJava 3 жыл бұрын
I have not used Tomcat 10. Maybe it is causing the problem?
@GVB438
@GVB438 3 жыл бұрын
how can we use connection pool c3po,bonecp etc with rest api's jersy
@CodeJava
@CodeJava 3 жыл бұрын
check my written tutorial on how to use C3P0 with Hibernate: www.codejava.net/frameworks/hibernate/how-to-use-c3p0-database-connection-pooling-library-with-hibernate-jpa
@konstantine5711
@konstantine5711 3 жыл бұрын
thanks alot!
@CodeJava
@CodeJava 3 жыл бұрын
You're welcome!
@saliqabano8431
@saliqabano8431 3 жыл бұрын
Maven Dependencies are not appearing in my project after configure and convert to maven project can anybody help?
@CodeJava
@CodeJava 3 жыл бұрын
could you open the pom.xml file?
@nagitokomaeda3021
@nagitokomaeda3021 2 жыл бұрын
Hello! I am getting "localhost refused to connect" any idea how to fix this? At first it was because port 8080 was in used but I changed that already and I am still not able to connect to the localhost.
@LonelyAncient
@LonelyAncient Жыл бұрын
it's a bit late but for anyone else getting this error, it might be because the port you chose is already in use or because you forgot to start the server after making changes.
@TheMrCalindo
@TheMrCalindo 3 жыл бұрын
didn't you say jax-rs in the description not jax-ws ??
@CodeJava
@CodeJava 3 жыл бұрын
this is for JAX-RS (Java RESTful webservices)
@afomiaterefe2557
@afomiaterefe2557 3 жыл бұрын
what can i do to solve the problem i got 404 error
@CodeJava
@CodeJava 3 жыл бұрын
check URL mapping, view name, etc. 404 meaning a resource not found - due to typos in URL, name, path, etc.
@davidwarner2491
@davidwarner2491 4 жыл бұрын
I am getting http status 500 error root cause Java.lang.IllegalArgumentException
@CodeJava
@CodeJava 4 жыл бұрын
that error means one of parameters has invalid value. Please post the full exception stack trace so I can identify the root cause.
@davidwarner2491
@davidwarner2491 4 жыл бұрын
Can you give me your mail id? I'll mail you.Thanks in advance
@CodeJava
@CodeJava 4 жыл бұрын
please post here. I don't support via email.
@davidwarner2491
@davidwarner2491 4 жыл бұрын
@@CodeJava ok this is my error, when i go to :localhost:8081/ToAru/rest/start Type Exception Report Message Servlet.init() for servlet [t-shirt] threw exception Description The server encountered an unexpected condition that prevented it from fulfilling the request. Exception javax.servlet.ServletException: Servlet.init() for servlet [t-shirt] threw exception org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.base/java.lang.Thread.run(Thread.java:830) Root Cause java.lang.IllegalArgumentException jersey.repackaged.org.objectweb.asm.ClassReader.(ClassReader.java:171) jersey.repackaged.org.objectweb.asm.ClassReader.(ClassReader.java:153) jersey.repackaged.org.objectweb.asm.ClassReader.(ClassReader.java:425) org.glassfish.jersey.server.internal.scanning.AnnotationAcceptingListener.process(AnnotationAcceptingListener.java:170) org.glassfish.jersey.server.ResourceConfig.scanClasses(ResourceConfig.java:915) org.glassfish.jersey.server.ResourceConfig._getClasses(ResourceConfig.java:869) org.glassfish.jersey.server.ResourceConfig.getClasses(ResourceConfig.java:775) org.glassfish.jersey.server.ResourceConfig$RuntimeConfig.(ResourceConfig.java:1206) org.glassfish.jersey.server.ResourceConfig$RuntimeConfig.(ResourceConfig.java:1178) org.glassfish.jersey.server.ResourceConfig.createRuntimeConfig(ResourceConfig.java:1174) org.glassfish.jersey.server.ApplicationHandler.(ApplicationHandler.java:345) org.glassfish.jersey.servlet.WebComponent.(WebComponent.java:392) org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:177) org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:369) javax.servlet.GenericServlet.init(GenericServlet.java:158) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:541) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343) org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373) org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590) org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.base/java.lang.Thread.run(Thread.java:830) Note The full stack trace of the root cause is available in the server logs. //////////////////////////// this is my Touma.java class: package com.rail; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; @Path("/start") public class Touma { @GET @Produces(MediaType.TEXT_PLAIN) public String getMsg() { return "hello"; } } /////////////////////////////// And this is my web.xml: ToAru t-shirt org.glassfish.jersey.servlet.ServletContainer jersey.config.server.provider.packages com.rail 1 t-shirt /rest/* index.html index.htm index.jsp default.html default.htm default.jsp /////////////////////////////////////////
@ggAtr
@ggAtr 4 жыл бұрын
It's secure??
@CodeJava
@CodeJava 4 жыл бұрын
No, it's not because no authentication required.
@imanfatima682
@imanfatima682 3 жыл бұрын
Please teach us the same thing on Netbeans Ide plz
@CodeJava
@CodeJava 3 жыл бұрын
Oh, I'll try with NetBeans. but the code is same regardless of IDE.
@imanfatima682
@imanfatima682 3 жыл бұрын
@@CodeJava Yah Plz I will wait
@huuvan4500
@huuvan4500 3 жыл бұрын
Nghe a đọc tiếng anh như mấy ông bên Ấn ghê :)))
@CodeJava
@CodeJava 3 жыл бұрын
haha, em có hiểu gì hem?
@huuvan4500
@huuvan4500 3 жыл бұрын
@@CodeJava Dạ có a
@khanhduy9540
@khanhduy9540 3 жыл бұрын
Anh học tiếng anh như thế nào vậy ạ
@CodeJava
@CodeJava 3 жыл бұрын
anh có học đâu, nên nghe mới lởm như vậy :)
@khanhduy9540
@khanhduy9540 3 жыл бұрын
@@CodeJava em cũng muốn nói được như anh vậy ^^
@nvs4600
@nvs4600 3 жыл бұрын
Are you Vietnamese?
@CodeJava
@CodeJava 3 жыл бұрын
absolutely I am
@nvs4600
@nvs4600 3 жыл бұрын
@@CodeJava Can I have a question for you?
@CodeJava
@CodeJava 3 жыл бұрын
sure, feel free to ask.
@nvs4600
@nvs4600 3 жыл бұрын
​@@CodeJava 15:55 Why is param-name like this? I searched for that on Google but I still can't understand it.
@CodeJava
@CodeJava 3 жыл бұрын
@@nvs4600 it is required by Jersey, so it will know where to load webservices classes.
@cinematicquotes1606
@cinematicquotes1606 Жыл бұрын
i got an error Type Status Report Message The requested resource [/HelloREST/] is not available Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. but tomcat web page was appeared when i type localhost:8080/ . localhost:8080/HelloREST/rest/bonjour this link got me an error
@CodeJava
@CodeJava Жыл бұрын
Kindly follow this video to find a solution: kzfaq.info/get/bejne/qp2GqLRzrb68ooE.html
Java RESTful Web Services CRUD API Examples with Jersey and Tomcat
1:34:30
لقد سرقت حلوى القطن بشكل خفي لأصنع مصاصة🤫😎
00:33
Cool Tool SHORTS Arabic
Рет қаралды 29 МЛН
ОБЯЗАТЕЛЬНО СОВЕРШАЙТЕ ДОБРО!❤❤❤
00:45
APIs for Beginners 2023 - How to use an API (Full Course / Tutorial)
3:07:07
freeCodeCamp.org
Рет қаралды 1,9 МЛН
What is a REST API?
9:12
IBM Technology
Рет қаралды 1,5 МЛН
Rest API | Web Service Tutorial
2:34:40
Telusko
Рет қаралды 1,1 МЛН
Learn .NET MAUI - Full Course for Beginners | Build cross-platform apps in C#
4:08:53
How To Call a REST API In Java - Simple Tutorial
29:14
Coding with John
Рет қаралды 265 М.
What is REST API? | Web Service
11:28
Telusko
Рет қаралды 3 МЛН
لقد سرقت حلوى القطن بشكل خفي لأصنع مصاصة🤫😎
00:33
Cool Tool SHORTS Arabic
Рет қаралды 29 МЛН