Solucionado (ver solução)
Solucionado
(ver solução)
3
respostas

Servidor não inicializa : localhost:8080

package br.com.alura.loja;
import java.io.IOException;
import java.net.URI;

import org.glassfish.grizzly.http.server.HttpServer;
import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
import org.glassfish.jersey.server.ResourceConfig;

public class Servidor {

    public static void main(String[] args) throws IOException {
        ResourceConfig config = new ResourceConfig().packages("br.com.alura.loja");
        URI uri = URI.create("http://localhost:8080/");
        HttpServer server = GrizzlyHttpServerFactory.createHttpServer(uri, config);
        System.out.println("Servidor rodando");
        System.in.read();
        server.stop();
    }
}
Search "Exception" (46 hits in 1 file)
  new 1 (46 hits)
    Line 23:     at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
    Line 29: Caused by: java.lang.ClassNotFoundException: javax.xml.bind.PropertyException
    Line 29: Caused by: java.lang.ClassNotFoundException: javax.xml.bind.PropertyException
    Line 34: MultiException stack 2 of 2
    Line 35: java.lang.IllegalArgumentException: Errors were discovered while reifying SystemDescriptor(
    Line 96:     at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
    Line 103: WARNING: HK2 service reification failed for [org.glassfish.jersey.message.internal.XmlRootElementJaxbProvider$Text] with an exception:
    Line 104: MultiException stack 1 of 2
    Line 105: java.lang.NoClassDefFoundError: javax/xml/bind/PropertyException
    Line 165:     at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
    Line 171: Caused by: java.lang.ClassNotFoundException: javax.xml.bind.PropertyException
    Line 171: Caused by: java.lang.ClassNotFoundException: javax.xml.bind.PropertyException
    Line 176: MultiException stack 2 of 2
    Line 177: java.lang.IllegalArgumentException: Errors were discovered while reifying SystemDescriptor(
    Line 238:     at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
    Line 245: WARNING: HK2 service reification failed for [org.glassfish.jersey.message.internal.XmlRootElementJaxbProvider$General] with an exception:
    Line 246: MultiException stack 1 of 2
    Line 247: java.lang.NoClassDefFoundError: javax/xml/bind/PropertyException
    Line 307:     at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
    Line 313: Caused by: java.lang.ClassNotFoundException: javax.xml.bind.PropertyException
    Line 313: Caused by: java.lang.ClassNotFoundException: javax.xml.bind.PropertyException
    Line 318: MultiException stack 2 of 2
    Line 319: java.lang.IllegalArgumentException: Errors were discovered while reifying SystemDescriptor(
    Line 380:     at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
    Line 388: Exception in thread "main" MultiException stack 1 of 7
    Line 388: Exception in thread "main" MultiException stack 1 of 7
    Line 521:     at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
    Line 527: Caused by: java.lang.ClassNotFoundException: javax.xml.bind.Unmarshaller
    Line 532: MultiException stack 2 of 7
    Line 533: java.lang.IllegalStateException: Unable to perform operation: create on org.glassfish.jersey.server.internal.inject.ParamConverters$AggregatedProvider
    Line 639:     at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
    Line 645: MultiException stack 3 of 7
    Line 646: java.lang.IllegalStateException: Unable to perform operation: create on org.glassfish.jersey.server.internal.inject.ParamConverterFactory
    Line 723:     at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
    Line 729: MultiException stack 4 of 7
    Line 730: java.lang.IllegalArgumentException: While attempting to resolve the dependencies of org.glassfish.jersey.server.internal.inject.MultivaluedParameterExtractorFactory errors were found
    Line 793:     at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
    Line 799: MultiException stack 5 of 7
    Line 800: java.lang.IllegalStateException: Unable to perform operation: resolve on org.glassfish.jersey.server.internal.inject.MultivaluedParameterExtractorFactory
    Line 862:     at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
    Line 868: MultiException stack 6 of 7
    Line 869: java.lang.IllegalArgumentException: While attempting to resolve the dependencies of org.glassfish.jersey.server.internal.inject.CookieParamValueFactoryProvider errors were found
    Line 917:     at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
    Line 923: MultiException stack 7 of 7
    Line 924: java.lang.IllegalStateException: Unable to perform operation: resolve on org.glassfish.jersey.server.internal.inject.CookieParamValueFactoryProvider
    Line 971:     at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
3 respostas

Oi Jean

O problema é a versão do seu Java, deveria ser o Java 8 mas você está usando uma versão mais atual

Nesse caso, vai ter que adicionar as dependencias:

<!-- API, java.xml.bind module -->
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>2.3.2</version>
</dependency>

<!-- Runtime, com.sun.xml.bind module -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
</dependency>

Obrigado Otavio pela ajuda vou tentar aqui , porem em qual classe eu coloco esse codigo ? Outra duvida , como eu posso chegar nessa conclusao em problemas futuros ?

solução!

O código que ele passou deve ser colocado dentro do bloco

 <dependencies>
 </dependencies>

do pom.xml. O pom.xml é um arquivo de configuração do Maven responsável pelo gerenciamento de dependências do seu projeto.

Sobre como resolver problemas futuros, cada problema tem uma solução diferente. Você terá que aprender a ler a stacktrace gerada pelo erro e com o tempo conseguirá identificar o ponto do erro, e então procurando solução no google, stacktraceoverflow, geralmente vc encontrará como resolver o problema específico.