6 Replies Latest reply on Mar 6, 2014 2:21 AM by Gerbrand Stap

    Error migrating

    Gerbrand Stap



      I'm trying to migrate from RhoMobile 2 to 4, but I'm getting errors when running the original code when models are initialized.

      The statement "require_source 'Administration'" (or any model) result in the following error in the log:


      I 02/21/2014 11:44:37:936 00005b34                  APP| load_model: Administration

      I 02/21/2014 11:44:37:937 00005b34              RhoRuby| require_compiled: Administration/administration

      E 02/21/2014 11:44:37:940 00005b34              RhoRuby| require_compiled: error: can not find Administration/administration_custom

      I 02/21/2014 11:44:37:961 00005b34                  APP| model name: Administration

      I 02/21/2014 11:44:37:963 00005b34                  APP| model class found

      I 02/21/2014 11:44:37:964 00005b34                  APP| Administration : {"schema"=>{"property"=>{"id"=>[:integer, nil], "name"=>[:string, nil]}, "unique_index"=>{"pk_administration"=>[:id]}}, "schema_version"=>"2.8.9"}

      I 02/21/2014 11:44:37:977 00005b34                   DB| Open DB: C:/Ontwikkeling/Connect-It git/MobileClient/rhosimulator/db/syncdblocal.sqlite

      I 02/21/2014 11:44:37:980 00005b34                  APP| init_db_sources

      I 02/21/2014 11:44:37:981 00005b34                  APP| start_id: 40006

      I 02/21/2014 11:44:37:983 00005b34                  APP| Migrate schema sources: {}

      I 02/21/2014 11:44:37:985 00005b34                  APP| exception when init_db_sources: Type error: argument 0 should be string; Trace:C:/MotorolaRhoMobileSuite4.0.0/ruby/lib/ruby/gems/1.9.1/gems/rhodes-4.0.0/lib/framework/rho/rho.rb:611:in `setSourceProperty'

      C:/MotorolaRhoMobileSuite4.0.0/ruby/lib/ruby/gems/1.9.1/gems/rhodes-4.0.0/lib/framework/rho/rho.rb:611:in `block in init_sync_source_properties'

      C:/MotorolaRhoMobileSuite4.0.0/ruby/lib/ruby/gems/1.9.1/gems/rhodes-4.0.0/lib/framework/rho/rho.rb:606:in `each'

      C:/MotorolaRhoMobileSuite4.0.0/ruby/lib/ruby/gems/1.9.1/gems/rhodes-4.0.0/lib/framework/rho/rho.rb:606:in `init_sync_source_properties'

      C:/MotorolaRhoMobileSuite4.0.0/ruby/lib/ruby/gems/1.9.1/gems/rhodes-4.0.0/lib/framework/rho/rho.rb:497:in `load_model'

      C:/MotorolaRhoMobileSuite4.0.0/ruby/lib/ruby/gems/1.9.1/gems/rhodes-4.0.0/lib/framework/rho/rho.rb:1301:in `require_source'

      C:/Ontwikkeling/Connect-It git/MobileClient/app/require_all_sources.rb:5:in `<top (required)>'

      C:/Ontwikkeling/Connect-It git/MobileClient/app/Synchronization/synchronization_req.rb:2:in `require'

      C:/Ontwikkeling/Connect-It git/MobileClient/app/Synchronization/synchronization_req.rb:2:in `<top (required)>'

      C:/Ontwikkeling/Connect-It git/MobileClient/app/application.rb:24:in `require'

      C:/Ontwikkeling/Connect-It git/MobileClient/app/application.rb:24:in `on_ui_created'

      C:/MotorolaRhoMobileSuite4.0.0/ruby/lib/ruby/gems/1.9.1/gems/rhodes-4.0.0/lib/framework/rho/rho.rb:176:in `ui_created'

      PS: The model is defined as:

      class Administration

        include Rhom::FixedSchema

        property :id, :integer

        property :name, :string

        unique_index :pk_administration, [ :id ]

        set :schema_version, '2.8.9'



      Message was edited by: Gerbrand Stap Added model definition

        • Re: Error migrating
          Gerbrand Stap

          I noticed that a new project does not have this problem, so I compared the configurations and added to my configuration what was missing. It turns out that adding the extension rhoconnect-client 'solves' the problem.

          I attached a test project where the problem also occurs. After starting the app, click on 'Product' and check the log.


          We do not use RhoConnect, so we don't need the extension. Can it do any harm to or existing code if we add it for now until this bug is fixed?

            • Re: Error migrating
              Kutir Mobility



              I will run the app locally and get back to you by tomorrow.


              Visnupriya R

              Kutir Mobility

              • Re: Error migrating
                Peter Arcuri

                To my knowledge removing references to RhoConnect should not cause any harm to your project. There was a similar post where someone witness it being the cause for screen display delays and has removed it. It may proved to be beneficial. Here is the post.



                  • Re: Re: Error migrating
                    Gerbrand Stap

                    I completely agree that one should not be required to use RhoConnect.


                    If I'm right, the RhoConnect client was always part of any RhoMobile 2 application. The RhoConnect client became an optional extension In RhoMobile 4. But given the errors we get, I assume that there are still some unintended dependencies between RhoMobile and RhoConnect.


                    I did some digging, and saw that RhoConnect is also mentioned twice in the log, even if you don't use the RhoConnect client:



                    E 03/06/2014 09:58:19:032 000017f0              RhoRuby| require_compiled: error: can not find RhoConnectClient

                    W 03/06/2014 09:58:19:047 000017f0          CExtManager| requireRubyFile cannot find file: RhoConnectClient

                    I 03/06/2014 09:58:19:063 000017f0 RhoconnectClientManager| setRhoconnectClientImpl ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


                    And a little later the RhoConnectClient is found, which is a bit weird:

                    I 03/06/2014 09:58:19:806 000017f0              RhoRuby| require_compiled: rhodes

                    I 03/06/2014 09:58:19:828 000017f0                  APP| Looking for RhoConnectClient

                    I 03/06/2014 09:58:19:838 000017f0                  APP| RhoConnectClient found. do nothing


                    I also looked at the source code (\MotorolaRhoMobileSuite4.0.0\ruby\lib\ruby\gems\1.9.1\gems\rhodes-4.0.0\lib\framework\rho\rho.rb) and saw that the line that causes the error is in the method init_sync_source_properties. In this method there is a check whether RHOCONNECT_CLIENT_PRESENT is defined, which should not be defined in my case, but it is. The bug that I initially posted is prevented when this constant is removed, which can be done by adding the following statement to the start of application.rb:


                    Object.send( :remove_const, :RHOCONNECT_CLIENT_PRESENT )


                    Though this seems VERY hacky to me.