• Welcome to KonaKart Community Forum. Please login or sign up.
 
April 28, 2024, 12:02:09 pm

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - unic1988

1
Programming of KonaKart / Re: KKCustomEng.finalize()
February 11, 2009, 09:35:59 am
Well that could be the point. I have set Session duration in Konakart properties to 1 minute and after 1 minute I I was logged off automatically, so I thought that that is the moment the session expries. I am sorry that I have to ask such stupid questions, but I just don't know it better.

btw. I found out, that valueUnbound get called correctly if I restart the Server, so it seems you are right. I will take a look how long a session is stored in Tomcat 6.

Thank you.
2
Programming of KonaKart / Re: KKCustomEng.finalize()
February 11, 2009, 09:25:25 am
Edit: It works sometimes, but I have no Idea what it depends on.
3
Programming of KonaKart / Re: KKCustomEng.finalize()
February 11, 2009, 08:57:06 am
I tried it another way using javax.servlet.http.HttpSessionBindingListener.

My KKCustomEng now implements this interface (public void valueBound(HttpSessionBindingEvent e), public void valueUnbound(HttpSessionBindingEvent event) ) and I am adding the KKCustomEng explicitly as an Attribute to the session. I thought that should solve the problem, but it doesn't. valueBound() gets called correctly when the KKCustomEng is added to the session, but valueUnbound() doesn't and I have no Idea why. Is this a Bug in javax.servlet.http.HttpSessionBindingListener or is it a special behaviour of Konakart?

Thanks in advance.
4
Hello,

For some reasons I need to know the IP Address of the Customer in the KKCustomEng. I couldn't find any method that gives me the IP Address so I thought it would be best to set it from an Action (BaseAction.java).

It seems that getKKAppEng(HttpServletRequest) is the method that gets called nearly everytime an Action is performed, so I customized it a bit to have access to the IP Address from KKCustomEng.

1. I made a new dataelement in KKCustomEng named "String remoteAddr"
2. I modified BaseAction.getKKAppEng() this way:

...
        kkAppEng.setPageTitle(getCatMessage(request, "seo.default.title"));
        kkAppEng.setMetaDescription(getCatMessage(request, "seo.default.meta.description"));
        kkAppEng.setMetaKeywords(getCatMessage(request, "seo.default.meta.keywords"));

/* CUSTOMIZATION */

try {

String ip = request.getRemoteAddr();

if(kkAppEng.getEng() instanceof KKCustomEng && ip != null) {

((KKCustomEng)kkAppEng.getEng()).setRemoteAddr(ip);
}
}
catch(Exception e) {

mylog.debug("Error " + e.getMessage());
}

/* CUSTOMIZATION */

        return kkAppEng;
    }


First it seemed to work, but I never had the IP Adress available in KKCustomEng. Does kkAppEng.getEng() always return a new KKEngIf-object?

If yes: Is there another Way to pass the Ip Address to KKCustomEng?

Thanks in advance
5
Programming of KonaKart / Re: KKCustomEng.finalize()
February 06, 2009, 03:20:52 pm
First: Thank you for your fast answer,

let me explain you my problem a little more detailed:

Everytime the user gets a product displayed I want to save what product he looks at, the customers-id and the price of the product. I am saving this Information in an little class that I've written called ProductHistoryItem and save it as a Datalement in the KKCustomEng:

KKCustomEng.java
...

//Hashtable<Integer productId, ProductHistoryItem productInformation>

java.util.Hashtable<Integer, ProductHistoryItem> phItems = new Hashtable<Integer, ProductHistoryItem>();

...


Now everytime the Customer gets a product displayed I write that to this Hashtable

...
phItems.put(product.getId(), new ProductHistoryItem(... /* product information here */));
...


This all works fine.

Now everytime the customer orders a product I want to note that:

...
phItems.get(orderproduct.getProductId()).setOrdered(true);
...


(setOrdered is a method of class ProductHistoryItem)

Now all information that i need to save is in my Hashtable, but I want to write all this stuff into a custom table in the Database, but there are two problems:

1. befor I write something about a product to the database I have to wait if the customer orders this product, so I have to wait until the customer finished shopping, what is when the session expires. This is because I have many entrys per product, so I cant easily identify which of the entrys is the one that belongs to the actual ordered product.

