1. java
  2. android
  3. c#
  4. .net
  5. javascript
  6. php
  7. jquery
  8. html
  9. sql

Erro em deploy Restfull resteasy + jettison

Olá pessoal estou com o seguinte erro ao realizar deploy do meu projeto:

2014/04/29 23:14:31,747 WARN  [org.jboss.resteasy.plugins.providers.RegisterBuiltin] (MSC service thread 1-2) NoClassDefFoundError: Unable to load builtin provider: org.jboss.resteasy.plugins.providers.SourceProvider
2014/04/29 23:14:31,839 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/]] (MSC service thread 1-2) Exception sending context initialized event to listener instance of class org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap: java.lang.RuntimeException: java.lang.RuntimeException: Unable to instantiate MessageBodyReader
    at org.jboss.resteasy.plugins.providers.RegisterBuiltin.register(RegisterBuiltin.java:35) [resteasy-jaxrs-2.3.2.Final.jar:]
    at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:211) [resteasy-jaxrs-2.3.2.Final.jar:]
    at org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap.contextInitialized(ResteasyBootstrap.java:28) [resteasy-jaxrs-2.3.2.Final.jar:]
    at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]
    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_55]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_55]
    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_55]
Caused by: java.lang.RuntimeException: Unable to instantiate MessageBodyReader
    at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:761) [resteasy-jaxrs-2.3.2.Final.jar:]
    at org.jboss.resteasy.plugins.providers.RegisterBuiltin.registerProviders(RegisterBuiltin.java:70) [resteasy-jaxrs-2.3.2.Final.jar:]
    at org.jboss.resteasy.plugins.providers.RegisterBuiltin.register(RegisterBuiltin.java:31) [resteasy-jaxrs-2.3.2.Final.jar:]
    ... 10 more
Caused by: java.lang.TypeNotPresentException: Type javax.ws.rs.core.Form not present
    at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:117) [rt.jar:1.7.0_55]
    at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125) [rt.jar:1.7.0_55]
    at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49) [rt.jar:1.7.0_55]
    at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68) [rt.jar:1.7.0_55]
    at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138) [rt.jar:1.7.0_55]
    at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49) [rt.jar:1.7.0_55]
    at sun.reflect.generics.repository.ClassRepository.getSuperInterfaces(ClassRepository.java:100) [rt.jar:1.7.0_55]
    at java.lang.Class.getGenericInterfaces(Class.java:814) [rt.jar:1.7.0_55]
    at org.jboss.resteasy.util.Types.getSomething(Types.java:37) [resteasy-jaxrs-2.3.2.Final.jar:]
    at org.jboss.resteasy.util.Types.getTemplateParameterOfInterface(Types.java:24) [resteasy-jaxrs-2.3.2.Final.jar:]
    at org.jboss.resteasy.spi.ResteasyProviderFactory$SortedKey.<init>(ResteasyProviderFactory.java:103) [resteasy-jaxrs-2.3.2.Final.jar:]
    at org.jboss.resteasy.spi.ResteasyProviderFactory$SortedKey.<init>(ResteasyProviderFactory.java:93) [resteasy-jaxrs-2.3.2.Final.jar:]
    at org.jboss.resteasy.spi.ResteasyProviderFactory$SortedKey.<init>(ResteasyProviderFactory.java:79) [resteasy-jaxrs-2.3.2.Final.jar:]
    at org.jboss.resteasy.spi.ResteasyProviderFactory.addMessageBodyReader(ResteasyProviderFactory.java:494) [resteasy-jaxrs-2.3.2.Final.jar:]
    at org.jboss.resteasy.spi.ResteasyProviderFactory.addMessageBodyReader(ResteasyProviderFactory.java:479) [resteasy-jaxrs-2.3.2.Final.jar:]
    at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:757) [resteasy-jaxrs-2.3.2.Final.jar:]
    ... 12 more
