# Root resource - Klassen werden nicht gefunden.



## pkm (9. Apr 2020)

Ich bin gerade dabei eine REST-Schnittstelle zu programmieren, diese habe ich als dynamisches Webprojekt angelegt gemäß http://www.se.uni-hannover.de/pages/de:tutorials_restful_guestbook

Das Problem dabei ist, dass es mit dem Deployment nicht klappt. Wenn ich die URL http://localhost:8080/RESTfulGuestBookService/ aufrufe, dann kommt eine Fehlermeldung:


```
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:528)

        org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)

        org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678)

        org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)

        org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:798)

        org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)

        org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:810)

        org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)

        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:835)
```


```
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"

    id="WebApp_ID" version="3.1">

    <display-name>RESTfulGuestBookService</display-name>

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>

    <servlet>
        <servlet-name>RESTful Guest Book with Jersey</servlet-name>
        <servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>

        <init-param>
            <param-name>com.sun.jersey.config.feature.Redirect</param-name>
            <param-value>true</param-value>
        </init-param>

        <init-param>
            <param-name>jersey.config.server.provider.packages</param-name>
            <param-value>de.unihannover.se.soa11.guestbook.rest</param-value>
        </init-param>

    </servlet>

    <servlet-mapping>
        <servlet-name>RESTful Guest Book with Jersey</servlet-name>
        <url-pattern>/*</url-pattern>
    </servlet-mapping>

</web-app>
```

Hat jemand eventuell eine Idee, wi ich die web.xml richtig konfigurieren soll? Ich habe es auch mit *com.sun.jersey.config.property.packages* 

als param-name versucht, was leider auchnicht geklappt hat.


----------



## kay73 (9. Apr 2020)

The ResourceConfig instance does not contain any root resource classes
					

What's going wrong here?  The ResourceConfig instance does not contain any root resource classes. Dec 10, 2010 10:21:24 AM com.sun.jersey.spi.spring.container.servlet.SpringServlet initiate SEVERE:




					stackoverflow.com
				



hier mal alles durchprobiert/ausgeschlossen?


----------



## pkm (17. Apr 2020)

Danke für den Tipp - der Stackoverflowartikel brachte zwar nichts, aber als ich mich penibel an dieses Tutorium gehalten habe:









						Die Anleitung zum Java RESTful Web Services für den Anfänger | codestory.de
					






					o7planning.org
				




Hat es wunderbar funktioniert.


----------

