Re: Playing With BeanContext

From: Donald Dietrick <dietrick@bbn.com>
Date: Fri Oct 12 2001 - 14:27:59 EDT

What happens if you try to create them using:

Object obj = ComponentFactory.create("omi.KLSFrame", null, null);

in your main application? Or even try to create them using the the

Object obj = Class.forName("omi.KLSFrame").newInstance();

Does this work?

Or, if you put the omi directory next to the com directory in the
openmap package?

I'm just trying to think of ways to certify that it is a classpath
problem.

- Don

On Friday, October 12, 2001, at 12:52 PM, Karl Stuempfle wrote:

> Don,
>
> I still seem to be stuck on this problem after all. I can get my custom
> components to add to the BeanContext if I specifically add them into the
> bean handler, but I still can't get them to do it through the components
> property.
>
> I made an addition to the classpath line in openmap.bat to point to my
> omi
> package, and now I do not get "ClassNotFoundExceptions", but the
> components
> still do not show up. With the debug property "componentfactory" turned
> on,
> it simply writes to the console: ComponentFactory: [0] NOT created -
> omi.KLSFrame
>
> All the rest of the components seem to be successful, except for my
> custom
> menu, which writes this to the console: ComponentFactory: [17] NOT
> created -
> omi.TestMenu
>
> The frame is as listed below, and the menu extends AbstractOpenMapMenu
> and
> implements MenuBarMenu and also has an "empty" constructor.
>
> Any more hints?
>
> Karl...
>
>
> ----- Original Message -----
> From: "Donald Dietrick" <dietrick@bbn.com>
> To: "Karl Stuempfle" <kstuempfle@omi.com>
> Sent: Thursday, October 11, 2001 4:29 PM
> Subject: Re: Playing With BeanContext
>
>
>> Hi Karl,
>>
>> On Thursday, October 11, 2001, at 04:04 PM, Karl Stuempfle wrote:
>>
>>> I have a work-around. I don't particularly understand why it works
>>> this
>>> way,
>>> and not through the components property, but here it is....
>>>
>>> This is the code (complete) for my "Frame":
>>>
>>> package omi;
>>> import com.bbn.openmap.gui.*;
>>>
>>> public class KLSFrame extends OpenMapFrame {
>>> public KLSFrame() {
>>> super("Here is My Title");
>>> }
>>> }
>>>
>>> What I did was remove the frame from the components list, then
>>> specifically
>>> create it and add it to the MapHandler BEFORE letting the
>>> PropertyHandler
>>> add components. It seems to work as I would have expected the
>>> components
>>> list would have. Here is the code I used to do this is my KLSMain
>>> "App":
>>
>> The error you were getting is specifically triggered by a
>> ClassNotFoundException (I just checked the code). What happens if you
>> add the path to your package to the classpath?
>>
>>
>> Yeah, it's a classpath issue. I just tried to create my own frame,
>> just
>> like yours, and in order to get it to work I had to add the path for
>> the
>> frame in my bin/openmap file. My environment classpath wasn't good
>> enough.
>>
>>>
>>> MapHandler beanHandler = new MapHandler();
>>>
>>> try {
>>> KLSFrame kls = new KLSFrame();
>>> beanHandler.add(kls);
>>> beanHandler.add(propertyHandler);
>>> propertyHandler.createComponents(beanHandler);
>>> beanHandler.add(mapBean);
>>>
>>> Only the first 2 lines inside the try block are different from what is
>>> in
>>> the "default" OpenMapApp class.
>>>
>>> By the way, I LOVE the drawing tool additions. Keep up the great work.
>>
>> Thanks, I appreciate the feedback.
>>
>>
>>> Hopefully "soon" I'll be able to contribute to the effort.
>>
>> Great! With the next release, I'm actually putting together a list of
>> things we need help on.
>>
>> - Don
>>
>>> ----- Original Message -----
>>> From: "Donald Dietrick" <dietrick@bbn.com>
>>> To: "Karl Stuempfle" <kstuempfle@omi.com>
>>> Cc: "OpenMap Help" <openmap-users@bbn.com>
>>> Sent: Thursday, October 11, 2001 2:15 PM
>>> Subject: Re: Playing With BeanContext
>>>
>>>
>>>> Hi Karl,
>>>>
>>>> On Thursday, October 11, 2001, at 02:05 PM, Karl Stuempfle wrote:
>>>>
>>>>> I have been trying to see what is possible with the BeanContext
>>>>> stuff
>>>>> in
>>>>> OpenMap 4.3, and I am having a problem.
>>>>>
>>>>> I successfully added and removed existing items using the
>>>>> "openmap.components" property, except for the "frame". I tried to
>>>>> create a
>>>>> subclass of OpenMapFrame and use it in place of the current "frame"
>>>>> component. I turned on the basic and properties keywords for
>>>>> Debugging
>>>>> and
>>>>> got this message:
>>>>>
>>>>>
>>>>> *** ERROR ***
>>>>> ComponentFactory.create: Failed to create "omi.KLSFrame" using
>>>>> component
>>>>> marker
>>>>> name "klsframe" - class not found.
>>>>> *************
>>>>>
>>>>
>>>> The ComponentFactory is not finding the omi.KLSFrame in it's
>>>> classpath,
>>>> or can't find an empty constructor method for it.
>>>>
>>>>> It was followed by these messages:
>>>>>
>>>>> ToolPanel: found a tool Object
>>>>> ToolPanel: found a tool Object
>>>>> OMToolSet: found a MapBean object
>>>>
>>>> These are normal debug statements where these components are
>>>> announcing
>>>> that they have found the other objects they need from the
>>>> BeanContext.
>>>>
>>>>> I created a package called "omi" consisting of KLSFrame and KLSMain.
>>>>> KLSMain
>>>>> simply mimics the functionality of OpenMapApp, and I ran the app
>>>>> from
>>>>> the
>>>>> DOS prompt with the following command: java omi/KLSMain
>>>>> The omi package is just a directory structure, not a jar file,
>>>>> but "."
>>>>> is in
>>>>> the classpath.
>>>>
>>>> This seems to be fine, seeing that the KLSMain class appears to be
>>>> found, right? So the KLSFrame should be OK. I'd check for the empty
>>>> constructor for KLSFrame.
>>>>
>>>> - Don
>>>>
>>>>> Any ideas as to what I am missing? It has to be something simple.
>>>>>
>>>>> Karl...
>>>>>
>>>>> --
>>>>> [To unsubscribe to this list send an email to "majdart@bbn.com"
>>>>> with the following text in the BODY of the message "unsubscribe
>>>>> openmap-users"]
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
>

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Fri Oct 12 14:29:00 2001

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:32 EDT