Harish Krishnaswamy | 3 Aug 2004 08:47
Picon

Anonymous class in global context

Hi,

I am unable to run the following script from an embedded interpreter.

attr = new test.SampleAttribute("arg1", "arg2")
{
    run()
    {
        print("running");
    }
};

attr.run();

I get the following exception:

Sourced file: eval stream : Typed variable declaration : Error 
constructing inner class instance: bsh.ReflectError: Can't find 
constructor: global$1( java.lang.String, java.lang.String ) in class: 
global$1 : at Line: 5 : in file: eval stream : new SampleAttribute ( 
"arg1" , "arg2" ) {

    at bsh.BSHAllocationExpression.constructWithClassBody(Unknown Source)
    at bsh.BSHAllocationExpression.objectAllocation(Unknown Source)
    at bsh.BSHAllocationExpression.eval(Unknown Source)
    at bsh.BSHPrimaryExpression.eval(Unknown Source)
    at bsh.BSHPrimaryExpression.eval(Unknown Source)
    at bsh.BSHVariableDeclarator.eval(Unknown Source)
    at bsh.BSHTypedVariableDeclaration.eval(Unknown Source)
    at bsh.Interpreter.eval(Unknown Source)
(Continue reading)

Patrick Niemeyer | 17 Aug 2004 09:16

Fix for class redefinition problem...

I've added the code necessary to get the class generation to use the 
BshClassLoader, which allows us to reload the classes when they are 
redefined.  (Previously they were injected directly into the app 
classloader as a hack, which meant that scripts couldn't be run twice 
in the same VM, etc.)

This means that now when a script generates a class we introduce a 
classloader... which should come as no surprise, but is something we 
generally avoid in BeanShell unless required.  I've done basic testing 
and it seems to work.  However I am not sure if this plays well with 
the context classloader or what it might do in other classloading 
environments yet.  The changes are very small, taking advantage of the 
class reloading infrastructure that was already there.  Feedback would 
be appreciated.

CVS is down at the moment, so I've put up a snapshot at:

   http://beanshell.org/bsh-2.0b2-src.jar

Also, I'd just like to remind everybody that all of this only affects 
you if you are actually defining classes or interfaces using the 
standard Java class / interface syntax, which is a new feature in 2.0.  
If you are just scripting interfaces as was possible before, no class 
generation is done and no classloaders are introduced.

thanks,
Pat

-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
(Continue reading)

rocketraman | 18 Aug 2004 20:41
Picon
Favicon

Deadlocks in JConsole when pasting

Hello,

A deadlock occurs in the JConsole when pasting and then attempting to
execute scripts that exceed some relatively small length.  A thread
stack dump immediately shows the problem:

"AWT-EventQueue-0" prio=7 tid=0x00772250 nid=0x192 in Object.wait()
[18ecf000..18ecfd90]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x105eab30> (a java.io.PipedInputStream)
        at java.io.PipedInputStream.receive(PipedInputStream.java:149)
        - locked <0x105eab30> (a java.io.PipedInputStream)
        at java.io.PipedInputStream.receive(PipedInputStream.java:176)
        - locked <0x105eab30> (a java.io.PipedInputStream)
        at java.io.PipedOutputStream.write(PipedOutputStream.java:129)
        at java.io.OutputStream.write(OutputStream.java:58)
        at bsh.util.JConsole.acceptLine(Unknown Source)
        at bsh.util.JConsole.enter(Unknown Source)
        at bsh.util.JConsole.type(Unknown Source)
        - locked <0x105e75e8> (a bsh.util.JConsole)
        at bsh.util.JConsole.keyPressed(Unknown Source)
        at java.awt.Component.processKeyEvent(Component.java:5058)
        at javax.swing.JComponent.processKeyEvent(JComponent.java:2388)
        at java.awt.Component.processEvent(Component.java:4909)
        at java.awt.Container.processEvent(Container.java:1569)
        at java.awt.Component.dispatchEventImpl(Component.java:3615)
        at java.awt.Container.dispatchEventImpl(Container.java:1627)
        at java.awt.Component.dispatchEvent(Component.java:3477)
        at
        java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1713)
(Continue reading)

Anthony Sciola | 21 Aug 2004 00:14

bsh 2.0b2 bug?

I compiled the 2.0b2 provided and tried to switch jboss 3.2.3 to use it.
Unfortunately, I'm getting an error on startup now:

java.lang.NoSuchMethodError:
bsh.classpath.ClassManagerImpl.loadSourceClass(Ljava/lang/String;)Ljava/lang/Class;
        at bsh.classpath.ClassManagerImpl.classForName(Unknown Source)