2. It wouldn't be nice for performance if I do a SQL query everytime the user looks at a product, so thats another cause to do all the database stuff in one step at the moment the session expires.

Now it seemes, that the finalize() method is never called, why is this? I thought the finalize() method has to be called everytime the garbage collector destroyes an object.

So far what my problem is.


You say that I could use the checkSession() method, but I need to know when this method gets called? Does this method return a special value at the moment the session expires? I saw that it returns the customers Id, but that doesn't help me anyway, because I think, that this Id only is valid if the customer is logged in, but my Hashtable exists even if the customer is not logged in, what would lead me to a situation where I would save the products history data befor I really know if the user orders this product during this session or not.
6
Programming of KonaKart / Re: KKCustomEng.finalize()
February 06, 2009, 12:28:44 pm
After some testing it looks like KKCustomEng.finalize() never gets invoked. Is that right, because I thought the Garbage collector invokes that method once for every Object  ??? I am a bit confused.
7
Programming of KonaKart / KKCustomEng.finalize()
February 06, 2009, 12:01:21 pm
Hello everyone,

I need to do some things exactly when the users session expires, so I thought that should be easy via KKCustomEng.finalize(), but I can't get this method get called when the session expires.

What I have done in KKCustomEng.java:

protected void finalize() throws Throwable {

    mylog.debug("session closed");

    try {

//do something with some data that I've gathered during this session
    }
    finally {

super.finalize();
    }
}


I have also set konakart.session.durationMinutes=2, so I think the session should expire very fast (2 minutes).

So is there someone who can call me if I did something wrong, or if it won't work this way?
8
Ok it was a Problem with another Tomcat installation on my pc that I didn't remember, especially it was not running. That Tomcat was integrated into my xampp, so I didn't even know that I had installed it  ::).

Thanks for your Help!
9
I reinstalled Konakart 2.2.6.0 exactly the same way I installed 3.2.0.0 befor and it works as good as always, so I really have no idea where this error comes from, thanks for your help, I have to search my pc for something that doesn't get along with Konakart 3.2.0.0 i guess.

10
First I uninstalled Konakart 2.2.6.0 using the uninstall.exe, then I installed Konakart 3.2.0.0 with the Windows GUI installer without any problems. After that I just tried do start Konakart 3.2.0.0 but it gives me this Error.

I have "xampp" (Apache Http Server, MySQL Server) running as a service for some other things my pc has to do, but there has never been a problem befor when I was using Konakart 2.2.6.0.

Do I have to "free" the port 8780?

Thanks in advance.
11
Hello,

I downloaded and installed Version 3.2.0.0 on WindowsXP, JRE 1.6.0_07 without any Problems, the database tables are created and filled. But if I start Konakart I get an 404 Error and I don't know where it comes from.

QuoteHTTP Status 404 -

type Status report

message

description The requested resource () is not available.
Apache Tomcat/6.0.18




This is what Tomcat says:

Quote04.02.2009 09:37:21 org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.14.
04.02.2009 09:37:21 org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [false], sendfile [true], accept filters [false], random [true].
04.02.2009 09:37:22 org.apache.coyote.http11.Http11AprProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8780
04.02.2009 09:37:22 org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
04.02.2009 09:37:22 org.apache.coyote.http11.Http11NioProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8443
04.02.2009 09:37:22 org.apache.coyote.ajp.AjpAprProtocol init
INFO: Initializing Coyote AJP/1.3 on ajp-8789
04.02.2009 09:37:22 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1534 ms
04.02.2009 09:37:22 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
04.02.2009 09:37:22 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
04.02.2009 09:37:26 org.apache.catalina.core.StandardContext start
SCHWERWIEGEND: Error listenerStart
04.02.2009 09:37:26 org.apache.catalina.core.StandardContext start
SCHWERWIEGEND: Context [/konakart] startup failed due to previous errors
04.02.2009 09:37:27 org.apache.catalina.core.StandardContext start
SCHWERWIEGEND: Error listenerStart
04.02.2009 09:37:27 org.apache.catalina.core.StandardContext start
SCHWERWIEGEND: Context [/konakartadmin] startup failed due to previous errors
04.02.2009 09:37:27 org.apache.coyote.http11.Http11AprProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8780
04.02.2009 09:37:27 org.apache.coyote.http11.Http11NioProtocol start
INFO: Starting Coyote HTTP/1.1 on http-8443
04.02.2009 09:37:27 org.apache.coyote.ajp.AjpAprProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-8789
04.02.2009 09:37:27 org.apache.catalina.startup.Catalina start
INFO: Server startup in 5108 ms




