[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Getting YAJB to work at all

Tom Harris

1/13/2006 9:20:00 AM


I have been trying to get YAJB to work on my system for the last three
days, without success. The platform I'm running on is Windows 2003
Server, with Ruby 1.8.3 and YAJB 0.8.1.

I have ruby installed in the default location on Windows, which is
c:\ruby

I have my JAVA_HOME set to the root of my Java folder: D:\jdk1.5.0_06

When I run "ruby setup.rb", everything seems fine.

I then go into the sample folder and run "ruby gui_simple.rb", and
nothing happens. It just sits there.

I then modified gui_simple.rb to include the following after the include
statement, so I could see what was going wrong:

JBRIDGE_OPTIONS = {
:jvm_stdout => :t,
:jvm_log_level => "debug",
:bridge_log => true
}

The output follows:

JavaBridge: Startup communication bridge...
CLASSPATH: "$CLASSPATH";c:/ruby/lib/ruby/site_ruby/1.8/yajb/yajb.jar
java -classpath
""$CLASSPATH";c:/ruby/lib/ruby/site_ruby/1.8/yajb/yajb.jar"
jbridge.BridgeBuilder jbridge.comm.
binstream.BStream_JBServer -remoteport:2390 -logLevel:debug
JVM: Start main routine.
JVM: CodeGen: ImplFlagField
JVM: CodeGen: SuperClassField
JVM: CodeGen: MethodFinderField
JVM: CodeGen: SessionManagerField
JVM: CodeGen: IdField
JVM: CodeGen: InjectMethod
JVM: CodeGen: SendMessage
JVM: CodeGen: OverrideMethod_check
JVM: CodeGen: OverrideMethod_return
JVM: CodeGen: SuperCaller
JVM: CodeGen: SuperConstructor
JVM: CG: OriginalMethod
JVM: OK.
JVM: Initialized.
start up BinStream connection on 2390
BinServer: waiting for client's connection...

It just sits there forever. No gui, nothing.

Finally, I hit CTRL-C, and get the following:

EXIT JavaBridge...
----GC: begin cancelling finalizer: 0
nil
c:/ruby/lib/ruby/site_ruby/1.8/yajb/jbridge.rb:451:in `__startup_JVM':
undefined method `message' for nil:NilCla
ss (NoMethodError)
from c:/ruby/lib/ruby/site_ruby/1.8/yajb/jbridge.rb:440
c:/ruby/lib/ruby/site_ruby/1.8/yajb/jbridge.rb:451:in `__startup_JVM':
undefined method `message' for nil:NilCla
ss (NoMethodError)
from c:/ruby/lib/ruby/site_ruby/1.8/yajb/jbridge.rb:440

Originally, I had been thinking my application was wrong somehow, as I
had barrelled ahead without trying the samples. But, after trying to
figure this out, I finally decided to see if the samples worked, which
as you can above, did not. So, what is going wrong here? This being the
only usable Java bridge that needs no special compilation for the
platform, I thought this would also be the only one I could use on
Windows being within Cygwin. I really need to avoid that.

My main application is Java based, but after playing with Rails I
decided that the configuration GUI had to be in Ruby. So, YAJB will be
used just to notify the main application that configuration changes have
occurred. Tha java class is very simple, and if I could just get YAJB
working, I'd be done.

Can someone please tell me what might be wrong and what I can do to fix
it?

Tom Harris
Cisco Systems, Inc.

--
Posted via http://www.ruby-....


10 Answers

SAKURAI Masashi

1/13/2006 10:38:00 AM

0

Hi,

> start up BinStream connection on 2390
> BinServer: waiting for client's connection...
>
> It just sits there forever. No gui, nothing.

The situation is that the ruby side of the yajb is waiting for the
connection from the java side.

The windows firewall may block the connection. Will you check the
event-viewer and firewall setting?


--
SAKURAI, Masashi (family, given)
m.sakurai@dream.com


SAKURAI Masashi

1/13/2006 10:39:00 AM

0

Hi,

> start up BinStream connection on 2390
> BinServer: waiting for client's connection...
>
> It just sits there forever. No gui, nothing.

The situation is that the ruby side of the yajb is waiting for the
connection from the java side.

The windows firewall may block the connection. Will you check the
event-viewer and firewall setting?


--
SAKURAI, Masashi (family, given)
m.sakurai@dream.com


Tom Harris

1/13/2006 11:11:00 AM

0

SAKURAI Masashi wrote:
> Hi,
>
>> start up BinStream connection on 2390
>> BinServer: waiting for client's connection...
>>
>> It just sits there forever. No gui, nothing.
>
> The situation is that the ruby side of the yajb is waiting for the
> connection from the java side.
>
> The windows firewall may block the connection. Will you check the
> event-viewer and firewall setting?

I do not use windows firewall, and the Windows event viewer shows
nothing of consequence. Any other ideas?

Tom

--
Posted via http://www.ruby-....


Tom Harris

1/13/2006 12:18:00 PM

0

Tom Harris wrote:
> SAKURAI Masashi wrote:
>> Hi,
>>
>>> start up BinStream connection on 2390
>>> BinServer: waiting for client's connection...
>>>
>>> It just sits there forever. No gui, nothing.
>>
>> The situation is that the ruby side of the yajb is waiting for the
>> connection from the java side.
>>
>> The windows firewall may block the connection. Will you check the
>> event-viewer and firewall setting?
>
> I do not use windows firewall, and the Windows event viewer shows
> nothing of consequence. Any other ideas?
>
> Tom

I also just tried to use a completely different JVM, as I thought
perhaps Java 1.5 was causing the problem. I switched my path and my
JAVA_HOME to point to a 1.4.2 version of java, and tried again. Same
result.

I just made a second double-check to see if windows firewall was
running, and the Firewall depends on connection sharing/ICS service,
which is disabled here. I have a hardware firewall between my computers
and my cable modem, to avoid the bulk of evil. I would never run a
firewall on one of my computers.

Any other ideas?

Tom

--
Posted via http://www.ruby-....


SAKURAI Masashi

1/13/2006 1:22:00 PM

0

Tom Harris wrote:
>
> Tom Harris wrote:
> > SAKURAI Masashi wrote:
> >> Hi,
> >>
> >>> start up BinStream connection on 2390
> >>> BinServer: waiting for client's connection...
> >>>
> >>> It just sits there forever. No gui, nothing.
> >>
> >> The situation is that the ruby side of the yajb is waiting for the
> >> connection from the java side.
> >>
> >> The windows firewall may block the connection. Will you check the
> >> event-viewer and firewall setting?
> >
> > I do not use windows firewall, and the Windows event viewer shows
> > nothing of consequence. Any other ideas?

Will you try following options and check the log file output by java,
"jlog.txt".

JBRIDGE_OPTIONS = {
:jvm_stdout => :t,
:jvm_log_file => "jlog.txt",
:jvm_log_level => "debug",
:bridge_log => true
}

If the log file is too large, please send me the file.
After checking the problem, I will report here.


Tom Harris

1/13/2006 7:25:00 PM

0

SAKURAI Masashi wrote:
> Tom Harris wrote:
>> >> The situation is that the ruby side of the yajb is waiting for the
>> >> connection from the java side.
>> >>
>> >> The windows firewall may block the connection. Will you check the
>> >> event-viewer and firewall setting?
>> >
>> > I do not use windows firewall, and the Windows event viewer shows
>> > nothing of consequence. Any other ideas?
>
> Will you try following options and check the log file output by java,
> "jlog.txt".
>
> JBRIDGE_OPTIONS = {
> :jvm_stdout => :t,
> :jvm_log_file => "jlog.txt",
> :jvm_log_level => "debug",
> :bridge_log => true
> }
>
> If the log file is too large, please send me the file.
> After checking the problem, I will report here.

Here is the contents of the jlog.txt file:

Start main routine.
CodeGen: ImplFlagField
CodeGen: SuperClassField
CodeGen: MethodFinderField
CodeGen: SessionManagerField
CodeGen: IdField
CodeGen: InjectMethod
CodeGen: SendMessage
CodeGen: OverrideMethod_check
CodeGen: OverrideMethod_return
CodeGen: SuperCaller
CodeGen: SuperConstructor
CG: OriginalMethod
BinServer: waiting for client's connection...

Process is still hung without any results. The console window shows:

JavaBridge: Startup communication bridge...
CLASSPATH: "$CLASSPATH";c:/ruby/lib/ruby/site_ruby/1.8/yajb/yajb.jar
java -classpath
""$CLASSPATH";c:/ruby/lib/ruby/site_ruby/1.8/yajb/yajb.jar"
jbridge.BridgeBuilder jbridge.comm.
binstream.BStream_JBServer -remoteport:1105 -logLevel:debug
-logfile:jlog.txt
JVM: OK.
JVM: Initialized.
start up BinStream connection on 1105

Ctrl-C was then pressed.

EXIT JavaBridge...
----GC: begin cancelling finalizer: 0
nil
c:/ruby/lib/ruby/site_ruby/1.8/yajb/jbridge.rb:451:in `__startup_JVM':
undefined method `message' for nil:NilCla
ss (NoMethodError)
from c:/ruby/lib/ruby/site_ruby/1.8/yajb/jbridge.rb:440
c:/ruby/lib/ruby/site_ruby/1.8/yajb/jbridge.rb:451:in `__startup_JVM':
undefined method `message' for nil:NilCla
ss (NoMethodError)
from c:/ruby/lib/ruby/site_ruby/1.8/yajb/jbridge.rb:440

Tom

--
Posted via http://www.ruby-....


SAKURAI Masashi

1/14/2006 10:05:00 PM

0

Tom Harris wrote:
> :
> SAKURAI Masashi wrote:
> > Will you try following options and check the log file output by java,
> > "jlog.txt".
> > :
>
> Here is the contents of the jlog.txt file:
> :
> BinServer: waiting for client's connection...
>
> Process is still hung without any results. The console window shows:

Because the java side didn't throw any exception during stalling, I
think that either java or ruby has a trouble of networking.

Will you try the following tests?

1) Connecting the bridge port of the java side

