5
respostas

Servidor não Inicializa

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:8081/");
    HttpServer server = GrizzlyHttpServerFactory.createHttpServer(uri, config);
    System.out.println("Servidor rodando");
    System.in.read();
    server.stop();
}

}

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.ApplicationHandler.<init>(ApplicationHandler.java:301)
at org.glassfish.jersey.server.ApplicationHandler.<init>(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)
5 respostas

Oi Renato

Envia o log completo, por favor. Nesse trecho que você enviou não tem muitas informações

at org.glassfish.jersey.internal.inject.Providers.getAllServiceHandles(Providers.java:313) at org.glassfish.jersey.internal.inject.Providers.getProviders(Providers.java:185) at org.glassfish.jersey.message.internal.MessageBodyFactory.(MessageBodyFactory.java:325) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) 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) 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) Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 64 more MultiException stack 2 of 2 java.lang.IllegalArgumentException: Errors were discovered while reifying SystemDescriptor( implementation=org.glassfish.jersey.message.internal.XmlRootElementJaxbProvider$App contracts={javax.ws.rs.ext.MessageBodyWriter,javax.ws.rs.ext.MessageBodyReader} scope=javax.inject.Singleton qualifiers={} descriptorType=CLASS descriptorVisibility=NORMAL metadata= rank=0 loader=org.glassfish.hk2.utilities.binding.AbstractBinder$2@766653e6 proxiable=null proxyForSameScope=null analysisName=null id=54 locatorId=0 identityHashCode=324404955

at br.com.alura.loja.Servidor.main(Servidor.java:15)

MultiException stack 7 of 7 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.(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.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.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)

at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory.createHttpServer(GrizzlyHttpServerFactory.java:110)
at br.com.alura.loja.Servidor.main(Servidor.java:15)

MultiException stack 6 of 7 java.lang.IllegalArgumentException: While attempting to resolve the dependencies of org.glassfish.jersey.server.internal.inject.CookieParamValueFactoryProvider errors were found at org.jvnet.hk2.internal.ClazzCreator.resolveAllDependencies(ClazzCreator.java:243) at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:329) 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.(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.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.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)

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

}