cancel
Showing results for 
Search instead for 
Did you mean: 

Renaming a namespace

ukdavo
Champ in-the-making
Champ in-the-making
Hi there

We're refactoring some custom content models, standardising on naming conventions, etc. As part of this we'd like to rename a custom namespace. Unfortunately we're getting errors on attempting to apply an aspect that references the renamed namespace to the effect that the aspect doesn't exist. In the log the error references the aspect using its original namespace. I had a look in the database and noted that:

- Table alf_namespace contains entries for the original and renamed namespace.
- Table alf_qname contains QNames for the aspects that reference the original and renamed namespace.

I'm guessing that renaming namespaces isn't just a matter of renaming the URI in the content model definition XML. Does anyone know how to do this?

Many thanks

Mark
4 REPLIES 4

mitpatoliya
Star Collaborator
Star Collaborator
Of course it is something which should not be changed.
You should not changes the namespace.

You can try once with full reindexing.
in you alfresco-global.properties file  add this
index.recovery.mode=FULL
and restart the server.

ukdavo
Champ in-the-making
Champ in-the-making
Tried that but I get the same error:


"callstack" :
  [
       ""      ,"org.alfresco.service.cmr.dictionary.InvalidAspectException: 08040064 The aspect is invalid: {http:\/\/www.mycompany.co.uk\/model\/content\/1.0}myaspect"
      ,"org.alfresco.repo.node.db.DbNodeServiceImpl.addAspect(DbNodeServiceImpl.java:783)"
      ,"sun.reflect.GeneratedMethodAccessor523.invoke(Unknown Source)"
      ,"sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)"

Note that 'http://www.mycompany.co.uk/model/content/1.0}myaspect' is the old QName.

mitpatoliya
Star Collaborator
Star Collaborator
Are you using the same prefix for both of your old and new namespace uri?
That could create problem.
IF no then only option I see is remove the old aspect from all your nodes via script and add the new aspect via script.

ukdavo
Champ in-the-making
Champ in-the-making
Yes - I'm using the same prefix. I had already removed all nodes that used the aspect in question (incl. clearing out the recycle bin). I ended up starting from a fresh DB. Not ideal but we're not in production yet. Thanks for the suggestions.