AW: [opencms-dev] openCms 5 - properties vanish on thewayfromofflineto online project

Hans-Peter Meister Hans-Peter.Meister at dpg-brandenburg.de
Wed Mar 2 12:19:15 CET 2005


Thx again olli,

unfortunately the patch did not solve my problem and thus I have
begun to search the Java code my self. I have added a lot of debug
messages to the code [really awesome one partly - classes have
18.000 lines an more of code and exceptions are just caught and
ignored].

The problem for me is that the bug does not occur on my computer at
home (W2K, Tocmat, 1.4.1, MySql) but on the server (Linux 2.4.26, Tomcat,
1.4.1, MySql).

If i am publishing a text with additional attributes, I get the
following output (based on my code- so the lines do not fit with the
opencms original sources:

24.02.2005 17:23:59] <opencms_debug> [com.opencms.file.mySql.CmsDbAccess]
reading property for   	resource (3) [Resource]:/default/vfs/ ID: 3
ParentID: 2 , Project=12 , User=2 , Group=3 : 	Access=rwvrwvr-v- :
Resource-type=0 : Locked=-1 : length=-1 : state=0
[24.02.2005 17:23:59] <opencms_debug> [com.opencms.file.mySql.CmsDbAccess]
reading property for 	online project: false
[24.02.2005 17:23:59] <opencms_debug> [com.opencms.file.mySql.CmsDbAccess]
reading property using 	pool: jdbc:opencmspool:mysql
[24.02.2005 17:23:59] <opencms_critical>
[com.opencms.file.CmsObject.publishProject()/1] Project:834 Time:Thu Feb 24
17:23:59 GMT 2005
[24.02.2005 17:23:59] <opencms_critical>
[com.opencms.file.CmsObject.publishProject()/1] User: [User]:jens , Id=33 ,
flags=0 , type=0 :Jens Mannheim
[24.02.2005 17:23:59] <opencms_critical>
[com.opencms.file.CmsObject.publishProject()/1] Exception:
com.opencms.core.CmsException: 4 Sql exception. Detailed error:
[com.opencms.file.mySql.CmsDbAccess] Invalid argument value,  message from
server: "Duplicate entry '1' for key 1".
root cause was java.sql.SQLException: Invalid argument value,  message from
server: "Duplicate entry '1' for key 1"
[24.02.2005 17:23:59] <opencms_info>
[com.opencms.file.CmsObject.publishProject()/2] Project:834 Time:Thu Feb 24
17:23:59 GMT 2005
[24.02.2005 17:23:59] <opencms_info>
[com.opencms.file.CmsObject.publishProject()/2] User: [User]:jens , Id=33 ,
flags=0 , type=0 :Jens Mannheim
[24.02.2005 17:23:59] <opencms_info>
[com.opencms.file.CmsObject.publishProject()/2] Vector was null or empty

Well then - opencms (as far as I have read from the source code) does the
following
when exporting/publishing a page:
It deletes the online content and attributes and then rewrites the
attributes and content from
the offline project. I guess that this process stops way in the middle due
to an error so that
(besides from the identity bug you have fixed) - so that only a part of the
attributes get written to the online project.

So I finally have set up a development environment and tried to look up
where the bug occurs.
But when I took a deeper look to the code, I got shocked.
The database access classes have up to 18.000 lines and the exception
handling is (too be polite)
quite inconsistent. In fact it is hard to get a meaningful message. See
above
>> invalid argument value,  message from server: "Duplicate entry '1' for
key 1". <<
Well then, in which table and during which action??

Ok - the system is free but I would get fired if I wrote such code...

So I am deadly serious with asking if opencms is really fit for professional
use and if
any system based on it can be maintained?

My problem is that I have to set up a CMS for a non-profit organization
which simply does
not have the money to buy a CMS and that I cannot afford commercial support
from the people
who wrote that code - which is more or less inevitable if the code is
structured like this.

Well then, did anybody already have a problem like this and can give me
hint?

regards

Hans-Peter


