Jruby에서 커맨드라인으로 실행 되지 않는 명령어들이 있네요...

34 views
Skip to first unread message

SGcom

unread,
May 17, 2008, 8:49:30 AM5/17/08
to jruby-on-rails-for-web-and-enterprise
오늘 실습이 도저히 안될 거 같아서 윈도우로 환경을 바꿨습니다.
2일째 yellowpage 프로젝트를 작성하려고 하는데
rake, rails등의 명령어가 실행되지 않아 책에 있는 내용을 도저히 실습해 볼 수 없군요...
Jruby안 에서는 따로 실행 파일을 제공해주지 않는 것 같은데...
확인해 보셨나요?? 서평만 보고 샀는데...책에서 소스가 틀린다는 건 이해가지만
이런 완전 기본서에서 기본적인 명령어 실행 조차 안된다는 건 실망이 크네요..

낚였다는 말은 이럴 때 쓰나보네요.

SGcom

unread,
May 17, 2008, 9:24:54 AM5/17/08
to jruby-on-rails-for-web-and-enterprise
일단 커맨드라인을 실행 하려면 그냥 rake를 실행 하는 것이 아니라
jruby %JRUBY_HOME%\bin\rake로 실행 해야 합니다.
그리고 rails나 다른 루비로 된 프로그램의 경우에도 마찬가지 입니다.

JRUBY만 유독 그런 건가요?? 아니면 다른 배포판들도 다 그런 문제를 안고 있는 것인가요??

SGcom

unread,
May 17, 2008, 8:29:10 PM5/17/08
to jruby-on-rails-for-web-and-enterprise
더 좋은 방법을 찾았습니다.

@echo off
setlocal
rem
---------------------------------------------------------------------------

call "%~dp0_jrubyvars" %*

"%_STARTJAVA%" %_VM_OPTS% -cp "%CLASSPATH%" -Djruby.home="%JRUBY_HOME
%" -Djruby.lib="%JRUBY_HOME%\lib" -Djruby.shell="cmd.exe" -
Djruby.script=jruby.bat org.jruby.Main %JRUBY_OPTS% "%JRUBY_HOME%\bin\
$EXEC$" %_RUBY_OPTS%
set E=%ERRORLEVEL%

call "%~dp0_jrubycleanup"
endlocal

위의 내용 중 $EXEC$ 부분을 rake나 rails로 바꾸고 각각 rake.bat, rails.bat로 바꿉니다. 그렇게 되
면 독립적으로 실행이 가능하게 되네요.
...

문제는 db_setup시 JDBC에 무슨 문제가 있나봐요.
rake db_setup을 하면

Exception in thread "main" java.lang.NoSuchMethodError:
org.jruby.runtime.builtin.IRubyObject.setInstanceVariable(Ljava/
lang/String;Lorg/jruby/runtime/builtin/IRubyObject;)Lorg/jruby/runtime/
builtin/IRubyObject;
at
JdbcAdapterInternalService.set_connection(JdbcAdapterInternalService.java:
122)
at JdbcAdapterInternalServiceCallback
$set_connection_FS1.call(Unknown Source)
at
org.jruby.runtime.callback.FastInvocationCallback.execute(FastInvocationCallback.java:
55)
at
org.jruby.internal.runtime.methods.SimpleCallbackMethod.call(SimpleCallbackMethod.java:
67)
at
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:
66)
at org.jruby.runtime.CallSite
$InlineCachingCallSite.cacheAndCall(CallSite.java:102)
at org.jruby.runtime.CallSite
$InlineCachingCallSite.call(CallSite.java:243)
at
org.jruby.evaluator.ASTInterpreter.fCallNode(ASTInterpreter.java:1100)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:
354)
at
org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:
302)
at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:
168)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:
176)
at
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:
70)
at org.jruby.runtime.CallSite
$InlineCachingCallSite.cacheAndCall(CallSite.java:117)
at org.jruby.runtime.CallSite
$InlineCachingCallSite.call(CallSite.java:275)
at
org.jruby.evaluator.ASTInterpreter.vcallNode(ASTInterpreter.java:1748)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:
484)
at
org.jruby.evaluator.ASTInterpreter.blockNode(ASTInterpreter.java:631)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:
302)
at
org.jruby.evaluator.ASTInterpreter.rescueNode(ASTInterpreter.java:
1517)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:
452)
at org.jruby.evaluator.ASTInterpreter.eval(ASTInterpreter.java:
168)
at
org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java:
176)
at org.jruby.RubyClass.invoke(RubyClass.java:236)
(후략)

이런 에러가 떨어지고 있네요.
Jruby Interpreter에 아직도 무슨 문제가 있는 건가요??

Changshin Lee

unread,
May 19, 2008, 3:47:56 AM5/19/08
to jruby-on-rails-for...@googlegroups.com
안녕하세요?
NetBeans 6.1을 쓰시고 계시다면 rake나
rails 명령을 NetBeans에서 실행할 수 있습
니다. 프로젝트를 클릭하고 오른쪽 버튼으
로 컨텍스트 메뉴를 활성화해보세요. rake 나 rails 관련 메뉴가 나옵니다.
그리고, db_setup쪽은 그간 JRuby와 Rails
가 많이 바뀌어(책이 나온지 격변의 1년이
지났습니다), NetBeans을 쓰신다면 Rails
프로젝트를 생성할 때 나오는 Database Configuration 단계에서
Configure Using IDE Connections
를 선택한 다음 원하시는 환경
(Development, Test, Production)에 맞게
Create DB 버튼을 눌러 DB를 생성하기를 권해드립니다.
(이때 NetBeans에 MySQL Server를 등록하면 과정이 나올 수 있습니다.)
NetBeans를 십분 활용하여 쉬운 JRoR 개발 되시기를 바랍니다.
고맙습니다.

2008. 05. 18, 오전 9:29, SGcom 작성:

Reply all
Reply to author
Forward
0 new messages