• Welcome to KonaKart Community Forum. Please login or sign up.
 

MgrFactory throws nullpointer

Started by shadders, May 24, 2011, 10:30:41 am

Previous topic - Next topic

shadders

I've been working with konakart API for a while now but I've never been able to invoke any of the manager classes with MgrFactory.

e.g. if I try to use MgrFactory.getProdMgr(true or false) I get the following stack trace:

INFO  - MgrFactory                 - Getting class by name for ProductMgr with a com.konakart.appif.KKEngIf constructor
3740438 [btpool0-7] INFO com.konakart.bl.MgrFactory  - Getting class by name for ProductMgr with a com.konakart.appif.KKEngIf constructor
java.lang.NullPointerException
at com.konakart.bl.MgrFactory.getConstructor(Unknown Source)
at com.konakart.bl.MgrFactory.getConstructor(Unknown Source)
at com.konakart.bl.MgrFactory.instantiateProdMgr(Unknown Source)
at com.konakart.bl.MgrFactory.getProdMgr(Unknown Source)


I'm instantiating MgrFactory like this:

new MgrFactory(new KKWSEng());

I don't think the source is available for MgrFactory as it's in konakart.jar, so I can't step through the code. 

Can you give me any suggestions?  Is this supposed to work with a webservices engine?

kate

I'm not certain about what you're trying to achieve there....  but you should probably use the KKEng engine there and also use the constructor that takes an EngineConfigIf.

shadders

I want to be able to use all the various manager classes.  Sorry I should have been a bit more clear, I slimmed down the code example a bit.

I already have a KKWSEng which I'm using because the konakart engine isn't on the same server as the web front end.  So it's more like:

KKEngIf eng = new KKWSEng();
new MgrFactory(eng).getProductMgr(false);
I'm gussing it falls over inside the getProductMgr() method on the following line

String str1 = KKEng.getKonakartConfig().getString("manager." + paramString1);

Looking inside KKEng it appears the static method KKEng.getKonakartConfig() returns a value that is only set if you invoke the contructor of the KKEng class which I'm not doing since I'm using KKWSEng.

Are these manager class supported with a WS engine?

kate

Think of KKWSEng as the client that allows you to access the KonaKart engines.  Don't think of it as the engine itself.

So, use the KKWSEng to make standard (KKEngIf) calls to the KonaKart engine... then...  on the server side - where your web services are running...   you define your engine specialisations there...

Also, use the constructor that takes an EngineConfigIf.

You'll see in the konakart.properties file that you define the engine that you want your web services to use:

# -----------------------------------------------------------------------------------
# KonaKart engine class used by the web services
# For the default engine use:   com.konakart.app.KKEng
# For the custom engine use:    com.konakart.app.KKCustomEng

konakart.app.ws.engine.classname = com.konakart.app.KKEng


There are different techniques for customising engine behaviour...  Check the User Guide for more details.