and I found this in the logs:

Quote04.02.2009 09:37:26 org.apache.catalina.core.StandardContext listenerStart
SCHWERWIEGEND: Skipped installing application listeners due to previous error(s)
04.02.2009 09:37:27 org.apache.catalina.core.StandardContext listenerStart
SCHWERWIEGEND: Error configuring application listener of class org.apache.axis.transport.http.AxisHTTPSessionListener
java.lang.NoClassDefFoundError: javax/servlet/http/HttpSessionListener
   at java.lang.ClassLoader.defineClass1(Native Method)
   at java.lang.ClassLoader.defineClass(Unknown Source)
   at java.security.SecureClassLoader.defineClass(Unknown Source)
   at java.net.URLClassLoader.defineClass(Unknown Source)
   at java.net.URLClassLoader.access$000(Unknown Source)
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1302)
   at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3786)
   at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
   at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
   at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
   at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
   at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
   at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
   at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
   at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
   at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
   at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
   at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
   at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
   at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
   at org.apache.catalina.core.StandardService.start(StandardService.java:516)
   at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
   at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
   at java.lang.reflect.Method.invoke(Unknown Source)
   at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
   at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.ClassNotFoundException: javax.servlet.http.HttpSessionListener
   at java.net.URLClassLoader$1.run(Unknown Source)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClass(Unknown Source)
   at java.lang.ClassLoader.loadClassInternal(Unknown Source)
   ... 37 more
04.02.2009 09:37:27 org.apache.catalina.core.StandardContext listenerStart
SCHWERWIEGEND: Skipped installing application listeners due to previous error(s)


So it looks like Tomcat is not able to find some needed classes, but I have no Idea where they are and what I have to do to solve this problem.
12
I solved the Problem doing the following:

KKEngIf kkEng = new KKEng();

CustomerIf customer = (sessionId == null) ? kkEng.getDefaultCustomer() : kkEng.getCustomer(sessionId);
AddressIf addr = customer.getAddresses()[0];


Now it works for the default customer, but it doesn't work if the user is logged in. customer.getDefaultAddr()  is neither working if the is not logged in nor if the user is logged in. So I tried it with CustomerIf.getAddresses() but if the user is logged in this method returns null.

Does anyone have an idea what I am making wrong?

And another Question: what is the method CustomerIf.getDefaultAddrId() for? Does it return the id of the default address in the array of addresses thats returned from CustomerIf.getAdresses() ?
13
Well I have set a default customer in Admin App: KKAdminAppliaction -> Customers ->Customers -> [new] -> set the 'Type' to 'default customer'. Then I have entered some Information that doesn't belong to any other customer I could imagine and I made one taxarea for the whole world and mapped it to 'All countries', 'All zones'. Now an defaultCustomer exists, but I still can't get the defaultCustomers address  :-\.

Any Idea?
14
I found the problem: In this case the defaultCustomer is null. But that is anotherproblem, why is the defaultCustomer null? I really don't know what to do here.

please help me!
15
hello,

I want to get the default taxrate/tax from an API-Call, so I thougt it would be the best way to use the KKEngIf.getTax() method.

now there is the problem, that this method requires some parameters, so I tried it this way:

CustomerIf customer = (sessionId == null) ? this.eng.getDefaultCustomer() : this.eng.getCustomer(sessionId);
AddressIf addr = customer.getDefaultAddr();
BigDecimal taxrate = this.eng.getTaxRate(addr.getCountryId(), addr.getZoneId(), taxClassId);


the sessionId and taxClassId are always available, but I get an exception when calling customer.getDefaultAddr(); if the user is not logged in. I'm a bit confused, because the exceptionmessage is 'null'. So is the problem that the default customer doesn't have an address or is something other? Is there maybe another way to get the tax/taxrate?

I hope someone has a solution for me,

thanks for all answers!