Re: error: Can't find constructor
MJB1024 <[email protected]> Sun, 29 Jun 2008 17:30:36 -0700 (PDT)
| Newsgroups | gmane.comp.java.beanshell.user |
|---|---|
| Message-ID | <[email protected]> |
Thanks Alexey,
I need to have a look at the docu to better understand the class loader
stuff ...
The reason why I am doing this is:
- I want users to be able to script additional functionality
- if it works as script it could be switched to 'strict Java' mode
- and if performance required it compiled into the application.
To test I just used the java code of an existing class -
which should work
In the test code I set up the class path to the compiled classes like
HardwareREgistry & EventQueue.
Then I source the java class file into the interpreter -
I was assuming this would use the same or at least cascaded class loaders.
Alexey Zinger wrote:
>
> I'm wondering if this isn't because they are loaded by different class
> loaders and so com.rabe.proofstepmanager.hardwareregistry.HardwareRegistry
> and com.rabe.proofstepmanager.eventqueue.EventQueue classes in the
> constructor signature are not the same for the JVM as their versions
> loaded as normal class files. Is there a reason you need to source a
> legal Java class file rather than load its compiled version?
>
> Alexey
> 2001 Honda CBR600F4i (CCS)
> 1992 Kawasaki EX500
> http://azinger.blogspot.com
> http://bsheet.sourceforge.net
> http://wcollage.sourceforge.net
>
>
>
> --- On Thu, 6/26/08, MJB1024 wrote:
>
>> From: MJB1024
>> Subject: [Beanshell-users] error: Can't find constructor
>> To: beanshell-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
>> Date: Thursday, June 26, 2008, 3:19 PM
>> Hi, maybe someone can help me ...
>>
>> I am sourcing a java-source file defining a class which
>> compiles and run in
>> JAVA.
>> I want to use it interpreted, so it could be changed
>> easily.
>>
>> When I check the constructors with getDeclaredConstructors
>> they are shown as
>> expected.
>>
>> Then I construct the arguments as instances of JAVA
>> classes.
>>
>> When I try to construct an instance of the interpreted
>> class I get a strange
>> 'Can't find constructor'
>>
>> any Ideas what I need to do differently? - thanks MJB
>>
>> bsh session:
>> ----------------
>> bsh %
>> source("c:\\programme\\TestLoop\\cnf\\ScriptedPS\\PSSetRelaisGroup1.java");
>> com.rabe.m2pConnector.proofsteps.PSSetRelaisGroup1>
>>
>> bsh %
>> com.rabe.m2pConnector.proofsteps.PSSetRelaisGroup1.class.getDeclaredConstructors();
>> <[Ljava.lang.reflect.Constructor;@166c114>
>>
>> bsh %
>> print(com.rabe.m2pConnector.proofsteps.PSSetRelaisGroup1.class.getDeclaredConstructors());
>> java.lang.reflect.Constructor []: {
>> public
>> com.rabe.m2pConnector.proofsteps.PSSetRelaisGroup1(com.rabe.proofstepmanager.hardwareregistry.HardwareRegistry,com.rabe.proofstepmanager.eventqueue.EventQueue,com.rabe.utils.log.LogFile),
>> public
>> com.rabe.m2pConnector.proofsteps.PSSetRelaisGroup1(com.rabe.proofstepmanager.hardwareregistry.HardwareRegistry,com.rabe.proofstepmanager.eventqueue.EventQueue),
>> }
>>
>> bsh % hr = psm.hr;
>>
>> bsh % ev = psm.evtQueue;
>>
>>
>>
>> bsh % x = new PSSetRelaisGroup1(hr,ev);
>> // Error: EvalError: Constructor error: Can't find
>> constructor:
>> com.rabe.m2pConnector.proofsteps.PSSetRelaisGroup1(
>> com.rabe.proofstepmanager.hardwareregistry.HardwareRegistry,
>> com.rabe.proofstepmanager.eventqueue.EventQueue ) in class:
>> com.rabe.m2pConnector.proofsteps.PSSetRelaisGroup1 : at
>> Line: 1 : in file:
>> : new PSSetRelaisGroup1 ( hr , ev )
>>
>>
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/error%3A-Can%27t-find-constructor-tp18141334p18141334.html
>> Sent from the BeanShell - User mailing list archive at
>> Nabble.com.
>>
>>
>> -------------------------------------------------------------------------
>> Check out the new SourceForge.net Marketplace.
>> It's the best place to buy or sell services for
>> just about anything Open Source.
>> http://sourceforge.net/services/buy/index.php
>> _______________________________________________
>> Beanshell-users mailing list
>> Beanshell-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
>> https://lists.sourceforge.net/lists/listinfo/beanshell-users
>
>
>
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> _______________________________________________
> Beanshell-users mailing list
> Beanshell-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
> https://lists.sourceforge.net/lists/listinfo/beanshell-users
>
>
--
View this message in context: http://www.nabble.com/error%3A-Can%27t-find-constructor-tp18141334p18186962.html
Sent from the BeanShell - User mailing list archive at Nabble.com.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Beanshell-users mailing list
Beanshell-users-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/beanshell-users