Error using @Path
in Java.
package resource;
import java.util.ArrayList;
import java.util.List;
import java.nio.file.Path;
import java.nio.file.Paths;
import domain.Album;
import domain.Banda;
import domain.Musica;
import jdk.nashorn.internal.objects.annotations.Getter;
@Path ("/banda")
public class BandaService {
@Getter
@Path ("/get")
@Produces("application/xml")
public Banda getUserInXML() {
Banda banda = new Banda();
banda.setNome("Led Zeppelin");
Album album = new Album();
album.setAno(1969);
album.setNome("Led Zeppelin");
Musica musica1 = new Musica();
Musica musica2 = new Musica();
List<Musica> musicas = new ArrayList<Musica>();
musica1.setNome("Good Times Bad Times");
musica2.setNome("You Shook Me");
musicas.add(musica1);
musicas.add(musica2);
album.setMusicas(musicas);
banda.setAlbum(album);
return banda;
}
}
Web.xml code
<?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>musicApp</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>
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>true</param-value>
</context-param>
<servlet>
<servlet-name>resteasy-servlet</servlet-name>
<servlet-class>
org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>resteasy-servlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
JAVA Buid Path