When the yajb is stalling, please connect to the bridge port and
report the result of telnet and yajb logs.

$ telnet localhost (bridge port number)

The bridge port number is shown in the yajb log. For example, the
number is 1105 in your last report. The port number may be changed
each time you run yajb.

If the connection is established, the java side is not wrong. Then,
try the next test.

2) Ruby network test

Please run the networking test in the "test" directory in the yajb
distribution. Following lines are the result on my computer, Windows
XP Pro SP2.

| $ ruby bstream_cstest.rb
| Loaded suite bstream_cstest
| Started
| . 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1...
| Finished in 12.494 seconds.
|
| 4 tests, 1575 assertions, 0 failures, 0 errors

My environmnent information is here.

| $ ruby -v
| ruby 1.8.3 (2005-09-21) [i386-cygwin]
| $ uname -a
| CYGWIN_NT-5.1 x31 1.5.18(0.132/4/2) 2005-07-02 20:30 i686 unknown unknown Cygwin


Tom Harris

1/15/2006 12:55:00 AM

0

SAKURAI Masashi wrote:
> 1) Connecting the bridge port of the java side

jlog.txt after telnet:

Start main routine.
CodeGen: ImplFlagField
CodeGen: SuperClassField
CodeGen: MethodFinderField
CodeGen: SessionManagerField
CodeGen: IdField
CodeGen: InjectMethod
CodeGen: SendMessage
CodeGen: OverrideMethod_check
CodeGen: OverrideMethod_return
CodeGen: SuperCaller
CodeGen: SuperConstructor
CG: OriginalMethod
BinServer: waiting for client's connection...
MS:ready for I/O stream.
BinServer: connection established.
MS:started working block.
Unrecoverable error occued. [jbridge.comm.binstream.BinStreamException :
Decoder: wrong header:13]
jbridge.comm.binstream.BinStreamException: Decoder: wrong header:13
at jbridge.comm.binstream.BinDecoder.read(BinDecoder.java:49)
at jbridge.comm.binstream.BinDecoder.read(BinDecoder.java:14)
at
jbridge.comm.binstream.MessageServer.receivingLoop(MessageServer.java:343)
at
jbridge.comm.binstream.MessageServer.access$400(MessageServer.java:25)
at jbridge.comm.binstream.MessageServer$2.run(MessageServer.java:308)
at java.lang.Thread.run(Thread.java:595)

