1 Reply Latest reply on Jul 30, 2013 10:54 AM by Jonathan Fuerth

    Only one non-annotated entity parameter allowed per method

    xybrek Newbie

      I'm getting this error:

       

       

       

      00:00:27.080 [ERROR] Error generating JAX-RS extensions java.lang.RuntimeException: Only one non-annotated entity parameter allowed per method:login      at org.jboss.errai.enterprise.rebind.JaxrsResourceMethodParameters.setEntityParameter(JaxrsResourceMethodParameters.java:209)      at org.jboss.errai.enterprise.rebind.JaxrsResourceMethodParameters.fromMethod(JaxrsResourceMethodParameters.java:117)      at org.jboss.errai.enterprise.rebind.JaxrsResourceMethodParameters.fromMethod(JaxrsResourceMethodParameters.java:66)      at org.jboss.errai.enterprise.rebind.JaxrsResourceMethod.(JaxrsResourceMethod.java:63)      at org.jboss.errai.enterprise.rebind.JaxrsProxyGenerator.generate(JaxrsProxyGenerator.java:78)      at org.jboss.errai.enterprise.rebind.JaxrsProxyLoaderGenerator.generate(JaxrsProxyLoaderGenerator.java:106)      at org.jboss.errai.enterprise.rebind.JaxrsProxyLoaderGenerator.generate(JaxrsProxyLoaderGenerator.java:93)      at org.jboss.errai.enterprise.rebind.JaxrsProxyLoaderGenerator.generate(JaxrsProxyLoaderGenerator.java:77)      at com.google.gwt.core.ext.GeneratorExtWrapper.generate(GeneratorExtWrapper.java:48)      at com.google.gwt.core.ext.GeneratorExtWrapper.generateIncrementally(GeneratorExtWrapper.java:60)      at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:647)      at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41)      at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:78)      at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:268)      at com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind(ShellModuleSpaceHost.java:141)      at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:585)      at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:455)      at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)      at com.google.gwt.core.client.GWT.create(GWT.java:97)      at org.jboss.errai.enterprise.client.jaxrs.JaxrsModuleBootstrapper.run(JaxrsModuleBootstrapper.java:41)      at org.jboss.errai.ioc.client.BootstrapperImpl.(BootstrapperImpl.java:152)      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 com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:465)      at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)      at com.google.gwt.core.client.GWT.create(GWT.java:97)      at org.jboss.errai.ioc.client.Container.bootstrapContainer(Container.java:55)      at org.jboss.errai.ioc.client.Container.onModuleLoad(Container.java:34)      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 com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:396)      at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)      at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525)      at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)      at java.lang.Thread.run(Thread.java:722)

       

      for the implementation of this interface:

       

      @Path("userservice")

      public interface UserService {

          @POST

          @Consumes(MediaType.APPLICATION_JSON)

          public void login(String username, String password, boolean rememberMe);

      }

       

      What does this "Only one non-annotated entity parameter allowed per method" mean? A method cannot have many parameters? Do I need to create a @Portable model that will have to be passed as a login model? Please advise

        • 1. Re: Only one non-annotated entity parameter allowed per method
          Jonathan Fuerth Master

          The Errai JAX-RS client automatically marshals portable types into JSON when you call a JAX-RS method, and it also unmarshals the response from JSON. This only works when the JAX-RS method takes one "automarshalled" argument.

           

          In the specific case you've mentioned, I'd recommend creating a @Portable type that contains the three values username, password, and rememberMe, and use that for the argument to login().