Re: New Problem With IO.popen?

Michael Campbell
Sat, 16 Apr 2005 11:19:01 -0000

> Code for above failure from the controller:  displayXml >
IO.popen("/usr/lib/java/jre/bin/java -version", "w+")

When running this from the command line for ruby, that works fine for
me.  Does it you?
>
> Which is a bit strange.  Also what I really want to do is use Java to run
> Saxon to apply an XSLT stylesheet to a document that needs some
> transforming...this behaves really oddly (at least to me) in that it misses
> my classpath option on the command line but does seem to find the call to
> the stylesheet but since the classpath is "missing" the thing
breaks.  And
> this is the error I see:
>
> [Fri Apr 15 19:38:03 2005] [error] [client 10.10.1.48] The java class is
not
> found:  com/icl/saxon/StyleSheet, referer:
http://10.10.99.101/filing/search
>
> The failing code for the above:  displayXml >
IO.popen("/usr/lib/java/jre/bin/java \-classpath /usr/local/saxon/saxon.jar
> com.icl.saxon.StyleSheet /usr/local/rails/edgar/data/#{@xmlDoc}
> /usr/local/rails/edgar/data/xmlToHtml.xsl", "w+")

2 things to check:
 * Why the "\" preceding your classpath parameter?
 * Silly, but is com/icl/saxon/StyleSheet.class in fact, IN the
/usr/local/saxon/saxon.jar?  (And is the jar (and its directory tree)
readable by whatever process rails is running under?)


>
> (BTW - is there a way to do XSLT transforms in rails and/or ruby so I can
> stop the java gymnastics I''m currently trying to do?)
>
> Thanks again for the help!
>
> John
>
>
> ----- Original Message -----
> From: "Ben Schumacher"
<benschumacher-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> To: <rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org>
> Sent: Friday, April 15, 2005 12:44 AM
> Subject: Re: [Rails] New Problem With IO.popen?
>
> John-
>
> This looks to be like a pathing problem and not a Rails problem. You
> might want to go ahead and try on this machine doing something like
> ''which java'' and then explicitly specifying the path in
the IO.popen.
>
> $ which java
> /usr/local/bin/java
>
> In code:
>
> IO.popen("/usr/local/bin/java -version", "w+")
>
> Just a thought.
>
> Cheers,
>
> bs.
>
> On 4/14/05, John Marsan
<jmarsan-JxUet7QE5mQXhy9q4Lf3Ug@public.gmane.org> wrote:
> >
> > I have a small rails app that was working fine on one system and have
> > moved
> > it to a new system with all the latest code.  In my controller
I''m calling
> > IO.popen to call some java code but this isn''t working
anymore.
> >
> > For example here I''m doing in the controller:
> >
> >                 displayXml = IO.popen("java -version",
"w+")
> >
> > And then I get an error in appache that has me stumped at this point:
> >
> > [Thu Apr 14 23:03:30 2005] [error] [client 10.10.1.48]
> > /usr/local/lib/ruby/site_ruby/1.8/rubyge
> > ms/custom_require.rb:18: command not found: java -version, referer:
> > http://10.10.99.101/filing/
> > search.
> >
> > Code like this was working with (I think) gem version 0.8.3.  New
system
> > ha
> > 0.8.8.
> >
> > Thanks for any help you can provide!
> > _______________________________________________
> > Rails mailing list
> > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> > http://lists.rubyonrails.org/mailman/listinfo/rails
> >
> >
> >
> _______________________________________________
> Rails mailing list
> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.9.11 - Release Date: 4/14/2005