jbridge.comm.binstream.BinStreamException: Decoder: wrong header:13
at jbridge.comm.binstream.BinDecoder.read(BinDecoder.java:49)
at jbridge.comm.binstream.BinDecoder.read(BinDecoder.java:14)
at
jbridge.comm.binstream.MessageServer.receivingLoop(MessageServer.java:343)
at
jbridge.comm.binstream.MessageServer.access$400(MessageServer.java:25)
at jbridge.comm.binstream.MessageServer$2.run(MessageServer.java:308)
at java.lang.Thread.run(Thread.java:595)

MS: [rcvloop] try to reset the connection.
MS: Receive-thread finished.
MS: sender-thread terminating...
MS: Sender-thread finished.
MS:closing socket.
MS:finished working block.
BinServer: disconnected.
BinServer: waiting for client's connection...

> 2) Ruby network test

C:\yajb-0.8.1\test>ruby bstream_cstest.rb
Loaded suite bstream_cstest
Started
32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9
8 7 6 5 4 3 2 1...
Finished in 6.547 seconds.

4 tests, 1593 assertions, 0 failures, 0 errors

> My environmnent information is here.

c:\>ruby -v
ruby 1.8.2 (2004-12-25) [i386-mswin32]
c:\>ver
Microsoft Windows [Version 5.2.3790]

