cancel
Showing results for 
Search instead for 
Did you mean: 

Startup of SAP Commerce fails with error: typePK or Code was NULL in getPersistenceInfoInternal()

First few errors in console looks like this

[DBPersistenceManager] typePK or Code was NULL in getPersistenceInfoInternal()


As a result server not started. There is no other additional info which help to identify issue.
We faced with it at our SAP Commerce Cloud Dev environment, where we have to builds A(20210826.1) and B(20210827.1). Fails happense during update from A to B, after type system update internals not restarted with some exception. Two builds are totally fine to init system and everything works correctly. Looks like really some kind of bug during system update process, which cause that you will not be able to startup you hybris server.

I check what changes do we have in items.xml and there is nothing too fancy:
-add/remove some relations
-add/remove some product subtypes
-add/remove some attributes
-move some attributes from remove product subtypes to parent type

Can some body help with it?

0 Kudos

dorothee.wiethoff I saw you had similar issue with your type system.

https://answers.sap.com/questions/13229779/sap-commerce-startup-fails-with-error-typepk-or-co.html How did you identify missing attribute descriptor in your case?

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

I believe solution is to identify wrong attribute descriptors and delete them(from simplified example which you can reproduce it's 'someAttributeWithVeryVeryLongName', 'someAttributeWithVeryVeryLongNameProduct').

In my case it was safe to delete types and all there attribute descriptors.
So I execute locally SQL script bellow and was able to start server and run hybris update successfully.

// cleanup TYPESYSTEMPROPS
delete from TYPESYSTEMPROPS where ITEMPK in (
    select pk from ATTRIBUTEDESCRIPTORS where ENCLOSINGTYPEPK in (
        select pk from COMPOSEDTYPES where INTERNALCODE in ('CustomOldProduct', 'CustomNewProduct', 'CustomOldProduct2SomeTypeRelation')
    )
    union
    select pk from COMPOSEDTYPES where INTERNALCODE in ('CustomOldProduct', 'CustomNewProduct', 'CustomOldProduct2SomeTypeRelation')
);

// cleanup COMPOSEDTYPES
delete from COMPOSEDTYPES where INTERNALCODE in ('CustomOldProduct', 'CustomNewProduct', 'CustomOldProduct2SomeTypeRelation');

// cleanup COLLECTIONTYPES
delete from COLLECTIONTYPES  where  INTERNALCODE like 'CustomOldProduct2SomeTypeRelation%';

// remove attributedescriptors for not existed types
delete from ATTRIBUTEDESCRIPTORS where pk in (
    select pk from ATTRIBUTEDESCRIPTORS where EnclosingTypePK not in (select PK from COMPOSEDTYPES)
);

// cleanup localization tables
delete from ATTRIBUTEDESCRIPTORSLP where itempk not in (select pk from ATTRIBUTEDESCRIPTORS);
delete from COLLECTIONTYPESLP where itempk not in (select pk from COLLECTIONTYPES);
delete from COMPOSEDTYPESLP where itempk not in (select pk from COMPOSEDTYPES);

// remove deployments of deleted COMPOSEDTYPES (for relation CustomOldProduct2SomeTypeRelation typecode="14000")
delete from ydeployments where TYPECODE in (14000)
0 Kudos

By the way your table names can be different if you did rolling updates, which is for sure case in Cloud environment(example

attributedescriptors9c).

Find correct table using queries like:

select * from YDEPLOYMENTS where NAME = 'AttributeDescriptor' order by TYPESYSTEMNAME desc

Probably first will be yours, but I don't know which type system is active in your system.

Answers (1)

Answers (1)

0 Kudos

Find out the root of this issue. Simultaneously remove and add attributes with similar long names. For simplification I create example that everybody can reproduce with there local SAP Commerce(I use version 2011).

For example initially we have a custom attribute 'someAttributeWithVeryVeryLongName'. System initialized and works properly.

<itemtype code="Product" autocreate="false" generate="false">
    <attributes>
        <attribute qualifier="someAttributeWithVeryVeryLongName" type="java.lang.String">
            <persistence type="property"/>
        </attribute>
    </attributes>
</itemtype>

Then we deside to remove this attribute 'someAttributeWithVeryVeryLongName' and add attribute 'someAttributeWithVeryVeryLongNameProduct'. So our 'items.xml' changed to:

<itemtype code="Product" autocreate="false" generate="false">
    <attributes>
        <attribute qualifier="someAttributeWithVeryVeryLongNameProduct" type="Product">
            <persistence type="property"/>
        </attribute>
    </attributes>
</itemtype>

During system update internals not restarted with error:

[DBPersistenceManager] typePK or Code was NULL in getPersistenceInfoInternal()

So we do simple things like add and remove attributes, but as result got broken environment. By the way this two attributes can live together without any issues.

Looks like it's a bug at SAP Commerce. Can somebody from SAP team report this issue?

sapcommerce ?..

0 Kudos

For this example I was able to back system to live by executing next script:

// remove attributedescriptors that cause error
DELETE FROM attributedescriptors WHERE qualifierinternal IN ('someAttributeWithVeryVeryLongName', 'someAttributeWithVeryVeryLongNameProduct');

// cleanup localization tables
DELETE FROM attributedescriptorslp WHERE itempk NOT IN (SELECT pk FROM attributedescriptors);

// To be sure that we are save drop column
ALTER TABLE products DROP COLUMN p_someattributewithveryverylon;
// This column not created: ALTER TABLE products DROP COLUMN p_someattributewithveryverylo0;