> -----Ursprungliche Nachricht-----
> Von: opencms-dev-bounces at opencms.org
> [mailto:opencms-dev-bounces at opencms.org]Im Auftrag von Olli Aro
> Gesendet: Sonntag, 20. Februar 2005 12:20
> An: 'The OpenCms mailing list'
> Betreff: RE: [opencms-dev] openCms 5 - properties vanish on
> thewayfromofflineto online project
>
>
> The patch should work. Now thinking it more it will only work for new
> properties you create not the old ones you already have with wrong ids in
> your system. In order to fix the old ones you need to run the
> following SQL:
>
> Check whether any property definitions have incorrect IDs by executing the
> following SQL:
>
> SELECT
>   OFFL.PROPERTYDEF_NAME,
>   ONL.PROPERTYDEF_ID ONL_ID,
>   OFFL.PROPERTYDEF_ID OFFL_ID
> FROM
>   CMS_PROPERTYDEF OFFL,
>   CMS_ONLINE_PROPERTYDEF ONL
> WHERE
>   OFFL.PROPERTYDEF_NAME = ONL.PROPERTYDEF_NAME AND
>   OFFL.RESOURCE_TYPE = ONL.RESOURCE_TYPE  AND
>   OFFL.PROPERTYDEF_ID <> ONL.PROPERTYDEF_ID
>
> If any property definitions are listed with different IDs in online and
> offline mode, the ID of the online definition must be updated.
>
> If a definition has <offl_id> as its offline ID and <onl_id> as its online
> ID, follow these steps:
>
> Check the Online ID is not in use
>
> select * from CMS_ONLINE_PROPERTYDEF where PROPERTYDEF_ID = <offl_id>
>
> If this returns an empty set, then continue with the next statement.
> Otherwise, the existing property with this ID is also incorrect
> and needs to
> be fixed first.
>
> Update the Online Property Definition ID
>
> update CMS_ONLINE_PROPERTYDEF set PROPERTYDEF_ID = <offl_id> where
> PROPERTYDEF_ID = <onl_id>
>
> After each fix, run the top SQL to ensure everything is correct.
>
> Commit the changes, if any.
>
> Finally, check that the sequences are not affected:
>
> SELECT TABLE_KEY,ID
> FROM CMS_SYSTEMID
> WHERE TABLE_KEY = 'CMS_PROPERTYDEF' OR TABLE_KEY =
> 'CMS_ONLINE_PROPERTYDEF'
>
> After running the fixes, I always make sure that the IDs in the
> above table
> are at least as high as the highest used ID, which you can get from:
> SELECT MAX(PROPERTYDEF_ID) FROM CMS_PROPERTYDEF;
> SELECT MAX(PROPERTYDEF_ID) FROM CMS_ONLINE_PROPERTYDEF;
>
> I believe you need to restart the Tomcat server for the new values in the
> System ID table to kick in (I believe it caches these values).
> However, the
> system IDs have usually been okay for me and didn't require updating.
> Sometimes you need to republish the content after doing these fixes,
> although a restart may fix this.
>
> Please let me know if you still have a problem and I can send you
> the source
> code for my changes, so you can debug yourself why it is not working for
> you.
>
> The root cause for the problem is:
>
> The property id values are initiated from CMS_SYSTEMID table,
> which includes
> value for the next available property id for both online and
> offline tables.
> For some reason the values in CMS_SYSTEMID table will get out of sync and
> therefore you end up with different IDs for the same property
> between online
> and offline tables. This causes the
> com.opencms.file.genericSql.CmsDbAccess.readPropertyDefinition method not
> function properly since it cannot match the properties between online and
> offline tables.
>
> Fix that worked for me:
>
> Rewriting method
> com.opencms.file.genericSql.CmsDbAccess.readPropertyDefinition, so that it
> reads the next available ID always from offline (even for online
> and backup
> tables) seemed to fix the problem.
>
> Regards,
>
> Olli
>
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 265.8.8 - Release Date: 14/02/2005
>
>
>
>
>
> _______________________________________________
> 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