2 Replies Latest reply on Jan 20, 2015 10:05 AM by Aaron Anderson

    Errai 3.1.0 marshalling problem with WildFly 8.2

    Aaron Anderson Newbie

      I am attempting to use Errai JAX-RS which utilizes Errai marshalling. In my maven project I have included a single dependency on errai-javaee-all. I can build and deploy the application but when I attempt to access it I get the following exception:

      ...

      Caused by: java.lang.ExceptionInInitializerError

        at org.jboss.errai.jaxrs.ErraiProvider.<clinit>(ErraiProvider.java:49) [errai-jaxrs-provider-3.1.0.Final.jar:3.1.0.Final]

      ...

      Caused by: java.lang.NoClassDefFoundError: Could not initialize class org.jboss.errai.marshalling.rebind.DefinitionsFactorySingleton

        at org.jboss.errai.marshalling.server.MappingContextSingleton$4.<init>(MappingContextSingleton.java:190) [errai-marshalling-3.1.0.Final.jar:3.1.0.Final]

        at org.jboss.errai.marshalling.server.MappingContextSingleton.loadDynamicMarshallers(MappingContextSingleton.java:189) [errai-marshalling-3.1.0.Final.jar:3.1.0.Final]

        at org.jboss.errai.marshalling.server.MappingContextSingleton.<clinit>(MappingContextSingleton.java:84) [errai-marshalling-3.1.0.Final.jar:3.1.0.Final]

       

      In my ErraiApp.properties if I add the following I get more detail:

       

      errai.marshalling.use_static_marshallers=true

      errai.marshalling.force_static_marshallers=true

       

      15:05:28,786 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /rs/MyApp: com.google.common.util.concurrent.ExecutionError: java.lang.ExceptionInInitializerError

        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2199) [guava-17.0.jar:]

        at com.google.common.cache.LocalCache.get(LocalCache.java:3934) [guava-17.0.jar:]

        at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3938) [guava-17.0.jar:]

        at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4821) [guava-17.0.jar:]

        at org.jboss.weld.util.cache.LoadingCacheUtils.getCacheValue(LoadingCacheUtils.java:49) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.util.cache.LoadingCacheUtils.getCastCacheValue(LoadingCacheUtils.java:74) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bean.proxy.ClientProxyProvider.getClientProxy(ClientProxyProvider.java:204) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:736) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:762) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.util.ForwardingBeanManager.getReference(ForwardingBeanManager.java:61) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bean.builtin.BeanManagerProxy.getReference(BeanManagerProxy.java:89) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.resteasy.cdi.CdiConstructorInjector.construct(CdiConstructorInjector.java:64) [resteasy-cdi-3.0.10.Final.jar:]

        at org.jboss.resteasy.spi.ResteasyProviderFactory.createProviderInstance(ResteasyProviderFactory.java:2211) [resteasy-jaxrs-3.0.10.Final.jar:]

        at org.jboss.resteasy.spi.ResteasyProviderFactory.addMessageBodyReader(ResteasyProviderFactory.java:784) [resteasy-jaxrs-3.0.10.Final.jar:]

        at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1402) [resteasy-jaxrs-3.0.10.Final.jar:]

        at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1346) [resteasy-jaxrs-3.0.10.Final.jar:]

        at org.jboss.resteasy.spi.ResteasyProviderFactory.registerProvider(ResteasyProviderFactory.java:1268) [resteasy-jaxrs-3.0.10.Final.jar:]

        at org.jboss.resteasy.spi.ResteasyDeployment.registerProvider(ResteasyDeployment.java:531) [resteasy-jaxrs-3.0.10.Final.jar:]

        at org.jboss.resteasy.spi.ResteasyDeployment.registration(ResteasyDeployment.java:338) [resteasy-jaxrs-3.0.10.Final.jar:]

        at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:241) [resteasy-jaxrs-3.0.10.Final.jar:]

        at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.init(ServletContainerDispatcher.java:112) [resteasy-jaxrs-3.0.10.Final.jar:]

        at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.init(HttpServletDispatcher.java:36) [resteasy-jaxrs-3.0.10.Final.jar:]

        at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

        at org.wildfly.extension.undertow.security.RunAsLifecycleInterceptor.init(RunAsLifecycleInterceptor.java:79)

        at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:103) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:220) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.servlet.core.ManagedServlet.getServlet(ManagedServlet.java:163) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:84) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

        at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:63) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

        at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:261) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:247) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:76) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:166) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

        at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:759) [undertow-core-1.1.0.Final.jar:1.1.0.Final]

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_25]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_25]

        at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_25]

      Caused by: java.lang.ExceptionInInitializerError

        at org.jboss.errai.jaxrs.ErraiProvider.<clinit>(ErraiProvider.java:49) [errai-jaxrs-provider-3.1.0.Final.jar:3.1.0.Final]

        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [rt.jar:1.8.0_25]

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [rt.jar:1.8.0_25]

        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [rt.jar:1.8.0_25]

        at java.lang.reflect.Constructor.newInstance(Constructor.java:408) [rt.jar:1.8.0_25]

        at java.lang.Class.newInstance(Class.java:438) [rt.jar:1.8.0_25]

        at org.jboss.weld.security.NewInstanceAction.run(NewInstanceAction.java:33) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_25]

        at org.jboss.weld.bean.proxy.ProxyFactory.create(ProxyFactory.java:303) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bean.proxy.ClientProxyFactory.create(ClientProxyFactory.java:111) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bean.proxy.ClientProxyProvider.createClientProxy(ClientProxyProvider.java:180) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bean.proxy.ClientProxyProvider.createClientProxy(ClientProxyProvider.java:170) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bean.proxy.ClientProxyProvider.access$100(ClientProxyProvider.java:45) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bean.proxy.ClientProxyProvider$CreateClientProxy.load(ClientProxyProvider.java:56) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at org.jboss.weld.bean.proxy.ClientProxyProvider$CreateClientProxy.load(ClientProxyProvider.java:52) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]

        at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3524) [guava-17.0.jar:]

        at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2317) [guava-17.0.jar:]

        at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2280) [guava-17.0.jar:]

        at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2195) [guava-17.0.jar:]

        ... 52 more

      Caused by: java.lang.RuntimeException: critical problem loading the marshallers

        at org.jboss.errai.marshalling.server.MappingContextSingleton.<clinit>(MappingContextSingleton.java:94) [errai-marshalling-3.1.0.Final.jar:3.1.0.Final]

        ... 71 more

      Caused by: java.io.IOException: Enforcing static marshallers but failed to load generated server marshallers

        at org.jboss.errai.marshalling.server.MappingContextSingleton.<clinit>(MappingContextSingleton.java:81) [errai-marshalling-3.1.0.Final.jar:3.1.0.Final]

        ... 71 more

      Caused by: java.lang.ExceptionInInitializerError

        at org.jboss.errai.marshalling.rebind.api.GeneratorMappingContext.<init>(GeneratorMappingContext.java:42) [errai-marshalling-3.1.0.Final.jar:3.1.0.Final]

        at org.jboss.errai.marshalling.rebind.api.GeneratorMappingContextFactory.create(GeneratorMappingContextFactory.java:65) [errai-marshalling-3.1.0.Final.jar:3.1.0.Final]

        at org.jboss.errai.marshalling.rebind.MarshallerGeneratorFactory._generate(MarshallerGeneratorFactory.java:163) [errai-marshalling-3.1.0.Final.jar:3.1.0.Final]

        at org.jboss.errai.marshalling.rebind.MarshallerGeneratorFactory.generate(MarshallerGeneratorFactory.java:153) [errai-marshalling-3.1.0.Final.jar:3.1.0.Final]

        at org.jboss.errai.marshalling.server.util.ServerMarshallUtil.getGeneratedMarshallerFactoryForServer(ServerMarshallUtil.java:114) [errai-marshalling-3.1.0.Final.jar:3.1.0.Final]

        at org.jboss.errai.marshalling.server.MappingContextSingleton.loadPrecompiledMarshallers(MappingContextSingleton.java:107) [errai-marshalling-3.1.0.Final.jar:3.1.0.Final]

        at org.jboss.errai.marshalling.server.MappingContextSingleton.<clinit>(MappingContextSingleton.java:74) [errai-marshalling-3.1.0.Final.jar:3.1.0.Final]

        ... 71 more

      Caused by: java.lang.RuntimeException: org.jboss.errai.marshalling.client.api.exceptions.InvalidMappingException: cannot alias type SynchronizedRandomAccessList to List: the specified alias type does not exist

        at org.jboss.errai.marshalling.rebind.DefinitionsFactorySingleton.<clinit>(DefinitionsFactorySingleton.java:32) [errai-marshalling-3.1.0.Final.jar:3.1.0.Final]

        ... 78 more

      Caused by: org.jboss.errai.marshalling.client.api.exceptions.InvalidMappingException: cannot alias type SynchronizedRandomAccessList to List: the specified alias type does not exist

        at org.jboss.errai.marshalling.rebind.DefinitionsFactoryImpl.loadCustomMappings(DefinitionsFactoryImpl.java:359) [errai-marshalling-3.1.0.Final.jar:3.1.0.Final]

        at org.jboss.errai.marshalling.rebind.DefinitionsFactoryImpl.<init>(DefinitionsFactoryImpl.java:81) [errai-marshalling-3.1.0.Final.jar:3.1.0.Final]

        at org.jboss.errai.marshalling.rebind.DefinitionsFactorySingleton.newInstance(DefinitionsFactorySingleton.java:41) [errai-marshalling-3.1.0.Final.jar:3.1.0.Final]

        at org.jboss.errai.marshalling.rebind.DefinitionsFactorySingleton.<clinit>(DefinitionsFactorySingleton.java:26) [errai-marshalling-3.1.0.Final.jar:3.1.0.Final]

        ... 78 more

       

      I attempted to troubleshoot this issue without much success. It appears that the DefinitionsFactoryImpl declares aliases via the defaultMappingAliases() but no corresponding definitions are loaded except for java.lang.Object.

        • 1. Re: Errai 3.1.0 marshalling problem with WildFly 8.2
          Christian Sadilek Master

          Hi Aaron,

           

          You don't need to set errai.marshalling.use_static_marshallers and errai.marshalling.force_static_marshallers in your ErraiApp.properties.

           

          However, there seems to be something wrong with your build. When you compile and package your .war file, static marshallers for the server should be generated. So, after running i.e. mvn clean install you should have a file called ServerMarshallingFactoryImpl.class.

           

          Can you verify that? i.e. find . -name ServerMarshallingFactoryImpl.class should find something like ./target/your-project/WEB-INF/classes/org/jboss/errai/marshalling/server/impl/ServerMarshallingFactoryImpl.class

           

          Cheers,

          Christian

          • 2. Re: Errai 3.1.0 marshalling problem with WildFly 8.2
            Aaron Anderson Newbie

            Thanks Christian, you were correct, the generated ServerMarshallingFactoryImpl class was not in the application's classpath. Unfortunately my log4.properties file was not being utilized either otherwise I should have received a warning stating this. I am using Eclipse Luna, m2e-wtp, and the JBoss tools plugin manage wildfly and deploy applications to it. Even though the maven gwt plugin was placing the generated class files in the target/<application>/WEB-INF/classes directory and those classes were in the war archive they were not being synchronized to the wildfly/standalone/deployments/<application> directory by the JBoss tools wildfly eclipse plugin.  Eventually I added <outputDirectory>src/main/webapp/WEB-INF/classes</outputDirectory> back into my pom.xml which placed the generated classes in the src directory and after refreshing the project again I resolved the marshalling problem. Also placing the classes in the src directory will probably aid the maven gwt plugin in successfully launching the gwt codeserver.


            Thanks,

             

            Aaron