> <log realm="Q2.system" at="Wed Jul 22 09:21:57 EAT 2009.234">
> <warn>
> deploy
> <exception name="MBean class org.jpos.ui.action.TerminalList does
> not implement DynamicMBean, neither follows the Standard MBean
> conventions (javax.management.NotCompliantMBeanException: Class
> org.jpos.ui.action.TerminalList is not a JMX compliant Standard MBean)
> nor the MXBean conventions
What did you model TerminalList on?
Pick a QBean that works and make sure your class follows the same
convention?
> If I may ask,
> Having implemented Configurable, why does it complain about
> implementing DynamicMBean?
These are different interfaces, DynamicMBean is the one that is needed,
but that you are not implementing?
>
> Do you think my properties file is defined correctly? Is <object> a
> valid JPOS tag?
Q2 is trying to instance your QBean, which would indicate to me that
your config file is ok?
>
> <object name="TerminalList" class="org.jpos.ui.action.TerminalList">
> <property name="jdbc.url" value="jdbc:sybase:Tds:neptune002:5000/
> test_db" />
> <property name="jdbc.driver"
> value="com.sybase.jdbc2.jdbc.SybDriver" />
> <property name="db.user" value="test" />
> <property name="db.user.password" value="test123" />
> <property name="db.name" value="coredb" />
> </object>
>
> Since my TerminalList class also implements ActionListener, would this
> conflict with Configurable?
Conflict in which way - do you get compile errors or warnings?
Make sure your class 'looks' like a QBean class that works for you.
Once they implement the same interfaces and get their config in the same
way, you should be good.
--
Mark
>
>> Conflict in which way - do you get compile errors or warnings?
> No I don't get any compilation errors
Then conflicts of Interfaces and perhaps others are not a problem?
What is controlling this above QBean - Q2; it makes sure the methods
are called and passes down the configuration data in doing so.
>
> The only difference I see is that for the TerminalList case, I defined
> a seperate Property File(myconfig.xml), well as for the Breft class
> the Properties are imbedded in the ISOServer definition.
I think you need to worry about what might be calling the methods and
that your objects might be operating in different 'environments' and
thus methods you are expecting to be called are not.
We know that your setConfiguration is not being invoked (the null value)
so now you need to find out why, or place the code somewhere it is called.
--
Mark
*If* Q2 is not 'launching' your component, then it doesn't have the
chance to call setConfiguration.
>
> The challenge I have it that my TerminalList has to reside in
> org.jpos.ui.action for it to be used in my ISOMeter definition.
> See how am using the TerminalList in the ISOMeter.
> <qbean class="org.jpos.q2.ui.UI" name="UI" logger="Q2" look-and-
> feel="com.sun.java.swing.plaf.windows.WindowsLookAndFeel">
> ........
> ........
> <menu id="Terminals" accesskey="e">
> <menuitem id="Our Terminals" accesskey="G" action="terminallist" /
> </menu>
> </menubar>
> .......
> .......
> <object class="org.jpos.ui.action.TerminalList" id="terminallist" />
>
> </qbean>
>
> Is there any other location in which I can place TerminalList so that
> it's setConfiguration() will be invoked.
I'm not sure, but your TerminalList needs to get it's configuration from
somewhere, perhaps from ISOMeter (via NameRegistrar or if a reference is
available on a call made to it)?
Rather than try and guess from here, can you share your :-
TerminalList code,
ISOMeter deploy file
and anything else I will need to actually see your set-up?
--
Mark
I'm not sure, but your TerminalList needs to get it's configuration from
somewhere, perhaps from ISOMeter (via NameRegistrar or if a reference is
available on a call made to it)?
Thanks Alejandro - it was the detail on the interface I was missing and
hoping to discover/investigate in seeing the code 8).
--
Mark
>
> Below are the src files as per Mark's request;
>
> 3. TerminalList.java
This copy of the file is suffering a number of problems and does not
compile, perhaps try again?
As a 'for instance field' 'config' is never defined and you have some
badly placed field definitions?
Can you also describe for the list, what your intent is with two deploy
files?
--
Mark
>> Can you also describe for the list, what your intent is with two deploy
>> files?
> I didn't get this question clearly, please re-phrase for me.
> Which deploy files are your refering to in this case?
You currently have two deploy files using your TerminalList, why do you
need both?
Which is your main focus?
--
Mark
This is because config is currently null...
You need to does this work later (not in the constructor), perhaps after
the setUI method has been called to pass in the config?
--
Mark
>
> By deploy files are you refering to myconfig.xml and ISOmeter.xml?
Yes, referring to the folder they sit in under jpos-ee.
> I am using myconfig.xml as the configuration file for my TerminalList
> and is where am setting the values for the variables that I want to
> use in TerminalList.
So you are trying to set-up a QBean (with config) that is referenced
from the gui component?
To do this your TerminalList needs to be a QBean and this implement the
correct interfaces - I think this is your current issue.
> Meanwhile, in the ISometer.xml, I have a menuitem that access the
> TerminalList Class.
Your gui will need to pull the TerminalList object (that has picked up
it's config) from the NameRegister, at present you are directly
instancing an object that cannot get at it's config.
>
> On the ISometer GUI, when someone clicks on the OUR ATMs menu item, a
> the class TerminalList is invoked which in turn pops up a JTable with
> values
> picked from the database.
Ok.
> I don't want to hard code the connection parameters to the db, I want
> to supply them in a config file, thats why am trying to use
> myconfig.xml.
>
> jdbcdriver=config.getChildTextTrim("jdbc-driver");
>
> //Class.forName ("com.sybase.jdbc2.jdbc.SybDriver");
> Class.forName (jdbcdriver);
Ideally the component you are instancing in the gui component should be
able to get some 'gui config' - I think there is likely a place you
could put config - but it is not obvious (to me) where at this point.
I don't think you *need* a separately deployed object *just* to pass in
some config - there must be a more direct way.
As noted in another reply, your current NPE is because your config
object has not been initialised and is null. This is just a coding
error I'm afraid - and comes about from your use within the ui component.
The arrangement of components and config needs some work too.
I will try and take a look as the jPos ui components are new to me - so
I am interested in discovering how they work...
... but of course time is limited.
--
Mark
There will be other ways to achieve the same, but here is my suggestion...
If you modify your ISOServer.xml to include :-
<object class="org.jpos.ui.action.TerminalList" id="terminallist"
jdbc-driver="com.sybase.jdbc2.jdbc.SybDriver"
jdbc-url="jdbc:sybase:Tds:neptune002:5000/test_db"/>
<object class="org.jpos.ui.action.Exit" id="exit" />
<object class="org.jpos.ui.action.Debug" id="debug" />
</qbean>
Then jdbc-driver & jdbc-url are available as Attributes within the
config passed to your setUI method, allowing you to:-
jdbcurl=config.getAttributeValue("jdbc-url");
jdbcdriver=config.getAttributeValue("jdbc-driver");
You can get rid of your myconfig.xml - it is then redundant (if it ever
wasn't!).
I don't have your full environment to test, but I checked the attributes
make it through ok.
May I suggest that in future you setup a development environment so you
may debug your code and processes. It is very easy then to see what is
happening. I think you are working blind and making bad guesses as to
what *might* happen, thus causing you more grief than needed (and then
us) 8).
Is the check in the post?
--
Mark
> public TerminalList()
> {
> GridLayout layout = new GridLayout(1,0);
>
> try
> {
>
> jdbcurl=config.getAttributeValue("jdbc-url");
> jdbcdriver=config.getAttributeValue("jdbc-driver");
At this point config is null. You cannot use the config until *after*
your setUI method has been called *and* you have set your config from
that passed in.
This is now a total java issue, I am not doing your java coding and
debugging for you...
> public void setUI (UI ui, Element config) {
> this.ui = ui;
this.config = config;
... over to you.
--
Mark