Re: error: Can't find constructor

Alexey Zinger <inline_four-/[email protected]> Fri, 27 Jun 2008 08:15:06 -0700 (PDT)
Newsgroups gmane.comp.java.beanshell.user
Message-ID <[email protected]>
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 <[email protected]> wrote:

> From: MJB1024 <[email protected]>
> 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");
> <class
> 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;
> <com.rabe.proofstepmanager.hardwareregistry.HardwareRegistry@1bf68a9>
> bsh % ev = psm.evtQueue;
> <com.rabe.proofstepmanager.eventqueue.EventQueue@ec436>
> 
> 
> 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:
> <unknown 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