java.lang.IllegalStateException: Unable to perform operation: create on org.glassfish.jersey.message.internal.MessageBodyFactory

Java.net JIRA | satb | 3 years ago
  1. 0

    I am just trying a very very simple rest service with Spring 4 and Jersey (JAX-RS required because of client requirements) and its turning out to be a harrowing experience just to get the ball rolling. The application, as soon as it deploys to Tomcat 8, gives me an error like this. The application should support JAXB marshaling of JSON/XML through content negotiation. 15-Mar-2014 14:56:11.468 INFO [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.ApplicationContext.log Spring WebApplicationInitializers detected on classpath: [org.glassfish.jersey.server.spring.SpringWebApplicationInitializer@17387686] 15-Mar-2014 14:56:11.543 INFO [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.ApplicationContext.log Initializing Spring root WebApplicationContext log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. 15-Mar-2014 14:56:12.779 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.ApplicationContext.log StandardWrapper.Throwable MultiException stack 1 of 3 java.lang.NullPointerException at com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.setConfiguration(AbstractJAXBProvider.java:113) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(ReflectionHelper.java:1017) at org.jvnet.hk2.internal.ClazzCreator.methodMe(ClazzCreator.java:375) at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:428) at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456) at org.jvnet.hk2.internal.PerLookupContext.findOrCreate(PerLookupContext.java:69) at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2445) 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:58) at org.glassfish.jersey.internal.inject.ProviderToService.apply(ProviderToService.java:54) at jersey.repackaged.com.google.common.collect.Iterators$8.transform(Iterators.java:860) at jersey.repackaged.com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48) at java.util.AbstractCollection.addAll(AbstractCollection.java:333) at java.util.LinkedHashSet.<init>(LinkedHashSet.java:169) at jersey.repackaged.com.google.common.collect.Sets.newLinkedHashSet(Sets.java:292) at org.glassfish.jersey.internal.inject.Providers.getClasses(Providers.java:364) at org.glassfish.jersey.internal.inject.Providers.getProviders(Providers.java:186) at org.glassfish.jersey.message.internal.MessageBodyFactory.<init>(MessageBodyFactory.java:304) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1105) at org.jvnet.hk2.internal.ClazzCreator.createMe(ClazzCreator.java:292) at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:422) at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456) at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:114) at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:102) at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154) at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199) at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:153) at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2445) at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:621) at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:606) at org.glassfish.jersey.server.model.ComponentModelValidator.<init>(ComponentModelValidator.java:97) at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:457) at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:162) at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:322) 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:319) at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:284) at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:311) at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:168) at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:358) at javax.servlet.GenericServlet.init(GenericServlet.java:158) MultiException stack 2 of 3 java.lang.IllegalStateException: Unable to perform operation: method inject on com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$App at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:449) at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456) at org.jvnet.hk2.internal.PerLookupContext.findOrCreate(PerLookupContext.java:69) at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2445) 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:58) at org.glassfish.jersey.internal.inject.ProviderToService.apply(ProviderToService.java:54) at jersey.repackaged.com.google.common.collect.Iterators$8.transform(Iterators.java:860) at jersey.repackaged.com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48) at java.util.AbstractCollection.addAll(AbstractCollection.java:333) at java.util.LinkedHashSet.<init>(LinkedHashSet.java:169) at jersey.repackaged.com.google.common.collect.Sets.newLinkedHashSet(Sets.java:292) at org.glassfish.jersey.internal.inject.Providers.getClasses(Providers.java:364) at org.glassfish.jersey.internal.inject.Providers.getProviders(Providers.java:186) at org.glassfish.jersey.message.internal.MessageBodyFactory.<init>(MessageBodyFactory.java:304) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1105) at org.jvnet.hk2.internal.ClazzCreator.createMe(ClazzCreator.java:292) at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:422) at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456) at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:114) at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:102) at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154) at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199) at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:153) at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2445) at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:621) at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:606) at org.glassfish.jersey.server.model.ComponentModelValidator.<init>(ComponentModelValidator.java:97) at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:457) at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:162) at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:322) 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:319) at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:284) at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:311) at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:168) at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:358) at javax.servlet.GenericServlet.init(GenericServlet.java:158) MultiException stack 3 of 3 java.lang.IllegalStateException: Unable to perform operation: create on org.glassfish.jersey.message.internal.MessageBodyFactory at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:443) at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456) at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:114) at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:102) at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154) at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199) at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:153) at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2445) at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:621) at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:606) at org.glassfish.jersey.server.model.ComponentModelValidator.<init>(ComponentModelValidator.java:97) at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:457) at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:162) at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:322) 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:319) at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:284) at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:311) at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:168) at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:358) at javax.servlet.GenericServlet.init(GenericServlet.java:158) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1236) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1149) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1041) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4910) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5192) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:697) at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1646) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:791) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:463) at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:413) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819) [2014-03-15 02:56:12,800] Artifact myapp (exploded): Artifact is deployed successfully at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:791) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1486) at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:96) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1327) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1419) at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:847) [2014-03-15 02:56:12,801] Artifact myapp (exploded): Deploy took 5,904 milliseconds at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322) at sun.rmi.transport.Transport$1.run(Transport.java:177) 15-Mar-2014 14:56:12.782 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.loadOnStartup Servlet /myapp threw load() exception java.lang.NullPointerException at com.sun.jersey.core.provider.jaxb.AbstractJAXBProvider.setConfiguration(AbstractJAXBProvider.java:113) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:601) at org.glassfish.hk2.utilities.reflection.ReflectionHelper.invoke(ReflectionHelper.java:1017) at org.jvnet.hk2.internal.ClazzCreator.methodMe(ClazzCreator.java:375) at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:428) at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456) at org.jvnet.hk2.internal.PerLookupContext.findOrCreate(PerLookupContext.java:69) at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2445) 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:58) at org.glassfish.jersey.internal.inject.ProviderToService.apply(ProviderToService.java:54) at jersey.repackaged.com.google.common.collect.Iterators$8.transform(Iterators.java:860) at jersey.repackaged.com.google.common.collect.TransformedIterator.next(TransformedIterator.java:48) at java.util.AbstractCollection.addAll(AbstractCollection.java:333) at java.util.LinkedHashSet.<init>(LinkedHashSet.java:169) at jersey.repackaged.com.google.common.collect.Sets.newLinkedHashSet(Sets.java:292) at org.glassfish.jersey.internal.inject.Providers.getClasses(Providers.java:364) at org.glassfish.jersey.internal.inject.Providers.getProviders(Providers.java:186) at org.glassfish.jersey.message.internal.MessageBodyFactory.<init>(MessageBodyFactory.java:304) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:525) at org.glassfish.hk2.utilities.reflection.ReflectionHelper.makeMe(ReflectionHelper.java:1105) at org.jvnet.hk2.internal.ClazzCreator.createMe(ClazzCreator.java:292) at org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:422) at org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456) at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:114) at org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:102) at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) at java.util.concurrent.FutureTask.run(FutureTask.java:166) at org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154) at org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199) at org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:153) at org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2445) at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:621) at org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:606) at org.glassfish.jersey.server.model.ComponentModelValidator.<init>(ComponentModelValidator.java:97) at org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:457) at org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:162) at org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:322) 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:319) at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:284) at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:311) at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:168) at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:358) at javax.servlet.GenericServlet.init(GenericServlet.java:158) build.gradle file ============ apply plugin: 'java' apply plugin: 'war' sourceCompatibility = 1.5 version = '1.0' repositories { mavenCentral() } dependencies { compile group: 'org.springframework', name: 'spring-context', version: '4.0.2.RELEASE' compile group: 'org.springframework', name: 'spring-webmvc', version: '4.0.2.RELEASE' compile group: 'org.springframework', name: 'spring-web', version: '4.0.2.RELEASE' compile(group: 'org.springframework', name: 'spring-core', version: '4.0.2.RELEASE') { exclude group: 'commons-logging' } compile group: 'org.springframework', name: 'spring-orm', version: '4.0.2.RELEASE' compile 'org.slf4j:slf4j-api:1.7.6' compile 'org.slf4j:jcl-over-slf4j:1.7.6' compile 'org.slf4j:slf4j-log4j12:1.7.6' compile 'log4j:log4j:1.2.17' compile 'org.glassfish.jersey.containers:jersey-container-servlet:2.6' compile 'org.glassfish.jersey.media:jersey-media-json-jackson' compile 'org.glassfish.jersey.ext:jersey-spring3:2.6' compile 'com.sun.jersey:jersey-core:1.18.1' compile('com.sun.jersey:jersey-json:1.18.1') exclude { group: "com.sun.xml.bind" } compile 'org.glassfish.jersey.core:jersey-server:2.6' compile 'com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.3.0' compile group: 'javax.servlet', name: 'javax.servlet-api', version: '3.1.0' compile group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-2.1-api', version: '1.0.0.Final' compile group: 'org.hibernate', name: 'hibernate-core', version: '4.3.4.Final' compile group: 'org.hibernate', name: 'hibernate-entitymanager', version: '4.3.4.Final' compile 'javax.validation:validation-api:1.1.0.Final' compile 'javax.inject:javax.inject:1' testCompile group: 'junit', name: 'junit', version: '4.11' } applicationContext.xml ================== <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> <!-- Scans within the base package of the application for @Components to configure as beans --> <context:component-scan base-package="com.test.myapp" /> <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/> <!-- Services --> </beans> web.xml <?xml version="1.0" encoding="ISO-8859-1"?> <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1"> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <context-param> <param-name>contextConfigLocation</param-name> <param-value>classpath*:/conf/spring/applicationContext.xml</param-value> </context-param> <servlet> <servlet-name>SpringApplication</servlet-name> <servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class> <init-param> <param-name>javax.ws.rs.Application</param-name> <param-value>com.test.myapp.application.MyApp</param-value> </init-param> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>SpringApplication</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> </web-app> Finally, Jersey needs this MyApp class to bootstrap package com.test.myapp.application; import com.test.myapp.controllers.v1.FirstController; import org.glassfish.jersey.server.ResourceConfig; import org.glassfish.jersey.server.spring.scope.RequestContextFilter; public class MyApp extends ResourceConfig { public MyApp(){ register(RequestContextFilter.class); register(FirstController.class); } } FirstController.java package com.test.myapp.controllers.v1; import com.test.myapp.jaxb.v1.ErrorDetail; import com.test.myapp.jaxb.v1.ErrorResponse; import com.test.myapp.jaxb.v1.ObjectFactory; import com.test.myapp.jaxb.v1.RestResponse; import org.apache.log4j.Logger; import javax.annotation.PostConstruct; import javax.inject.Named; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.Consumes; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.Arrays; import java.util.Date; import java.util.List; @Named @Path("/v1/riskInfo") public class FirstController { private static Logger logger = Logger.getLogger(RiskInfoController.class); @PostConstruct public void initialize() { System.out.println("INITIALIZED*******"); } @Path("/first-action") @POST @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) @Consumes("application/x-www-form-urlencoded") public Response firstActionInfo(@Context HttpServletRequest req){ ErrorResponse errorResponse = objFactory.createErrorResponse(); errorResponse.setProcessedTime(new Date()); errorResponse.setIsRetry(false); ErrorDetail detail = objFactory.createErrorDetail(); detail.setMessage("SOMETHING WENT WRONG"); detail.setCode("NOT_OK"); List<ErrorDetail> problemList = Arrays.asList(detail); errorResponse.setProblem(problemList); RestResponse restResponse = objFactory.createRestResponse(); restResponse.setSystemResponse(objFactory.createError(errorResponse)); return Response.ok(restResponse).build(); } }

    Java.net JIRA | 3 years ago | satb
    java.lang.IllegalStateException: Unable to perform operation: create on org.glassfish.jersey.message.internal.MessageBodyFactory
  2. 0

    dropwizard developers mailing list ()

    gmane.org | 7 months ago
    java.lang.IllegalStateException: Unable to perform operation: create on org.glassfish.jersey.message.internal.MessageBodyFactory
  3. 0

    Migrating from Spring-Jersey 1.x to 2.x

    Stack Overflow | 3 years ago | Ryan
    java.lang.IllegalStateException: Unable to perform operation: create on org.glassfish.jersey.message.internal.MessageBodyFactory
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    dropwizard users mailing list ()

    gmane.org | 6 months ago
    java.lang.IllegalStateException: Unable to perform operation: create on org.glassfish.jersey.message.internal.MessageBodyFactory

    6 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalStateException

      Unable to perform operation: create on org.glassfish.jersey.message.internal.MessageBodyFactory

      at org.jvnet.hk2.internal.ClazzCreator.create()
    2. ServiceLocator Default Implementation
      SingletonContext$1.compute
      1. org.jvnet.hk2.internal.ClazzCreator.create(ClazzCreator.java:443)
      2. org.jvnet.hk2.internal.SystemDescriptor.create(SystemDescriptor.java:456)
      3. org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:114)
      4. org.jvnet.hk2.internal.SingletonContext$1.compute(SingletonContext.java:102)
      4 frames
    3. HK2 Implementation Utilities
      Cache$OriginThreadAwareFuture$1.call
      1. org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture$1.call(Cache.java:97)
      1 frame
    4. Java RT
      FutureTask.run
      1. java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      2. java.util.concurrent.FutureTask.run(FutureTask.java:166)
      2 frames
    5. HK2 Implementation Utilities
      Cache.compute
      1. org.glassfish.hk2.utilities.cache.Cache$OriginThreadAwareFuture.run(Cache.java:154)
      2. org.glassfish.hk2.utilities.cache.Cache.compute(Cache.java:199)
      2 frames
    6. ServiceLocator Default Implementation
      ServiceLocatorImpl.getService
      1. org.jvnet.hk2.internal.SingletonContext.findOrCreate(SingletonContext.java:153)
      2. org.jvnet.hk2.internal.Utilities.createService(Utilities.java:2445)
      3. org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:621)
      4. org.jvnet.hk2.internal.ServiceLocatorImpl.getService(ServiceLocatorImpl.java:606)
      4 frames
    7. jersey-core-server
      ApplicationHandler$3.run
      1. org.glassfish.jersey.server.model.ComponentModelValidator.<init>(ComponentModelValidator.java:97)
      2. org.glassfish.jersey.server.ApplicationHandler.initialize(ApplicationHandler.java:457)
      3. org.glassfish.jersey.server.ApplicationHandler.access$500(ApplicationHandler.java:162)
      4. org.glassfish.jersey.server.ApplicationHandler$3.run(ApplicationHandler.java:322)
      4 frames
    8. Jersey Core
      Errors.processWithException
      1. org.glassfish.jersey.internal.Errors$2.call(Errors.java:289)
      2. org.glassfish.jersey.internal.Errors$2.call(Errors.java:286)
      3. org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      4. org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      5. org.glassfish.jersey.internal.Errors.processWithException(Errors.java:286)
      5 frames
    9. jersey-core-server
      ApplicationHandler.<init>
      1. org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:319)
      2. org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:284)
      2 frames
    10. jersey-container-servlet-core
      ServletContainer.init
      1. org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:311)
      2. org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:168)
      3. org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:358)
      3 frames
    11. JavaServlet
      GenericServlet.init
      1. javax.servlet.GenericServlet.init(GenericServlet.java:158)
      1 frame
    12. Glassfish Core
      HostConfig.manageApp
      1. org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1236)
      2. org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1149)
      3. org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1041)
      4. org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4910)
      5. org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5192)
      6. org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
      7. org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:726)
      8. org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:702)
      9. org.apache.catalina.core.StandardHost.addChild(StandardHost.java:697)
      10. org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1646)
      10 frames
    13. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:601)
      4 frames
    14. Embedded GlassFish Web
      BaseModelMBean.invoke
      1. org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
      1 frame
    15. Java RT
      JmxMBeanServer.invoke
      1. com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
      2. com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:791)
      2 frames
    16. Embedded GlassFish Web
      MBeanFactory.createStandardContext
      1. org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:463)
      2. org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:413)
      2 frames
    17. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      4. java.lang.reflect.Method.invoke(Method.java:601)
      4 frames
    18. Embedded GlassFish Web
      BaseModelMBean.invoke
      1. org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
      1 frame
    19. Java RT
      DefaultMBeanServerInterceptor.invoke
      1. com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
      1 frame