jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "tingup" <tin...@gmail.com>
Subject jackrabbit 1.6.2 import/export
Date Mon, 12 Jul 2010 15:30:53 GMT
Hi everyone,

my export/import method as follow:

    /**
     * 
     * @param path node path
     * @param xmlfileName xml file name eg:"systemview.xml"
     */
    public void exportData(final String path, final String xmlfileName){
        jcrTemplate.execute(new JcrCallback(){
            public Object doInJcr(Session session) throws IOException,
                    RepositoryException {
                File outputFile = new File(xmlfileName);
                FileOutputStream out = new FileOutputStream(outputFile);
                session.exportSystemView(CMSUtil.normalizedPath(path), out, false, false);
                return null;
            }
        });
    }

    /**
     * 
     * @param path node path
     * @param xmlfileName xml file name eg:"systemview.xml"
     */
    public void importData(final String path, final String xmlfileName){
        jcrTemplate.execute(new JcrCallback(){
            public Object doInJcr(Session session) throws IOException,
                    RepositoryException {
                File inputFile = new File(xmlfileName);
                FileInputStream in = new FileInputStream(inputFile);
                session.importXML
                         (CMSUtil.normalizedPath(path), in, ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);
                return null;
            }
        });
        jcrTemplate.save();
    }

I do exportData("/","file.xml"), then changed the repository.xml of jackrabbit 1.6.2, (add
datastore, change org.apache.jackrabbit.core.persistence.db.SimpleDbPersistenceManager to
org.apache.jackrabbit.core.persistence.bundle.MySqlPersistenceManager ) and drop the db tables
jackrabbit use,( also the workspace.xml in repo home directory). and I got follow error info
when i importData("/", "file.xml").

org.springframework.dao.DataIntegrityViolationException: Constraint has been violated; nested
exception is javax.jcr.nodetype.ConstraintViolationException: Unable to perform operation.
Node is protected.
at org.springmodules.jcr.SessionFactoryUtils.translateException(SessionFactoryUtils.java:182)
at org.springmodules.jcr.JcrAccessor.convertJcrAccessException(JcrAccessor.java:58)
at org.springmodules.jcr.JcrTemplate.execute(JcrTemplate.java:82)
at org.springmodules.jcr.JcrTemplate.execute(JcrTemplate.java:108)
at com.tingup.cms.service.impl.JcrNodeServiceOcmImpl.importData(JcrNodeServiceOcmImpl.java:101)
[..............................]
Caused by: javax.jcr.nodetype.ConstraintViolationException: Unable to perform operation. Node
is protected.
at org.apache.jackrabbit.core.ItemValidator.checkCondition(ItemValidator.java:300)
at org.apache.jackrabbit.core.ItemValidator.checkModify(ItemValidator.java:274)
at org.apache.jackrabbit.core.NodeImpl.internalAddChildNode(NodeImpl.java:805)
at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:1646)
at org.apache.jackrabbit.core.xml.SessionImporter.createNode(SessionImporter.java:95)
at org.apache.jackrabbit.core.xml.SessionImporter.startNode(SessionImporter.java:230)
at org.apache.jackrabbit.core.xml.SysViewImportHandler.processNode(SysViewImportHandler.java:86)
at org.apache.jackrabbit.core.xml.SysViewImportHandler.startElement(SysViewImportHandler.java:127)
at org.apache.jackrabbit.core.xml.ImportHandler.startElement(ImportHandler.java:166)
at org.apache.jackrabbit.commons.xml.DefaultContentHandler.startElement(DefaultContentHandler.java:162)
[..............................]


I also tried create a new node "/test" in the jackrabbit root node, and importData("/test",
"file.xml"). get the follow error:
2010-07-12 23:27:06,019 [http-8080-1] ERROR com.tingup.cms.portlet.CmsImportExportPortlet
- Constraint has been violated; nested exception is javax.jcr.nodetype.ConstraintViolationException:
no definition found in parent node's node type for new node: no matching child node definition
found for {http://www.jcp.org/jcr/1.0}root: no matching child node definition found for {http://www.jcp.org/jcr/1.0}root
org.springframework.dao.DataIntegrityViolationException: Constraint has been violated; nested
exception is javax.jcr.nodetype.ConstraintViolationException: no definition found in parent
node's node type for new node: no matching child node definition found for {http://www.jcp.org/jcr/1.0}root:
no matching child node definition found for {http://www.jcp.org/jcr/1.0}root
at org.springmodules.jcr.SessionFactoryUtils.translateException(SessionFactoryUtils.java:182)
at org.springmodules.jcr.JcrAccessor.convertJcrAccessException(JcrAccessor.java:58)
at org.springmodules.jcr.JcrTemplate.execute(JcrTemplate.java:82)
at org.springmodules.jcr.JcrTemplate.execute(JcrTemplate.java:108)
at com.tingup.cms.service.impl.JcrNodeServiceOcmImpl.importData(JcrNodeServiceOcmImpl.java:101)
[..................................]
Caused by: javax.jcr.nodetype.ConstraintViolationException: no definition found in parent
node's node type for new node: no matching child node definition found for {http://www.jcp.org/jcr/1.0}root:
no matching child node definition found for {http://www.jcp.org/jcr/1.0}root
at org.apache.jackrabbit.core.NodeImpl.internalAddChildNode(NodeImpl.java:775)
at org.apache.jackrabbit.core.NodeImpl.addNode(NodeImpl.java:1646)
at org.apache.jackrabbit.core.xml.SessionImporter.createNode(SessionImporter.java:95)
at org.apache.jackrabbit.core.xml.SessionImporter.startNode(SessionImporter.java:230)
at org.apache.jackrabbit.core.xml.SysViewImportHandler.processNode(SysViewImportHandler.java:86)
at org.apache.jackrabbit.core.xml.SysViewImportHandler.startElement(SysViewImportHandler.java:127)
at org.apache.jackrabbit.core.xml.ImportHandler.startElement(ImportHandler.java:166)
at org.apache.jackrabbit.commons.xml.DefaultContentHandler.startElement(DefaultContentHandler.java:162)
[..................................]
Caused by: javax.jcr.nodetype.ConstraintViolationException: no matching child node definition
found for {http://www.jcp.org/jcr/1.0}root
at org.apache.jackrabbit.core.nodetype.EffectiveNodeType.getApplicableChildNodeDef(EffectiveNodeType.java:732)
at org.apache.jackrabbit.core.NodeImpl.getApplicableChildNodeDefinition(NodeImpl.java:886)
at org.apache.jackrabbit.core.NodeImpl.internalAddChildNode(NodeImpl.java:771)
... 117 more


Help me! thanks very much.

Regards, 
tingup 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message