3 Replies Latest reply on Oct 22, 2012 11:48 AM by Jonathan Fuerth

    ErraiApp.properties and marshalling

    Jervis Liu Apprentice

      Hi,

       

      In Guvnor we have two Errai related modules,  droolsjbpm-ide-common and drools-guvnor-webapp. droolsjbpm-ide-common module contains the object models that will be used by drools-guvnor-webapp. I added ErraiApp.properties under drools-guvnor-webapp, after some tunning with ErraiApp.properties file, whole project compiled.

       

      I ran into marshalling problems when I ran drools-guvnor-webapp from mvn gwt:run and from eclipse hosted mode. Both complained:

       

      [ERROR] 1945 [Code server for org.drools.guvnor.Guvnor from Mozilla/5.0 (Windows

      NT 6.1; WOW64; rv:15.0) Gecko/20100101 Firefox/15.0.1 on http://127.0.0.1:8888/

      org.drools.guvnor.Guvnor/Guvnor.html?gwt.codesvr=127.0.0.1:9997 @ V!\X!Y5Lmq;tLl

      69] INFO org.jboss.errai.marshalling.rebind.MarshallerGeneratorFactory - generat

      ing marshalling class...

      [ERROR] org.jboss.errai.marshalling.client.api.exceptions.NoAvailableMarshallerE

      xception: no available marshaller for type: org.drools.ide.common.client.modeldr

      iven.brl.FieldConstraint

      [ERROR]         at org.jboss.errai.marshalling.rebind.api.impl.defaultjava.Defau

      ltJavaMappingStrategy.marshallToJSON(DefaultJavaMappingStrategy.java:458)

      [ERROR]         at org.jboss.errai.marshalling.rebind.api.impl.defaultjava.Defau

      ltJavaMappingStrategy$1.getMarshaller(DefaultJavaMappingStrategy.java:338)

      [ERROR]         at org.jboss.errai.marshalling.rebind.MarshallerGeneratorFactory

      .addMarshaller(MarshallerGeneratorFactory.java:313)

      [ERROR]         at org.jboss.errai.marshalling.rebind.MarshallerGeneratorFactory

      .generateMarshallers(MarshallerGeneratorFactory.java:296)

      [ERROR]         at org.jboss.errai.marshalling.rebind.MarshallerGeneratorFactory

      ._generate(MarshallerGeneratorFactory.java:268)

      [ERROR]         at org.jboss.errai.marshalling.rebind.MarshallerGeneratorFactory

      .generate(MarshallerGeneratorFactory.java:142)

      [ERROR]         at org.jboss.errai.marshalling.rebind.MarshallersGenerator._gene

      rate(MarshallersGenerator.java:359)

      [ERROR]         at org.jboss.errai.marshalling.rebind.MarshallersGenerator.gener

      ateMarshallerBootstrapper(MarshallersGenerator.java:249)

      [ERROR]         at org.jboss.errai.marshalling.rebind.MarshallersGenerator.gener

      ate(MarshallersGenerator.java:234)

      [ERROR]         at com.google.gwt.core.ext.GeneratorExtWrapper.generate(Generato

      rExtWrapper.java:48)

      [ERROR]         at com.google.gwt.core.ext.GeneratorExtWrapper.generateIncrement

      ally(GeneratorExtWrapper.java:60)

      [ERROR]         at com.google.gwt.dev.javac.StandardGeneratorContext.runGenerato

      rIncrementally(StandardGeneratorContext.java:647)

      [ERROR]         at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateW

      ith.java:41)

      [ERROR]         at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind

      (StandardRebindOracle.java:78)

      [ERROR]         at com.google.gwt.dev.shell.StandardRebindOracle.rebind(Standard

      RebindOracle.java:268)

      [ERROR]         at com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind(ShellMod

      uleSpaceHost.java:141)

      [ERROR]         at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:

      585)

      [ERROR]         at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSp

      ace.java:455)

      [ERROR]         at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.j

      ava:49)

      [ERROR]         at com.google.gwt.core.client.GWT.create(GWT.java:97)

      [ERROR]         at org.jboss.errai.marshalling.client.api.MarshallerFramework.<c

      linit>(MarshallerFramework.java:42)

      [ERROR]         at java.lang.Class.forName0(Native Method)

      [ERROR]         at java.lang.Class.forName(Class.java:247)

      [ERROR]         at com.google.gwt.dev.shell.ModuleSpace.loadClassFromSourceName(

      ModuleSpace.java:654)

      [ERROR]         at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:

      363)

      [ERROR]         at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(Oophm

      SessionHandler.java:200)

      [ERROR]         at com.google.gwt.dev.shell.BrowserChannelServer.processConnecti

      on(BrowserChannelServer.java:525)

      [ERROR]         at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChan

      nelServer.java:363)

      [ERROR]         at java.lang.Thread.run(Thread.java:662)

      [INFO] ------------------------------------------------------------------------

       

      I verified dir guvnor-webapp-drools\target\guvnor-webapp-drools-5.5.0-SNAPSHOT\WEB-INF\classes, this dir indeed has the ErraiApp.properties. I read the doc about where to put ErraiApp.properties (https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties), but I am not sure if I interprete it correctly, especially this line:

      "An ErraiApp.properties file must appear at the root of each classpath location that contains an Errai module. The contents of JAR and directory classpath entries that do not contain an ErraiApp.properties are effectively invisible to Errai's classpath scanner."

       

      Does this mean I have to add ErraiApp.properties under droolsjbpm-ide-common module as well? Well, I did try, but this did not help. Am I still missing anything?

       

      Thanks,

      Jervis

        • 1. Re: ErraiApp.properties and marshalling
          Jonathan Fuerth Master

          Yes, you will need an ErraiApp.properties in droolsjbpm-ide-common if it contains types annotated with @Portable. Since you're using Maven to build, it should go in src/main/resources. Is that where you put it?

           

          -Jonathan

          • 2. Re: ErraiApp.properties and marshalling
            Jervis Liu Apprentice

            Yes, I did put an ErraiApp.properties in droolsjbpm-ide-common/src/main/resources. Though this module does not use @Portable annotation as its a module potentially can be shared by several projects and we do not want to introduce Errai dependency to this module right now. In short, droolsjbpm-ide-common contains ErraiApp.properties, but it is not an Errai project. I verified the droolsjbpm-ide-common.jar generated by maven, the jar indeed has an ErraiApp.properties under the root directory of the jar.

             

            Anyway, when I start Guvnor from eclipse or from mvn gwt:run, it wont start and complains "no available marshaller for type: org.drools.ide.common.client.modeldriven.brl.FieldConstraint". Note, FieldConstraint is an interface, all its implementations resides in droolsjbpm-ide-common module. Also note, the compiler works alright. Guvnor module uses several classes from droolsjbpm-ide-common, the compile fails with marshalling errors if the content of the ErraiApp.properties is not correct. So this means errai indeed picks up ErraiApp.properties during the compile time.

            • 3. Re: ErraiApp.properties and marshalling
              Jonathan Fuerth Master

              Hmm, my next suggestion would be to ensure the types you need from droolsjbpm-ide-common are in a GWT module. But since you're having no trouble with the production mode compile, I guess they must be in a GWT module.

               

              So that leaves me thinking there must be a classpath difference between the production build (which works) and the dev mode build (which misses all implementations of FieldConstraint.) Can you take a look at the full classpath in both cases and see if there's something missing (or even out-of-order) in the dev mode classpath?

               

              -Jonathan