jersey import error

Hi,

I am working on below example

http://www.mkyong.com/webservices/jax-rs/jersey-hello-world-example/

I donnloaded and extracted code to
C:\Users\ganesha\workingSession_mkyong\jesey\RESTfulExample

Then i imported as maven project.

Then i did Maven Clean then Maven Instal. I got error as attached.
please advise
jerseyEx.docx
LVL 7
gudii9Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gudii9Author Commented:
says

its working by adding @Produces


I need to see if that helps solving this issue
0
gudii9Author Commented:
package com.mkyong.rest;
 
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
 
@Path("/hello")
public class HelloWorldService {
 
	@GET
	@Path("/{param}")
	@Produces(MediaType.TEXT_PLAIN)
	public Response getMsg(@PathParam("param") String msg) {
 
		String output = "Jersey say : " + msg;
 
		return Response.status(200).entity(output).build();
 
	}
 
}

Open in new window

i addedd still getting same error.



HTTP Status 404 - /RESTfulExample/


type Status report

message /RESTfulExample/

description The requested resource is not available.


Apache Tomcat/8.0.24


when i navigate to this URL

http://localhost:8080/RESTfulExample/

Please advise
0
gudii9Author Commented:
when i go to below url

http://localhost:8080/RESTfulExample/rest/hello/john
i got below error

HTTP Status 500 - Servlet.init() for servlet jersey-serlvet threw exception


type Exception report

message Servlet.init() for servlet jersey-serlvet threw exception

description The server encountered an internal error that prevented it from fulfilling this request.

exception
javax.servlet.ServletException: Servlet.init() for servlet jersey-serlvet threw exception
	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
	org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1527)
	org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1484)
	java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	java.lang.Thread.run(Unknown Source)


root cause
com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.
	com.sun.jersey.server.impl.application.RootResourceUriRules.<init>(RootResourceUriRules.java:99)
	com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1298)
	com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:169)
	com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:775)
	com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:771)
	com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
	com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:771)
	com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:766)
	com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:488)
	com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:318)
	com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:609)
	com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:210)
	com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:373)
	com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:556)
	javax.servlet.GenericServlet.init(GenericServlet.java:158)
	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
	org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1527)
	org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1484)
	java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	java.lang.Thread.run(Unknown Source)


note The full stack trace of the root cause is available in the Apache Tomcat/8.0.24 logs.


Apache Tomcat/8.0.24

Open in new window


please advise
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

gudii9Author Commented:
when i go to below url

http://localhost:8080/RESTfulExample/rest/hello/mkyong

i still get same error
HTTP Status 500 - Servlet.init() for servlet jersey-serlvet threw exception


type Exception report

message Servlet.init() for servlet jersey-serlvet threw exception

description The server encountered an internal error that prevented it from fulfilling this request.

exception
javax.servlet.ServletException: Servlet.init() for servlet jersey-serlvet threw exception
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
      org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
      org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
      org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1527)
      org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1484)
      java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      java.lang.Thread.run(Unknown Source)


root cause
com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.
      com.sun.jersey.server.impl.application.RootResourceUriRules.<init>(RootResourceUriRules.java:99)
      com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1298)
      com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:169)
      com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:775)
      com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:771)
      com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
      com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:771)
      com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:766)
      com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:488)
      com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:318)
      com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:609)
      com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:210)
      com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:373)
      com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:556)
      javax.servlet.GenericServlet.init(GenericServlet.java:158)
      org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
      org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
      org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:617)
      org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
      org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
      org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
      org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1527)
      org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1484)
      java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      java.lang.Thread.run(Unknown Source)


note The full stack trace of the root cause is available in the Apache Tomcat/8.0.24 logs.


Apache Tomcat/8.0.24
0
mccarlIT Business Systems Analyst / Software DeveloperCommented:
Can you post your full "web.xml" file?

(And post your code again too if it may have changed from the one posted above)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
gudii9Author Commented:
my web.xml exactly same as

http://www.mkyong.com/webservices/jax-rs/jersey-hello-world-example/

I will post it once i reach my personal laptop at home.
0
gudii9Author Commented:
is this example working OK for you? please advise
0
gudii9Author Commented:
Mean time i wil try this once again on one other laptop and let you know.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.