[opencms-dev] Problem with Maintenance class
Hartmann, Waehrisch & Feykes GmbH
hartmann at waehrisch-feykes.de
Tue Jan 27 12:53:01 CET 2004
The problem is that the class must be in the physical file system before the
classloader can load it. In case of the first upload opencms tries to get an
instance of the class before it has been published and put to the physical
file system. In case of the second upload the class is already in the
physical file system and the class can be loaded before the module is
published.
Now i don't know what you need to do as initialization but i can suggest you
an alternaive to Achim's solution. For creating database tables we did the
trick that we have static initialization blocks in the classes that matter
(usually the content definition classes), where we call a static method that
checks if the tables are already there and if not they will be created.
Because the blocks are static they will be called only once at classload
time.
If you are not dealing with tables you could check if a module property
exists and if not do the initialization and then create the property.
Bye,
Stephan
----- Original Message -----
From: "Jörg Herbst" <herbst at getit.de>
To: <opencms-dev at opencms.org>
Sent: Tuesday, January 27, 2004 9:46 AM
Subject: [opencms-dev] Problem with Maintenance class
> Hi,
>
> I've create a new module for OpenCms and added a maintenance event class
> in the administration view, to process some code after uploading the
> module. I've put this class in a folder called "classes" in my module
> and exported the module to a zip file. When I import my module the class
> seems to be loaded to the virtual file system and exported to the
> physical file system. But my maintenance class is not executet!
> It seems my servlet engine doesn't recognize the new class. When I start
> and stop the servlet engine and upload the module again, the class is
> found and my method is excecutet. So I've got to upload my module twice
> to get the whole thing working. Has anybody occured such a problem
> before and found a solution?
>
> Enviroment:
> W2K
> Jboss 3.2.2 with Tomcat 4.1.27 (also tried tomcat standalone)
> JDK 1.4.1
> MySQL 3.2
>
> Class structure:
> public class Maintenance {
> public static void moduleParameterWasUpdated(CmsObject cms) throws
> CmsException {
> // Also a Dummy
> }
>
> public static void moduleWasUploaded(CmsObject cms) throws
> CmsException {
> // This code should be executet
> }
>
> public static void moduleWasDeleted(CmsObject cms) throws CmsException
{
> // Just a dummy
> }
> }
>
> Thx
> Joerg
>
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev
>
More information about the opencms-dev
mailing list