2

ペーパークリップを使用して、S3 への画像ファイルのアップロードを処理しようとしています。私のユーザーモデルでは:

validates_attachment :avatar, :content_type => { :content_type => ["image/jpg", "image/png"] }, :size => { :in => 0..500.kilobytes }

画像をアップロードすると、次のエラーが表示されます。

Command :: identify -format %wx%h "C:/Users/Tom/AppData/Local/Temp/rails121215-6332-1o1oxtk-30333.png[0]"
Completed 500 Internal Server Error in 277ms

NoMethodError (undefined method `exitstatus' for nil:NilClass)

ここでの同様の問題は、いくつかの imageMagick コマンドの実行に問題があることを示唆しています。しかし、私は設定Paperclip.options[:command_path]しましたが、これは違いはありません。Imagemagick もパス上にありidentify -format %wx%h "C:/Users/Tom/AppData/Local/Temp/rails121215-6332-1o1oxtk-30333.png[0]"、コマンド プロンプトで実行すると50x64返されます。さらに、私はトルクボックスを使用しており、トルクボックスウィンドウに何らかの理由で次のように表示されます。14:59:11,205 INFO [stdout] (Thread-144) 50x64したがって、コマンドは明らかに何らかの方法で実行されています。

も使用してみましCocaine::CommandLine.runner = Cocaine::CommandLine::BackticksRunner.newたが、これは次のエラーになります。 Errno::EINVAL (Invalid argument - =ExitCode)

違いがあれば、TorqueboxでJRubyを使用しています。

トレースは次のとおりです。

cocaine (0.4.2) lib/cocaine/command_line.rb:80:in `run'
paperclip (3.3.1) lib/paperclip/helpers.rb:31:in `run'
paperclip (3.3.1) lib/paperclip/geometry.rb:23:in `from_file'
activesupport (3.2.8) lib/active_support/core_ext/kernel/reporting.rb:43:in `silence_stream'
paperclip (3.3.1) lib/paperclip/geometry.rb:22:in `from_file'
paperclip (3.3.1) lib/paperclip/thumbnail.rb:35:in `initialize'
paperclip (3.3.1) lib/paperclip/processor.rb:33:in `make'
paperclip (3.3.1) lib/paperclip/attachment.rb:410:in `post_process_style'
org/jruby/RubyArray.java:1615:in `each'
org/jruby/RubyEnumerable.java:830:in `inject'
paperclip (3.3.1) lib/paperclip/attachment.rb:409:in `post_process_style'
paperclip (3.3.1) lib/paperclip/attachment.rb:402:in `post_process_styles'
org/jruby/RubyHash.java:1186:in `each'
paperclip (3.3.1) lib/paperclip/attachment.rb:401:in `post_process_styles'
paperclip (3.3.1) lib/paperclip/attachment.rb:394:in `post_process'
activesupport (3.2.8) lib/active_support/callbacks.rb:406:in `_run__1796712306__avatar_post_process__1832820880__callbacks'
org/jruby/RubyBasicObject.java:1698:in `__send__'
org/jruby/RubyKernel.java:2097:in `send'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.8) lib/active_support/callbacks.rb:390:in `_run_avatar_post_process_callbacks'
org/jruby/RubyBasicObject.java:1704:in `__send__'
org/jruby/RubyKernel.java:2101:in `send'
activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
paperclip (3.3.1) lib/paperclip/callbacks.rb:26:in `run_paperclip_callbacks'
paperclip (3.3.1) lib/paperclip/attachment.rb:393:in `post_process'
activesupport (3.2.8) lib/active_support/callbacks.rb:406:in `_run__1796712306__post_process__1832820880__callbacks'
org/jruby/RubyBasicObject.java:1698:in `__send__'
org/jruby/RubyKernel.java:2097:in `send'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.8) lib/active_support/callbacks.rb:390:in `_run_post_process_callbacks'
org/jruby/RubyBasicObject.java:1704:in `__send__'
org/jruby/RubyKernel.java:2101:in `send'
activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
paperclip (3.3.1) lib/paperclip/callbacks.rb:26:in `run_paperclip_callbacks'
paperclip (3.3.1) lib/paperclip/attachment.rb:392:in `post_process'
paperclip (3.3.1) lib/paperclip/attachment.rb:107:in `assign'
paperclip (3.3.1) lib/paperclip.rb:196:in `avatar='
org/jruby/RubyBasicObject.java:1704:in `__send__'
org/jruby/RubyKernel.java:2101:in `send'
activerecord (3.2.8) lib/active_record/attribute_assignment.rb:85:in `assign_attributes'
org/jruby/RubyHash.java:1186:in `each'
activerecord (3.2.8) lib/active_record/attribute_assignment.rb:78:in `assign_attributes'
activerecord (3.2.8) lib/active_record/persistence.rb:215:in `update_attributes'
activerecord (3.2.8) lib/active_record/transactions.rb:295:in `with_transaction_returning_status'
activerecord (3.2.8) lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
torquebox-transactions (2.1.2) lib/torquebox/active_record_adapters.rb:37:in `transaction'
activerecord (3.2.8) lib/active_record/transactions.rb:208:in `transaction'
activerecord (3.2.8) lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
activerecord (3.2.8) lib/active_record/persistence.rb:214:in `update_attributes'
app/controllers/users_controller.rb:11:in `update'
org/jruby/RubyBasicObject.java:1698:in `__send__'
org/jruby/RubyKernel.java:2097:in `send'
actionpack (3.2.8) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.2.8) lib/abstract_controller/base.rb:167:in `process_action'
actionpack (3.2.8) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (3.2.8) lib/abstract_controller/callbacks.rb:18:in `process_action'
activesupport (3.2.8) lib/active_support/callbacks.rb:418:in `_run__841617381__process_action__1679400720__callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:225:in `_conditional_callback_around_260'
activesupport (3.2.8) lib/active_support/callbacks.rb:326:in `around'
org/jruby/RubyBasicObject.java:1704:in `__send__'
org/jruby/RubyKernel.java:2101:in `send'
activesupport (3.2.8) lib/active_support/callbacks.rb:314:in `_callback_around_23'
activesupport (3.2.8) lib/active_support/callbacks.rb:224:in `_conditional_callback_around_260'
activesupport (3.2.8) lib/active_support/callbacks.rb:417:in `_run__841617381__process_action__1679400720__callbacks'
org/jruby/RubyBasicObject.java:1698:in `__send__'
org/jruby/RubyKernel.java:2097:in `send'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.8) lib/active_support/callbacks.rb:390:in `_run_process_action_callbacks'
org/jruby/RubyBasicObject.java:1704:in `__send__'
org/jruby/RubyKernel.java:2101:in `send'
activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.8) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.2.8) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
activesupport (3.2.8) lib/active_support/notifications.rb:123:in `instrument'
activesupport (3.2.8) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.8) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.8) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
activerecord (3.2.8) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (3.2.8) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.8) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.8) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.8) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.8) lib/action_controller/metal.rb:246:in `action'
org/jruby/RubyProc.java:258:in `call'
actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:36:in `call'
journey (1.0.4) lib/journey/router.rb:68:in `call'
org/jruby/RubyArray.java:1615:in `each'
journey (1.0.4) lib/journey/router.rb:56:in `call'
actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:600:in `call'
sass (3.1.20) lib/sass/plugin/rack.rb:54:in `call'
warden (1.2.1) lib/warden/manager.rb:35:in `call'
org/jruby/RubyKernel.java:1197:in `catch'
warden (1.2.1) lib/warden/manager.rb:34:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:35:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/head.rb:14:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/flash.rb:242:in `call'
torquebox-web-2.1.2 (java) lib/torquebox/session/servlet_store.rb:31:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/cookies.rb:339:in `call'
activerecord (3.2.8) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:28:in `call'
activesupport (3.2.8) lib/active_support/callbacks.rb:408:in `_run__2062687110__call__1832820880__callbacks'
org/jruby/RubyBasicObject.java:1698:in `__send__'
org/jruby/RubyKernel.java:2097:in `send'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.8) lib/active_support/callbacks.rb:390:in `_run_call_callbacks'
org/jruby/RubyBasicObject.java:1698:in `__send__'
org/jruby/RubyKernel.java:2097:in `send'
activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.8) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.8) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.8) lib/rails/engine.rb:479:in `call'
railties (3.2.8) lib/rails/application.rb:223:in `call'
org/jruby/RubyBasicObject.java:1704:in `__send__'
org/jruby/RubyKernel.java:2101:in `send'
railties (3.2.8) lib/rails/railtie/configurable.rb:30:in `method_missing'
4

1 に答える 1

0

JRUBYは、トレッドを取らなければならないプロセスを生成できないと思います。

Cocaine::CommandLine.runner = Cocaine::CommandLine::BackticksRunner.newコカインを0.3.2にダウングレードすることと組み合わせて説明したように、これを試してください

(JRuby 1.7.1 + Webrick および Ruby on Rails でテスト済み)

于 2012-12-24T10:44:46.467 に答える