2
respostas

ERRO ao subir o servidor

Estou usando o java version 11, troquei para o 8 e não deu certo também.

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();
}

}

Código do erro!!

java.lang.IllegalStateException: Unable to perform operation: resolve on org.glassfish.jersey.server.internal.inject.CookieParamValueFactoryProvider
    at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:358)
    at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
    at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:112)
    at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:100)
    at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:95)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:150)
    at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:192)
    at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:150)
    at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2350)
    at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:98)
    at org.jvnet.hk2.internal.ServiceHandleImpl.getService(ServiceHandleImpl.java:87)
    at org.glassfish.jersey.internal.inject.ProviderToService.apply(ProviderToService.java:57)
    at org.glassfish.jersey.internal.inject.ProviderToService.apply(ProviderToService.java:53)
    at com.google.common.collect.Iterators$8.transform(Iterators.java:860)
    at com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48)
    at java.base/java.util.AbstractCollection.addAll(AbstractCollection.java:351)
    at java.base/java.util.LinkedHashSet.<init>(LinkedHashSet.java:169)
    at com.google.common.collect.Sets.newLinkedHashSet(Sets.java:292)
    at org.glassfish.jersey.internal.inject.Providers.getClasses(Providers.java:362)
    at org.glassfish.jersey.internal.inject.Providers.getProviders(Providers.java:186)
    at org.glassfish.jersey.server.spi.internal.ParameterValueHelper.createValueProviders(ParameterValueHelper.java:108)
    at org.glassfish.jersey.server.model.Invocable.getValueProviders(Invocable.java:304)
    at org.glassfish.jersey.server.model.ResourceMethodValidator.checkValueProviders(ResourceMethodValidator.java:164)
    at org.glassfish.jersey.server.model.ResourceMethodValidator.checkMethod(ResourceMethodValidator.java:106)
    at org.glassfish.jersey.server.model.ResourceMethodValidator.visitJaxrsResourceMethod(ResourceMethodValidator.java:102)
    at org.glassfish.jersey.server.model.ResourceMethodValidator.visitResourceMethod(ResourceMethodValidator.java:92)
    at org.glassfish.jersey.server.model.ResourceMethod.accept(ResourceMethod.java:787)
    at org.glassfish.jersey.server.model.ComponentModelValidator.validateWithErrors(ComponentModelValidator.java:161)
    at org.glassfish.jersey.server.model.ComponentModelValidator.validateWithErrors(ComponentModelValidator.java:167)
    at org.glassfish.jersey.server.model.ComponentModelValidator.validateWithErrors(ComponentModelValidator.java:167)
    at org.glassfish.jersey.server.model.ComponentModelValidator.validateWithErrors(ComponentModelValidator.java:167)
    at org.glassfish.jersey.server.model.ComponentModelValidator.access$000(ComponentModelValidator.java:90)
    at org.glassfish.jersey.server.model.ComponentModelValidator$1.run(ComponentModelValidator.java:151)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
    at org.glassfish.jersey.server.model.ComponentModelValidator.validate(ComponentModelValidator.java:146)
    at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:440)
    at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:162)
    at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:304)
    at org.glassfish.jersey.internal.Errors$2.call(Errors.java:289)
    at org.glassfish.jersey.internal.Errors$2.call(Errors.java:286)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
    at org.glassfish.jersey.server.ApplicationHan
2 respostas

Estou com erros ao tentar rodar o servidor, estes são os primeiros:

at org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1117) at org.jvnet.hk2.internal.ClazzCreator.createMe(ClazzCreator.java:261) at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:337) at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456) at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:112) at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:100) at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:95) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:150) at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:192) at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:150) at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2350) at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:612) at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:597) at org.glassfish.jersey.server.model.ComponentModelValidator.(ComponentModelValidator.java:97) at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:439) at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:162) at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:304) at org.glassfish.jersey.internal.Errors$2.call(Errors.java:289) at org.glassfish.jersey.internal.Errors$2.call(Errors.java:286) at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at org.glassfish.jersey.internal.Errors.process(Errors.java:297)

Estou com erro ao levantar o servidor.

at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:304) at org.glassfish.jersey.internal.Errors$2.call(Errors.java:289) at org.glassfish.jersey.internal.Errors$2.call(Errors.java:286) at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at org.glassfish.jersey.internal.Errors.process(Errors.java:297) at org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286) at org.glassfish.jersey.server.ApplicationHandler.(ApplicationHandler.java:301) at org.glassfish.jersey.server.ApplicationHandler.(ApplicationHandler.java:272) at org.glassfish.jersey.server.ContainerFactory.createContainer(ContainerFactory.java:79) at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory.createHttpServer(GrizzlyHttpServerFactory.java:110) at br.com.alura.loja.Servidor.main(Servidor.java:15)