Error: not found in namespace

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Error: not found in namespace

Peter Fischer
Hello,

I try to use beanshell in the following way:

- two osgi(equinox) bundles
- bundle1: some self written classes using beanshell for script-
  executing
- bundle2: container with the beanshell-jar and the bsf-jar exporting
  all packages

- my.bundle1.package1.Clazz1 of bundle1 uses the following code for
  executing a beanshell script, which is loaded as a String:

String script = ....; BSFManager mgr = new BSFManager();
mgr.exec("beanshell", script, -1, -1, script);


- in the beanshell-script I have some lines like that:

import my.bundle1.package2.Clazz2; [...] my.bundle1.package2.Clazz2
class2Instance = new my.bundle1.package2.Clazz2();


- executing this script I recive the following error:

org.apache.bsf.BSFException: BeanShell script error: [...] : Typed
variable declaration : Class: my.bundle1.package2.Clazz2 not found
in namespace


Some further informations:
- Clazz2 is declared public
- Clazz1 and Clazz2 are in different packages of the same bundle.
- I want to have the typed variable declaration, because the script-
  writers should orient on pure Java syntax

I read some things about this error, but I don't know, what I'm doing
wrong. How can I resolve this error?

Thank you in advance!

regards,
Peter

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: Error: not found in namespace

Wade Chandler-6
We have run into similar things in NetBeans RCP on the
NB lists with different packages and cyclic
dependencies. It seems the way for the BeanShell
interpreter to be able to see your classes in bundle1
then bundle2 would need to depend on bundle1. I don't
know if OSGi supports cyclic dependencies where
bundle1 can depend on bundle2 and bundle2 can depend
on bundle1, but this type of relation doesn't work in
NB RCP and we have to put the BeanShell JARs in a core
directory where they can be shared and see all classes
in all modules. This works well for a controlled
environment, but not so well for an environment where
you would expect to be able to have multiple beanshell
versions or at least the possibility, and I'm not sure
if OSGI has this same type concept of a shared
directory where all libraries in it are shared between
all modules and can see all classes or if there is
another cyclic dependency capability.

Wade

--- [hidden email] wrote:

> Hello,
>
> I try to use beanshell in the following way:
>
> - two osgi(equinox) bundles
> - bundle1: some self written classes using beanshell
> for script-
>   executing
> - bundle2: container with the beanshell-jar and the
> bsf-jar exporting
>   all packages
>
> - my.bundle1.package1.Clazz1 of bundle1 uses the
> following code for
>   executing a beanshell script, which is loaded as a
> String:
>
> String script = ....; BSFManager mgr = new
> BSFManager();
> mgr.exec("beanshell", script, -1, -1, script);
>
>
> - in the beanshell-script I have some lines like
> that:
>
> import my.bundle1.package2.Clazz2; [...]
> my.bundle1.package2.Clazz2
> class2Instance = new my.bundle1.package2.Clazz2();
>
>
> - executing this script I recive the following
> error:
>
> org.apache.bsf.BSFException: BeanShell script error:
> [...] : Typed
> variable declaration : Class:
> my.bundle1.package2.Clazz2 not found
> in namespace
>
>
> Some further informations:
> - Clazz2 is declared public
> - Clazz1 and Clazz2 are in different packages of the
> same bundle.
> - I want to have the typed variable declaration,
> because the script-
>   writers should orient on pure Java syntax
>
> I read some things about this error, but I don't
> know, what I'm doing
> wrong. How can I resolve this error?
>
> Thank you in advance!
>
> regards,
> Peter
>
>
-------------------------------------------------------------------------

> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2
> express and take
> control of your XML. No limits. Just data. Click to
> get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Beanshell-users mailing list
> [hidden email]
>
https://lists.sourceforge.net/lists/listinfo/beanshell-users
>


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users