Tom

--
Posted via http://www.ruby-....


SAKURAI Masashi

1/15/2006 5:12:00 PM

0

Tom Harris wrote:
>
> SAKURAI Masashi wrote:
> > 1) Connecting the bridge port of the java side
> :
> BinServer: connection established.
> :
> > 2) Ruby network test
> :
> 4 tests, 1593 assertions, 0 failures, 0 errors

Your reports showed that the tests of both java and ruby were working.
So I think the networking is not wrong.

> > My environment information is here.
>
> c:\>ruby -v
> ruby 1.8.2 (2004-12-25) [i386-mswin32]

OK. I could reproduce your situation, installing the ruby
[i386-mswin32] by the RubyInstaller, ruby182-15.exe. The ruby may have
the trouble around I/O and thread event.

I could run the yajb, setting {:jvm_stdout => :never} in
JBRIDGE_OPTIONS. Please try the option on your Windows.

But you can not get the stdout from the java with the yajb option. If
you want to get the stdout, the cygwin ruby [i386-cygwin] is
alternate.


Tom Harris

1/15/2006 9:52:00 PM

0

SAKURAI Masashi wrote:
> I could run the yajb, setting {:jvm_stdout => :never} in
> JBRIDGE_OPTIONS. Please try the option on your Windows.

That did it! The :t for :jvm_output caused this.

I cannot expect or require that all users of my open-source project will
have cygwin when on Windows, and since the majority of my project is in
Java, I'd like it to be platform agnostic as possible. That's why I
initially wanted to use your bridge library, as it was the only one that
seemed not to rely on native compilation.

I wound up getting RJB working on my system, though it is in fact
reliant on platform-specific native code to work. I think I'll be going
back to YAJB now, though, because, as I said before, I want this
software to work on all platforms as is, without a lot of hand-holding
or forced choices on my part.

Thanks! If there is any way to fix the library so that jvm_output works
on mswin32, I think it'd be worth it. It'll certainly make debugging
easier.

Tom

--
Posted via http://www.ruby-....