I searched and grepped and found:

1. classForName is not defined in ClassManagerImpl.

2. It *is* defined in BshClassManager with an interesting comment of
"// Move me to classpath/ClassManagerImpl???" preceding it.

I added it naively to ClassManagerImpl where it now gives 2 errors, one
pretty easy to fix, the other not:

    [javac]bsh/classpath/ClassManagerImpl.java:206: declaringInterpreter
has private access in bsh.BshClassManager
    [javac]                         declaringInterpreter.eval( new
InputStreamReader(in) );
    [javac]                         ^
    [javac]bsh/classpath/ClassManagerImpl.java:207: cannot resolve
symbol
    [javac] symbol  : class EvalError
    [javac] location: class bsh.classpath.ClassManagerImpl
    [javac]                 } catch ( EvalError e ) {

I'm figure I can fix the EvalError one with a simple import but I'm not
certain what the proper thing to do about the declaringInterpreter is.
(Continue reading)

Patrick Niemeyer | 23 Aug 2004 23:10

bsh-2.0b2 available...

Since there have been no reports of problems I have put up bsh-2.0b2.  
This minor update addresses the class redefinition problem.  BeanShell 
now uses the bsh classloader when creating classes or interfaces, 
allowing it to reload them as necessary.

Please send feedback if you have issues.

Thanks,
Pat

-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
Robert | 25 Aug 2004 06:09

Re: bsh-2.0b2 available...

"Patrick Niemeyer" <pat@...> wrote in message
news:EB59BCE4-F548-11D8-AFDE-000A95A07AD6@...
> Since there have been no reports of problems I have put up bsh-2.0b2.
> This minor update addresses the class redefinition problem.  BeanShell
> now uses the bsh classloader when creating classes or interfaces,
> allowing it to reload them as necessary.
>
> Please send feedback if you have issues.
>
>
> Thanks,
> Pat
>
This may be only me. I cannot launch bsh.Interpreter only bsh.Console.

java -jar bsh-2.0b2.jar bsh.Console
java -jar bsh-2.0b2.jar bsh.Interpreter

Both get me the BeanShell desktop.

Robert

-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
Ingo Prötel | 25 Aug 2004 09:05
Favicon

Re: Re: bsh-2.0b2 available...


Robert wrote:
> "Patrick Niemeyer" <pat@...> wrote in message
> news:EB59BCE4-F548-11D8-AFDE-000A95A07AD6@...
> 
>>Since there have been no reports of problems I have put up bsh-2.0b2.
>>This minor update addresses the class redefinition problem.  BeanShell
>>now uses the bsh classloader when creating classes or interfaces,
>>allowing it to reload them as necessary.
>>
>>Please send feedback if you have issues.
>>
>>
>>Thanks,
>>Pat
>>
> 
> This may be only me. I cannot launch bsh.Interpreter only bsh.Console.
> 
> java -jar bsh-2.0b2.jar bsh.Console
> java -jar bsh-2.0b2.jar bsh.Interpreter
> 
> Both get me the BeanShell desktop.
> 
> Robert
> 
That's because you use the -jar instead of -cp.
The -jar option always uses the main class from the Manifest file.

ingo
(Continue reading)

Richard Emberson | 30 Aug 2004 22:28

bsh-2.0b2: long setter ERROR

public class BAD_CODE {
     private long myLong;
     public BAD_CODE() {
     }
     public void setMyLong(long l) {
         this.myLong = l;
     }
/*
     // this works
     public void setMyLong(int l) {
         this.myLong = (long) l;
     }
*/
}

-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
Michael Pitoniak | 31 Aug 2004 16:29
Favicon

Re: bsh-2.0b2 available...


Folks,

 Don't have much info on this error other than to say it came after the upgrade to the latest build. While i investigate i thought it would be wise to post it.
Pat...some of the guys who use my beanshell tool pass namespaces around. Does this error look like the new Class supoort could have affected that?
I will post more data once i get it.

Thanks,

mp



Resetting redirectStd
    Output Executing: /TestHarness/scripts/BeanShell/expect/srl_backup.exp  /usr/bin fw-win2003.we.symc p
    Start ClassPath Mapping
    End ClassPath Mapping
    Executing: /TestHarness/scripts/BeanShell/expect/change_log_linux.exp fw-win2003.we.symc /usr/bin p
    java.lang.ClassFormatError: global/BlockNameSpace$4 (Illegal Field name "_bshStaticglobal/BlockNameSpace$4")
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at bsh.classpath.DiscreteFilesClassLoader.findClass(Unknown Source)
        at bsh.classpath.BshClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at bsh.classpath.ClassManagerImpl.classForName(Unknown Source)
        at bsh.classpath.ClassManagerImpl.defineClass(Unknown Source)
        at bsh.ClassGeneratorImpl.generateClassImpl(Unknown Source)
        at bsh.ClassGeneratorImpl.generateClass(Unknown Source)
        at bsh.BSHAllocationExpression.constructWithClassBody(Unknown Source)
        at bsh.BSHAllocationExpression.objectAllocation(Unknown Source)
        at bsh.BSHAllocationExpression.eval(Unknown Source)
        at bsh.BSHPrimaryExpression.eval(Unknown Source)
        at bsh.BSHPrimaryExpression.eval(Unknown Source)
        at bsh.BSHAssignment.eval(Unknown Source)
        at bsh.BSHBlock.evalBlock(Unknown Source)
        at bsh.BSHBlock.eval(Unknown Source)
        at bsh.BSHBlock.eval(Unknown Source)
        at bsh.BSHTryStatement.eval(Unknown Source)
        at bsh.Interpreter.eval(Unknown Source)
        at bsh.Interpreter.source(Unknown Source)
        at bsh.Interpreter.source(Unknown Source)
        at harness.parsers.beanShell.BeanShellScriptParser.execScript(BeanShellScriptParser.java:347)
        at harness.parsers.beanShell.BeanShellScriptParser.scriptStateMachine(BeanShellScriptParser.java:144)
        at harness.parsers.beanShell.BeanShellScriptParser.run(BeanShellScriptParser.java:111)
Resetting redirectStd
    Output Executing: /TestHarness/scripts/BeanShell/expect/srl_backup.exp  /usr/bin fw-win2003.we.symc p
    Start ClassPath Mapping
    End ClassPath Mapping
    Executing: /TestHarness/scripts/BeanShell/expect/change_log_linux.exp fw-win2003.we.symc /usr/bin p
    java.lang.ClassFormatError: global/BlockNameSpace$4 (Illegal Field name "_bshStaticglobal/BlockNameSpace$4")
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at bsh.classpath.DiscreteFilesClassLoader.findClass(Unknown Source)
        at bsh.classpath.BshClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at bsh.classpath.ClassManagerImpl.classForName(Unknown Source)
        at bsh.classpath.ClassManagerImpl.defineClass(Unknown Source)
        at bsh.ClassGeneratorImpl.generateClassImpl(Unknown Source)
        at bsh.ClassGeneratorImpl.generateClass(Unknown Source)
        at bsh.BSHAllocationExpression.constructWithClassBody(Unknown Source)
        at bsh.BSHAllocationExpression.objectAllocation(Unknown Source)
        at bsh.BSHAllocationExpression.eval(Unknown Source)
        at bsh.BSHPrimaryExpression.eval(Unknown Source)
        at bsh.BSHPrimaryExpression.eval(Unknown Source)
        at bsh.BSHAssignment.eval(Unknown Source)
        at bsh.BSHBlock.evalBlock(Unknown Source)
        at bsh.BSHBlock.eval(Unknown Source)
        at bsh.BSHBlock.eval(Unknown Source)
        at bsh.BSHTryStatement.eval(Unknown Source)
        at bsh.Interpreter.eval(Unknown Source)
        at bsh.Interpreter.source(Unknown Source)
        at bsh.Interpreter.source(Unknown Source)
        at harness.parsers.beanShell.BeanShellScriptParser.execScript(BeanShellScriptParser.java:347)
        at harness.parsers.beanShell.BeanShellScriptParser.scriptStateMachine(BeanShellScriptParser.java:144)
        at harness.parsers.beanShell.BeanShellScriptParser.run(BeanShellScriptParser.java:111)



Patrick Niemeyer <pat-vVsuRaBxxhs@public.gmane.org>
Sent by: beanshell-users-admin-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org

08/23/2004 05:10 PM

To
beanshell-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
cc
beanshell-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Subject
[Beanshell-users] bsh-2.0b2 available...





Since there have been no reports of problems I have put up bsh-2.0b2.  
This minor update addresses the class redefinition problem.  BeanShell
now uses the bsh classloader when creating classes or interfaces,
allowing it to reload them as necessary.

Please send feedback if you have issues.


Thanks,
Pat



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Beanshell-users mailing list
Beanshell-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/beanshell-users


Gmane