« Return to Thread: Google App Engine Rails Template

Re: Google App Engine Rails Template

by Carson Welsh :: Rate this Message:

Reply to Author | View in Thread


Hi Christian,

I wonder if you have any idea what might be going wrong here. I downloaded the Nick Sieger template and added your addition to the application_controller.rb, added the appengine-api-1.0-sdk-1.2.1.jar to the lib folder and require it in config/development.rb. But I get the following error after I start the application:

NameError in SnoopController#index

cannot load Java class com.google.appengine.api.datastore.dev.LocalDatastoreService

RAILS_ROOT: C:/wsp/siegerails/examples/rails

Application Trace | Framework Trace | Full Trace
C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/core_ext/object.rb:87:in `get_proxy_or_package_under_package'
C:/jr/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in `method_missing'
C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:20
C:/wsp/siegerails/examples/rails/app/controllers/application_controller.rb:380:in `load'
C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:1
C:/wsp/siegerails/examples/rails/app/controllers/snoop_controller.rb:380:in `load'



On Tue, Jun 16, 2009 at 5:12 AM, Christian Seiler <chr.seiler@...> wrote:
I haven't played with it lately so I need to recall..

Well, first of all my dev environment is not a real AppEngine setup,
it's plain JRuby/Rails plus Datastore. That's all I have used so far (no
memcache or mailer). One thing you need to do is require the
appengine-api-1.0-sdk-1.2.1.jar to make the AppEngine stuff available.
I've put the jar in the lib folder and require it in config/development.rb.

I think that's all. By the way, I used this example as project template:
http://github.com/nicksieger/jruby-rack/tree/bb907c03c48eb999e7d099068245b91eeda545bf/examples/rails

I hope this helps!

Carson Welsh wrote:
>
> Hi Christian
>
> Thanks for the code sample.
>
> I am very eager to use a standard Ruby development environment for App
> Engine without restarts as you have described.
>
> I have spent several hours trying to use your code sample to configure
> a Rails project with GAE but so far have been unsuccessful.
>
> Have you made any other significant changes to your Rails app besides
> what you mentioned?
>
> Thanks,
> Carson
>
>
>
>
>
>     From: *Christian Seiler* <chr.seiler@...
>     <mailto:chr.seiler@...>>
>     Date: Mon, Jun 15, 2009 at 5:37 AM
>     To: user@... <mailto:user@...>
>
>
>     My workaround in development mode so far: Simply using Webrick as
>     usual
>     plus setting up the datastore in the controller
>     (application_controller.rb).
>
>      if Rails.env=='development'
>        before_filter :setup_datastore
>        after_filter  :teardown_datastore
>      end
>
>      protected
>
>        if Rails.env=='development'
>          import com.google.apphosting.api.ApiProxy
>          import
>     com.google.appengine.api.datastore.dev.LocalDatastoreService
>          import com.google.appengine.tools.development.ApiProxyLocalImpl
>
>          class DevEnvironment
>            include ApiProxy::Environment
>            def app_id
>              'Dev Environment'
>            end
>          end
>
>          def setup_datastore
>            ApiProxy.environment_for_current_thread = DevEnvironment.new
>            ApiProxy.delegate = Class.new(ApiProxyLocalImpl).new
>     java.io.File.new('.')
>            #ApiProxy.delegate.set_property
>     LocalDatastoreService::NO_STORAGE_PROPERTY, 'true'
>          end
>
>          def teardown_datastore
>            #ApiProxy.delegate.get_service('datastore_v3').clear_profiles
>            ApiProxy.delegate = nil
>            ApiProxy.environment_for_current_thread = nil
>          end
>        end
>     ---------------------------------------------------------------------
>     To unsubscribe from this list, please visit:
>
>        http://xircles.codehaus.org/manage_email
>
>
>
>
>


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email



 « Return to Thread: Google App Engine Rails Template