1 2 Previous Next 19 Replies Latest reply on Jul 20, 2010 1:30 PM by cbrock

    serializableTypes

    pablo.mmarcondes

      Hi guys, Im trying to serialize a class using the ErraiApp.properties property errai.bus.serializableTypes, but I'm getting this error:

       

       

      [ERROR] Line 238: The nested type somethinghere.response.PopupMessage$MESSAGE_CODE cannot be referenced using its binary name
      [INFO]                [ERROR] Line 303: The nested type somethinghere.response.PopupMessage$MESSAGE_CODE cannot be referenced using its binary name
      [INFO]       [ERROR] Unable to find recently-generated type 'org.jboss.errai.bus.client.ext.ExtensionsLoaderImpl

       

      MESSAGE_CODE is an enum inside PopupMessage, does the errai serialization supports enums?

       

      Thanks,

       

      Pablo

        • 1. Re: serializableTypes
          pablo.mmarcondes

          Hi guys, I think I've found a problem with this serializableTypes thing, when using it with classes without enum, it passes the compilation, but at deploy time I got this:

           

           

          Caused by: java.lang.ClassNotFoundException: errai.bus.serializableTypes
                  at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
                  at java.security.AccessController.doPrivileged(Native Method)
                  at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
                  at org.glassfish.web.loader.WebappClassLoader.findClass(WebappClassLoader.java:959)
                  at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1430)
                  at java.lang.Class.forName0(Native Method)
                  at java.lang.Class.forName(Class.java:169)
                  at org.jboss.errai.bus.server.service.bootstrap.DiscoverServices.execute(DiscoverServices.java:210)
                  ... 98 more

           

          and looking at the code it seems that this code :

          Enumeration<String> keys = bundle.getKeys();

          while(keys.hasMoreElements())

                  {

                    String key = keys.nextElement();

                    if(key.equals(ErraiServiceConfigurator.CONFIG_ERRAI_SERIALIZABLE_TYPE))

                    {

                      for (String s : key.split(" ")) {

                        try {

                          Class<?> cls = Class.forName(s.trim());

           

           

          should be something like this:

          Enumeration<String> keys = bundle.getKeys();

          while(keys.hasMoreElements())

                  {

                    String key = keys.nextElement();

                    if(key.equals(ErraiServiceConfigurator.CONFIG_ERRAI_SERIALIZABLE_TYPE))

                    {

                      String value = bundle.getString(key);

                      for (String s : value.split(" ")) {

                        try {

                          Class<?> cls = Class.forName(s.trim());

           

           

          what do you think?

          • 2. Re: serializableTypes
            cbrock

            Interesting.  I'm responding from my cellphone right now. I will definitely look into this tomorrow. Can you log a JIRA?

            • 3. Re: serializableTypes
              pablo.mmarcondes

              I've found that Heiko Braun has created this issue, but why is it associated to CDI?

               

              Heiko Braun created ERRAI-82 (Provide an API to register serializable types from external context (CDI))

              • 4. Re: serializableTypes
                cbrock

                That's actually a separate issue.   But I can now confirm the enum issue is fixed in trunk.  However, all enums must be exposed just like normal classes with @ExposeEntity or in the properties file per the docs, otherwise you will experience a failure.

                1 of 1 people found this helpful
                • 5. Re: serializableTypes
                  pablo.mmarcondes

                  I saw your implementation, but I think the DiscoverServices class is not correct by this line:

                  for (String s : key.split(" ")) {

                   

                  applying this diff, Ive managed to get the external classes recognized:

                   

                  Index: src/main/java/org/jboss/errai/bus/server/service/bootstrap/DiscoverServices.java
                  ===================================================================
                  --- src/main/java/org/jboss/errai/bus/server/service/bootstrap/DiscoverServices.java     (revision 1602)
                  +++ src/main/java/org/jboss/errai/bus/server/service/bootstrap/DiscoverServices.java     (working copy)
                  @@ -219,7 +219,8 @@
                                   while (keys.hasMoreElements()) {
                                       String key = keys.nextElement();
                                       if (key.equals(ErraiServiceConfigurator.CONFIG_ERRAI_SERIALIZABLE_TYPE)) {
                  -                        for (String s : key.split(" ")) {
                  +                        String value = bundle.getString(key);
                  +                        for (String s : value.split(" ")) {
                                               try {
                                                   Class<?> cls = Class.forName(s.trim());
                                                   log.info("Marked " + cls + " as serializable.");

                   

                  but the Enum serialization is not working yet as it should be, I've got this error:

                   

                  [ERROR] Type annotated with @ExposeEntity does not expose a default constructor
                  [INFO] java.lang.NoSuchMethodException: com.ati.sglweb.sglclient.shared.dto.basics.ExecutedActionType.<init>()
                  [INFO] at java.lang.Class.getConstructor0(Class.java:2706)
                  [INFO] at java.lang.Class.getConstructor(Class.java:1657)
                  [INFO] at org.jboss.errai.bus.rebind.BusClientConfigGenerator.generateMarshaller(BusClientConfigGenerator.java:123)
                  [INFO] at org.jboss.errai.bus.rebind.BusClientConfigGenerator.generate(BusClientConfigGenerator.java:94)

                   

                  Can someone help me on these, please?

                   

                  Thanks in advance,

                   

                  Pablo

                  • 6. Re: serializableTypes
                    cbrock

                    So you are configuring the type in a properties file or are you using @ExposeEntity?

                    • 7. Re: serializableTypes
                      pablo.mmarcondes

                      This error occur when Im using the properties file, because the classes are on an external jar

                      • 8. Re: serializableTypes
                        cbrock

                        Should be fixed now.

                        • 9. Re: serializableTypes
                          pablo.mmarcondes

                          We will test it today and give a feedback, thanks!

                          • 10. Re: serializableTypes
                            pablo.mmarcondes

                            Sorry for the delay, but with the svn code from today, its not working for enums yet.

                             

                            [ERROR] org.jboss.errai.bus.server.ErraiBootstrapFailure: org.jboss.errai.bus.rebind.GenerationException: Type annotated with @ExposeEntity does not expose a default constructor
                            [ERROR] at org.jboss.errai.bus.rebind.BusClientConfigGenerator.generate(BusClientConfigGenerator.java:97)
                            [ERROR] at org.jboss.errai.bus.rebind.ExtensionProxyGenerator.generateExtensions(ExtensionProxyGenerator.java:128)
                            [ERROR] at org.jboss.errai.bus.rebind.ExtensionProxyGenerator.generateClass(ExtensionProxyGenerator.java:105)
                            [ERROR] at org.jboss.errai.bus.rebind.ExtensionProxyGenerator.generate(ExtensionProxyGenerator.java:66)
                            [ERROR] at com.google.gwt.dev.javac.StandardGeneratorContext.runGenerator(StandardGeneratorContext.java:418)
                            [ERROR] at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:38)
                            [ERROR] at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.tryRebind(StandardRebindOracle.java:108)
                            [ERROR] at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:54)
                            [ERROR] at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:154)
                            [ERROR] at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:143)
                            [ERROR] at com.google.gwt.dev.Precompile$DistillerRebindPermutationOracle.getAllPossibleRebindAnswers(Precompile.java:317)
                            [ERROR] at com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.doFindAdditionalTypesUsingRebinds(WebModeCompilerFrontEnd.java:95)
                            [ERROR] at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.process(AbstractCompiler.java:200)
                            [ERROR] at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:444)
                            [ERROR] at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.compile(AbstractCompiler.java:123)
                            [ERROR] at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.compile(AbstractCompiler.java:234)
                            [ERROR] at com.google.gwt.dev.jdt.AbstractCompiler$Sandbox$CompilerImpl.access$200(AbstractCompiler.java:109)
                            [ERROR] at com.google.gwt.dev.jdt.AbstractCompiler.compile(AbstractCompiler.java:522)
                            [ERROR] at com.google.gwt.dev.jdt.BasicWebModeCompiler.getCompilationUnitDeclarations(BasicWebModeCompiler.java:112)
                            [ERROR] at com.google.gwt.dev.jdt.WebModeCompilerFrontEnd.getCompilationUnitDeclarations(WebModeCompilerFrontEnd.java:47)
                            [ERROR] at com.google.gwt.dev.jjs.JavaToJavaScriptCompiler.precompile(JavaToJavaScriptCompiler.java:422)
                            [ERROR] at com.google.gwt.dev.jjs.JavaScriptCompiler.precompile(JavaScriptCompiler.java:32)
                            [ERROR] at com.google.gwt.dev.Precompile.precompile(Precompile.java:522)
                            [ERROR] at com.google.gwt.dev.Precompile.precompile(Precompile.java:414)
                            [ERROR] at com.google.gwt.dev.Compiler.run(Compiler.java:201)
                            [ERROR] at com.google.gwt.dev.Compiler$1.run(Compiler.java:152)
                            [ERROR] at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:87)
                            [ERROR] at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:81)
                            [ERROR] at com.google.gwt.dev.Compiler.main(Compiler.java:159)
                            [ERROR] Caused by: org.jboss.errai.bus.rebind.GenerationException: Type annotated with @ExposeEntity does not expose a default constructor
                            [ERROR] at org.jboss.errai.bus.rebind.BusClientConfigGenerator.generateMarshaller(BusClientConfigGenerator.java:128)
                            [ERROR] at org.jboss.errai.bus.rebind.BusClientConfigGenerator.generate(BusClientConfigGenerator.java:94)
                            [INFO] [ERROR] Error generating extensions

                            • 11. Re: serializableTypes
                              cbrock

                              Would you be willing to post some example code?  I can't seem to reproduce this.

                              • 12. Re: serializableTypes
                                pablo.mmarcondes

                                I will do that, we've got comet working fine with atmosphere-gwt-comet, but we want to make it work with errai too, so we can compare both.

                                • 13. Re: serializableTypes
                                  pablo.mmarcondes

                                  Hi,

                                   

                                  We've found that using your example project errai-bus-demos-serialization, and configuring it to use serialization from properties config file:

                                   

                                  adding errai.bus.serializableTypes=org.errai.samples.serialization.client.model.RecordType to file ErraiApp.properties

                                   

                                  we could reproduce the error we are facing with our project.

                                   

                                  Can you try that on your side?

                                   

                                  Regards

                                  • 14. Re: serializableTypes
                                    cbrock

                                    I'll definitely look at this.

                                    1 2 Previous Next