You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Shafique Rehman <sh...@avanzasolutions.com> on 2016/06/14 07:12:28 UTC

How Set Primary Type while creating repository

Hello,

My name is Shafique, iam using jackrabbit API 2.2.1. I am facing "primary
type" problem while creating repository below are lines of code

protected Repository createRepository(InputSource is, File homedir)  throws
RepositoryException {
    RepositoryConfig config = RepositoryConfig.create(is,
homedir.getAbsolutePath());
             return RepositoryImpl.create(config);
         }


Face below exception while calling RepositoryImpl.create(config);


javax.jcr.nodetype.ConstraintViolationException: /: mandatory property {
http://www.jcp.org/jcr/1.0}primaryType does not exist.

Could you please help me how i set primary type?

-- 
Regards,


*Shafique Rehman Dhuyo *

*Software Engineer*





<http://www.avanzasolutions.com/>


*Avanza Solutions (Pvt.) Ltd.*

201, 2nd Floor, Beaumont Plaza, Beaumont Road, Karachi-75530, Pakistan.
*U* + 92 21 111-AVANZA (282-692) (XYZ)
*M* + 92 3342619847
*F* + 92 21 35675244
*E* shafique.rehman@avanzasolutions.com
*W*

www.avanzasolutions.com




<http://www.facebook.com/avanzasolutionsme>
<https://twitter.com/avanzasolutions>
<http://www.linkedin.com/company/avanza-solutions>
------------------------------
*This email and its attachments may be confidential and are intended and
solely for the use of the individual to whom it is addressed. Any views or
opinions expressed are solely those of the author and do not necessarily
represent those of Avanza Solutions. If you are not the intended recipient
of this email and its attachments, you must take no action based upon them.
Nor must you copy or show them to anyone. Please contact the sender if you
believe you have received this email in error.*

Re: How Set Primary Type while creating repository

Posted by Woonsan Ko <wo...@apache.org>.
Hi Shafique,

Based on the exception message, I think you tried to change the
primary type of the *root* node. That's not allowed in JCR.
You can add a new node of a specific primary type underneath using
javax.jcr.Node#addNode(String relPath, String primaryNodeTypeName).
See the javadoc for detail.

Regards,

Woonsan


On Tue, Jun 14, 2016 at 3:12 AM, Shafique Rehman
<sh...@avanzasolutions.com> wrote:
> Hello,
>
> My name is Shafique, iam using jackrabbit API 2.2.1. I am facing "primary
> type" problem while creating repository below are lines of code
>
> protected Repository createRepository(InputSource is, File homedir)  throws
> RepositoryException {
>     RepositoryConfig config = RepositoryConfig.create(is,
> homedir.getAbsolutePath());
>              return RepositoryImpl.create(config);
>          }
>
>
> Face below exception while calling RepositoryImpl.create(config);
>
>
> javax.jcr.nodetype.ConstraintViolationException: /: mandatory property {
> http://www.jcp.org/jcr/1.0}primaryType does not exist.
>
> Could you please help me how i set primary type?
>
> --
> Regards,
>
>
> *Shafique Rehman Dhuyo *
>
> *Software Engineer*
>
>
>
>
>
> <http://www.avanzasolutions.com/>
>
>
> *Avanza Solutions (Pvt.) Ltd.*
>
> 201, 2nd Floor, Beaumont Plaza, Beaumont Road, Karachi-75530, Pakistan.
> *U* + 92 21 111-AVANZA (282-692) (XYZ)
> *M* + 92 3342619847
> *F* + 92 21 35675244
> *E* shafique.rehman@avanzasolutions.com
> *W*
>
> www.avanzasolutions.com
>
>
>
>
> <http://www.facebook.com/avanzasolutionsme>
> <https://twitter.com/avanzasolutions>
> <http://www.linkedin.com/company/avanza-solutions>
> ------------------------------
> *This email and its attachments may be confidential and are intended and
> solely for the use of the individual to whom it is addressed. Any views or
> opinions expressed are solely those of the author and do not necessarily
> represent those of Avanza Solutions. If you are not the intended recipient
> of this email and its attachments, you must take no action based upon them.
> Nor must you copy or show them to anyone. Please contact the sender if you
> believe you have received this email in error.*