I sent this out yesterday and got no response.  I have also tried using
BeanShell and am having similar problems.  I'm guessing very few people use
the <script> tag as it seems awfully flakey.  Anyone have suggestions on
where to get some help with Script tag issues?

 

Thanks

phil

 

  _____  

From: Philip Swenson 
Sent: Wednesday, April 04, 2007 10:03 AM
To: 'user@ant.apache.org'
Subject: ant script task prob / jruby

 

I'm using ant's script task with jruby like this:

 

    <target name="mws.init" depends="init" description="builds portlets,
starts mws, waits for portlets to install, leaves mws running">

        <script language="ruby">

            <classpath refid="project.classpath"/>

               require 'opt_ruby/portlet_util.rb'

               mws_install_portlets(360000)

        </script>

    </target>

 

When I run this I get a statck dump "mws.init:

   [script] 1532 [main] ERROR org.apache.bsf.BSFManager - Exception :

   [script] java.security.PrivilegedActionException:
org.apache.bsf.BSFException: Exception"

...

 

   [script] Caused by: org.apache.bsf.BSFException: Exception

   [script]     at
org.jruby.javasupport.bsf.JRubyEngine.exec(JRubyEngine.java:114)

   [script]     at org.apache.bsf.BSFManager$6.run(BSFManager.java:493)

   [script]     ... 20 more

 

(full dump at end of message)

 

This is a classpath issue.  I hacked the ant.bat to pull in the full
classpath (same as the one in my classpath element in the script above) and
the code works.  It seems that the <classpath> element is not working for me
for some reason.  Note I'm on ant 1.7, JRuby 0.9.8 and bsf 2.4.0.  Note I
can't just use the ant.bat hack to solve my problem as I'm running this task
in a continuous integration environment (TeamCity) that doesn't use ant.bat,
it relies on the tasks to manage their own classpath.

 

So my questions are 1) how do I set up my classpath for my script target?
Am I doing something wrong?  Is this a bug in the ant script task or bsf or
jruby?  2) how do I get the real error?  Any time I have a ruby issue I get
the "java.security.PrivilegedActionException: org.apache.bsf.BSFException:
Exception" message instead of a readable error.  

 

Thanks for any help!

 

phil

 

 

 

Full dump

mws.init:

   [script] 1532 [main] ERROR org.apache.bsf.BSFManager - Exception :

   [script] java.security.PrivilegedActionException:
org.apache.bsf.BSFException: Exception

   [script]     at java.security.AccessController.doPrivileged(Native
Method)

   [script]     at org.apache.bsf.BSFManager.exec(BSFManager.java:491)

   [script]     at
org.apache.tools.ant.util.optional.ScriptRunner.executeScript(ScriptRunner.j
ava:1

03)

   [script]     at
org.apache.tools.ant.taskdefs.optional.Script.execute(Script.java:52)

   [script]     at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)

   [script]     at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown
Source)

   [script]     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java

:25)

   [script]     at java.lang.reflect.Method.invoke(Method.java:585)

   [script]     at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)

   [script]     at org.apache.tools.ant.Task.perform(Task.java:348)

   [script]     at org.apache.tools.ant.Target.execute(Target.java:357)

   [script]     at org.apache.tools.ant.Target.performTasks(Target.java:385)

   [script]     at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)

   [script]     at
org.apache.tools.ant.Project.executeTarget(Project.java:1298)

   [script]     at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.j
ava:4

1)

   [script]     at
org.apache.tools.ant.Project.executeTargets(Project.java:1181)

   [script]     at org.apache.tools.ant.Main.runBuild(Main.java:698)

   [script]     at org.apache.tools.ant.Main.startAnt(Main.java:199)

   [script]     at
org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)

   [script]     at
org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)

   [script] Caused by: org.apache.bsf.BSFException: Exception

   [script]     at
org.jruby.javasupport.bsf.JRubyEngine.exec(JRubyEngine.java:114)

   [script]     at org.apache.bsf.BSFManager$6.run(BSFManager.java:493)

   [script]     ... 20 more

Reply via email to