Caused by: java.lang.ClassNotFoundException: javax.ws.rs.core.Form from [Module "deployment.ROOT.war:main" from Service Module Loader]
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)
    at java.lang.Class.forName0(Native Method) [rt.jar:1.7.0_55]
    at java.lang.Class.forName(Class.java:270) [rt.jar:1.7.0_55]
    at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114) [rt.jar:1.7.0_55]
    ... 27 more
2014/04/29 23:14:32,742 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-2) Error listenerStart
2014/04/29 23:14:32,836 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-2) Context [] startup failed due to previous errors
2014/04/29 23:14:33,146 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.web.deployment.default-host./ROOT: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./ROOT: JBAS018040: Failed to start context
    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:95)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_55]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_55]
    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_55]
2014/04/29 23:14:33,236 INFO  [org.jboss.as] (MSC service thread 1-2) JBAS015951: Admin console listening on http://127.12.5.129:9990
2014/04/29 23:14:33,237 ERROR [org.jboss.as] (MSC service thread 1-2) JBAS015875: JBoss AS 7.1.1.Final "Brontes" started (with errors) in 142557ms - Started 220 of 341 services (2 services failed or missing dependencies, 116 services are passive or on-demand)
2014/04/29 23:14:33,439 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "ROOT.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.web.deployment.default-host./ROOT" => "org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./ROOT: JBAS018040: Failed to start context"}}
2014/04/29 23:14:33,538 INFO  [org.jboss.as.jpa] (MSC service thread 1-3) JBAS011403: Stopping Persistence Unit Service 'ROOT.war#projetotcc'
2014/04/29 23:14:33,859 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015877: Stopped deployment ROOT.war in 418ms
2014/04/29 23:14:33,860 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.web.deployment.default-host./ROOT: org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./ROOT: JBAS018040: Failed to start context
2014/04/29 23:14:33,936 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.web.deployment.default-host./ROOT" => "org.jboss.msc.service.StartException in service jboss.web.deployment.default-host./ROOT: JBAS018040: Failed to start context"}}}}

Segue meu pom.xml

  <dependencies>
    <dependency>
      <groupId>org.jboss.spec</groupId>
      <artifactId>jboss-javaee-6.0</artifactId>
      <version>1.0.0.Final</version>
      <type>pom</type>
      <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>commons-logging</groupId>
        <artifactId>commons-logging</artifactId>
        <version>1.1.1</version>
    </dependency>

    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.24</version>
    </dependency>

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.3.5.Final</version>
        <scope></scope>
    </dependency>

    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxrs</artifactId>
        <version>3.0.4.Final</version>
    </dependency>

    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jaxb-provider</artifactId>
        <version>3.0.4.Final</version>
    </dependency>

    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jettison-provider</artifactId>
        <version>3.0.4.Final</version>
    </dependency>

  </dependencies>

meu web.xml

<filter>
            <filter-name>JPAFilter</filter-name>
            <filter-class>br.com.serverchattcc.filter.JPAFilter</filter-class>
        </filter>

        <filter-mapping>
            <filter-name>JPAFilter</filter-name>
            <url-pattern>/*</url-pattern>
        </filter-mapping>

         <context-param>
            <param-name>resteasy.servlet.mapping.prefix</param-name>
            <param-value>/services</param-value>
         </context-param>

         <context-param>
            <param-name>resteasy.scan</param-name>
            <param-value>true</param-value>
         </context-param>

         <listener>
            <listener-class>
             org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
            </listener-class>
         </listener>

        <servlet>
            <servlet-name>Resteasy</servlet-name>
            <servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher</servlet-class>
        </servlet>

        <servlet-mapping>
            <servlet-name>Resteasy</servlet-name>
            <url-pattern>/services/*</url-pattern>
        </servlet-mapping>

E meus serviços:

package br.com.serverchattcc.resources;

import javax.persistence.EntityManager;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;

import br.com.serverchattcc.adapter.UsuarioEntityJsonAdapter;
import br.com.serverchattcc.entity.Usuario;
import br.com.serverchattcc.enuns.Charset;
import br.com.serverchattcc.enuns.MessageReturn;
import br.com.serverchattcc.json.elements.UsuarioJson;
import br.com.serverchattcc.repository.UsuarioRepository;

@Path("/usuario")
public class UsuarioResource {

    @GET
    @Produces(MediaType.APPLICATION_JSON)
    @Path("/find/{id}")
    public Response find(@Context HttpServletRequest request,
            @PathParam("id") long id) {

        try {
            EntityManager entityManager = (EntityManager)request.getAttribute("entityManager");
            UsuarioRepository usuarioRepository = new UsuarioRepository(entityManager);
            UsuarioEntityJsonAdapter usuarioAdapter = new UsuarioEntityJsonAdapter();
            UsuarioJson usuarioJson = usuarioAdapter.convertEntityToJson(usuarioRepository.find(id));
            return Response.status(Status.OK).
                            header("Content-Type",MediaType.TEXT_PLAIN+Charset.UTF8)
                            .entity(usuarioJson).build();
        } catch (Exception e) {
            return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
        }
    }    

    @POST
    @Path("/add")
    @Consumes(MediaType.TEXT_PLAIN+Charset.UTF8)
    public Response add(@Context HttpServletRequest request, 
                        @FormParam("usuario") UsuarioJson usuarioJson ) { 
        try {
            EntityManager entityManager = (EntityManager)request.getAttribute("entityManager");
            UsuarioRepository usuarioRepository = new UsuarioRepository(entityManager);
            UsuarioEntityJsonAdapter usuarioAdapter = new UsuarioEntityJsonAdapter();
            Usuario usuario = usuarioAdapter.convertJsonToEntity(usuarioJson);
            usuarioRepository.persist(usuario);
            return Response.status(Status.OK).
                            header("Content-Type",MediaType.TEXT_PLAIN+Charset.UTF8)
                            .entity(MessageReturn.CadSuccess.toString()).build();
        } catch (Exception e) {
            return Response.status(Status.INTERNAL_SERVER_ERROR).entity(e.getMessage()).build();
        } 
    }
}

E minha entidade:

package br.com.serverchattcc.json.elements;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElements;
import javax.xml.bind.annotation.XmlRootElement;

import br.com.serverchattcc.interfaces.models.UsuarioInterface;

@XmlRootElement(name="usuario")
public class UsuarioJson implements UsuarioInterface {

    private long usuario;    
    private String login;    
    private String nome;    
    private String senha;
    private String nick;

    @XmlElements(value={@XmlElement(name="contatos",type=UsuarioJson.class)})
    private List<UsuarioJson> contatos = new ArrayList<UsuarioJson>();

    public long getUsuario() {
        return this.usuario;
    }

    public void setUsuario(long usuario) {
        this.usuario = usuario;
    }

    public String getLogin() {
        return this.login;
    }

    public void setLogin(String login) {
        this.login = login;
    }

    public String getNome() {
        return this.nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public String getSenha() {
        return this.senha;
    }

    public void setSenha(String senha) {
        this.senha = senha;
    }

    public String getNick() {
        return this.nick;
    }

    public void setNick(String nick) {
        this.nick = nick;
    }

}
  1. Você vai ver essas setas em qualquer página de pergunta. Com elas, você pode dizer se uma pergunta ou uma resposta foram relevantes ou não.
  2. Edite sua pergunta ou resposta caso queira alterar ou adicionar detalhes.
  3. Caso haja alguma dúvida sobre a pergunta, adicione um comentário. O espaço de respostas deve ser utilizado apenas para responder a pergunta.
  4. Se o autor da pergunta marcar uma resposta como solucionada, esta marca aparecerá.
  5. Clique aqui para mais detalhes sobre o funcionamento do GUJ!

0 resposta

Não é a resposta que estava procurando? Procure outras perguntas com as tags rest webservices jaxb jboss deploy ou faça a sua própria pergunta.