javax.jcr.ItemExistsException when moving node in JCR - aem

I am trying to move the nodes from one path to another & getting the exception :
com.aem.tagmodels.MoveNodes Source is --> /content/dam/geometrixx/portraits/scott_reynolds.jpg
10.12.2014 16:38:27.952 *INFO* [127.0.0.1 [1418209707948] GET /content/AEMProject/Test/jcr:content/par/session_op.html HTTP/1.1] com.aem.tagmodels.MoveNodes Destination is --> /content/dam/geometrixx/drm
10.12.2014 16:38:27.952 *INFO* [127.0.0.1 [1418209707948] GET /content/AEMProject/Test/jcr:content/par/session_op.html HTTP/1.1] com.aem.tagmodels.MoveNodes Session --> session-38784
10.12.2014 16:38:27.952 *ERROR* [127.0.0.1 [1418209707948] GET /content/AEMProject/Test/jcr:content/par/session_op.html HTTP/1.1] com.aem.tagmodels.MoveNodes Error is javax.jcr.ItemExistsException: /content/dam/geometrixx/drm
I have checked there is no node inside drm with the same name as scott_reynolds.jpg . Below is my code snippet.
session.getWorkspace().move(source,destination);
session.save();
Thanks

It seems that you use parent node, /content/dam/geometrixx/drm, as a destination. This destination exists and that's why you are getting the exception, as the move() method expects the complete new path as the second parameter:
Strictly speaking, the destAbsPath parameter is actually an absolute path to the parent node of the new location, appended with the new name desired for the moved node.
(from Javadoc).
You should use full path, parent followed by the new name, for instance: /content/dam/geometrixx/drm/scott_reynolds.jpg.

Related

javax.jcr.nodetype.ConstraintViolationException Mandatory child node jcr:content not found in a new node

When using JcrUtil.createPath to create a folder (directory) in DAM Asset in AEM, an exception is thrown with error OakConstraint0025: /content/dam/upload/Type/99/MBT/front[[nt:file]]: Mandatory child node jcr:content not found in a new node. It may mean that the child jcr:content node needs to be created in the same time with the directory. So I really do not know how to resolve this problem.
// get resource resolver
ResourceResolver resourceResolver = resourceResolverFactory.getResourceResolver(Collections.<String, Object>singletonMap(JcrResourceConstants.AUTHENTICATION_INFO_SESSION, session));
AssetManager assetMgr = resourceResolver.adaptTo(AssetManager.class);
// creating directory in DAM Asset
Node newParentNode = JcrUtil.createPath(splitParentPath, true, "sling:OrderedFolder", "nt:file", session, true);
newParentNode.addNode("jcr:content", "nt:resource");
// moving DAM Asset
assetMgr.moveAsset(fileNode.getPath(), splitParentPath + "/" + newFileName);
I did follow this JCRUtil API https://helpx.adobe.com/experience-manager/6-2/sites/developing/using/reference-materials/javadoc/com/day/cq/commons/jcr/JcrUtil.html#createPath(Node,%20java.lang.String,%20boolean,%20java.lang.String,%20java.lang.String,%20Session,%20boolean), and this How to create a directory on the basis of path in cq5?
Please help !
The problem is the auto save flag to the createPath method is turned on. This will try to commit the nodes to repo even before you have been able to add the jcr:content child node node.
Try to save after the child node has been added
// creating directory in DAM Asset
Node newParentNode = JcrUtil.createPath(splitParentPath, true, "sling:OrderedFolder", "nt:file", session, false);
newParentNode.addNode("jcr:content", "nt:resource");
session.save()

MailKit - FolderCache and deleted folder

I am in a situation where I have two clients (ClientA and ClientB) connected to IMAP server. ClientA is running mailkit. When I delete or move a folder with ClientB, mailkit client is getting error on attempt to open or fetch messages from the deleted folder. Actually, I am getting disconnected from the server when i try to fetch message from a deleted folder(I guess that is the expected behavior from the server), because of that I am trying to detect if the folder I am about to execute command to, still exists.
I see mailkit uses FolderCache and when I use GetFolder method even after I reconnect the client, I am still getting IMailFolder reference for the deleted folder when I use GetFolder(string path) method. To avoid the FolderCache, I am creating a new instance of MailClient each time I am about to synchronize remote folders to avoid having not existing folders in the cache. I would like to know if that is recommended approach in that situation?
UPDATE:
So, I am now using GetSubfolders command and I can see a LIST command is sent to the server. However it seems there is an issue with that command in the following scenario:
ClientB is deleting a folder INBOX.spam.op, ClientA is trying to move folder with path INBOX.spam.op.folder1. What happens is - the server is creating a new folder INBOX.spam.op with Attributes NonExistent. That is the expected server behavior in order to create folder with path INBOX.spam.op.folder1
But see what happens with Mailkit when I used GetSubfolders on INBOX.spam - I am getting an instance of IMailFolder with Name = "op", Attributes = a mix of the new attributes NonExistent and the attributes of the old "op" folder (the folder in the FolderCache). UidValidity should be 0 for NonExistent but it is the same as the UIDValidity of "op" folder in the FolderCache even if the server response is this
C: A00000102 LIST "" "INBOX.spam.%" RETURN (SUBSCRIBED CHILDREN STATUS (UIDVALIDITY))
S: * LIST (\NonExistent \HasChildren) "." INBOX.spam.op
S: A00000102 OK List completed (0.001 + 0.000 secs).
I tried to inherit ImapClient and add my own method GetFolderNoCache(string path) but this doesn't work, because of the internal classes. Any other suggestions?
What you want to do is get the top-level folder from the namespace. Then, using that ImapFolder object, get the list of its children (and so on if you are trying to see if a deeply nested folder).
var toplevel = client.GetFolder (client.PersonalNamespaces[0]);
foreach (var folder in toplevel.GetSubfolders ()) {
// look for the folder you are interested in...
// if it's not here, then the folder has been deleted
}

Cropping does not work in Neos back-end, beta5

Cropping in Neos back-end throws this exception (for Neos beta5):
Uncaught exception #1297759968 in line 271 of /usr/local/www/apache24/data/_sprint2/Data/Temporary/Development/Cache/Code/Flow_Object_Classes/TYPO3_Flow_Mvc_Controller_Argument.php: Exception while property mapping for target type "TYPO3\TYPO3CR\Domain\Model\Node", at property path "": Exception while property mapping for target type "TYPO3\Media\Domain\Model\ImageInterface", at property path "": Could not open stream for resource af0c55f536c860b1d44ce0769f4a1ab52d15b6bd ("company_foldout_short.png") from collection "persistent" while trying to create a temporary local copy. - See also: 20150708145304930495.txt
previousException => Uncaught exception #1297759968 in line 260 of /usr/local/www/apache24/data/_sprint2/Data/Temporary/Development/Cache/Code/Flow_Object_Classes/TYPO3_TYPO3CR_TypeConverter_NodeConverter.php: Exception while property mapping for target type "TYPO3\Media\Domain\Model\ImageInterface", at property path "": Could not open stream for resource af0c55f536c860b1d44ce0769f4a1ab52d15b6bd ("company_foldout_short.png") from collection "persistent" while trying to create a temporary local copy.
Any ideas?
For me it look like a missing original resource, can you try to search if the resource exist first:
ls Data/Persistent/Resources/a/f/0/c/af0c55f536c860b1d44ce0769f4a1ab52d15b6bd
Please try ./flow doctrine:migrate and after that flush the cache.
This should help you.

XML Import Warning: Informatica

I am getting the following warning message while I tried to import XML file in Informatica repository.
Warning: Unexpected condition at: Wcursor.cpp: 305
Contact Informatica technical support for assistance
Continuing may result in damage to your repository.
The XML file is around 70mb and has got around 4500 objects in it. I am migrating an entire application from one server to another.
Not sure why this issue happens. I tried several times and from other client system as well, but no luck.
For importing the XML via command line using "pmrep" command, we need control file. But I dont have any control file for this XML. So cant go with that option.
It would be great if somebody can help me sort out this issue.
Details:
Infa version 9.1
Mounted on Unix environment.
Had the same problem back some time ago. XML parsing takes a lot of memory and / or GUI can't handle it. My solution was to use pmrep command line tool. Worked for me - my workflow was composed of around 3600 objects afair.
If you don't have a control file - create one! Here's a very simple template:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE IMPORTPARAMS SYSTEM "impcntl.dtd">
<!--IMPORTPARAMS This inputs the options and inputs required for import operation -->
<!--CHECKIN_AFTER_IMPORT Check in objects on successful import operation -->
<!--CHECKIN_COMMENTS Check in comments -->
<!--APPLY_LABEL_NAME Apply the given label name on imported objects -->
<!--RETAIN_GENERATED_VALUE Retain existing sequence generator, normalizer and XML DSQ current values in the destination -->
<!--COPY_SAP_PROGRAM Copy SAP program information into the target repository -->
<!--APPLY_DEFAULT_CONNECTION Apply the default connection when a connection used by a session does not exist in the target repository -->
<IMPORTPARAMS CHECKIN_AFTER_IMPORT="YES" CHECKIN_COMMENTS="PMREP_IMPORT_TEST" RETAIN_GENERATED_VALUE="NO" COPY_SAP_PROGRAM="NO" APPLY_DEFAULT_CONNECTION="NO">
<!--FOLDERMAP matches the folders in the imported file with the folders in the target repository -->
<FOLDERMAP SOURCEFOLDERNAME="YOUR FIRST SOURCE FOLDER NAME" SOURCEREPOSITORYNAME="REP_DEV" TARGETFOLDERNAME="YOUR FIRST SOURCE FOLDER NAME" TARGETREPOSITORYNAME="REP_TEST"/>
<FOLDERMAP SOURCEFOLDERNAME="YOUR SECOND TARGET FOLDER NAME" SOURCEREPOSITORYNAME="REP_DEV" TARGETFOLDERNAME="YOUR SECOND TARGET FOLDER NAME" TARGETREPOSITORYNAME="REP_TEST"/>
<!--Import will only import the objects in the selected types in TYPEFILTER node -->
<!--TYPENAME type name to import. This should comforming to the element name in powermart.dtd, e.g. SOURCE, TARGET and etc.-->
<!--RESOLVECONFLICT allows to specify resolution for conflicting objects during import. The combination of specified child nodes can be supplied -->
<RESOLVECONFLICT>
<!--TYPEOBJECT allows objects of certain type to apply replace/reuse upon conflict-->
<!--TYPEOBJECT = ALL conflict resolution for ALL types of objects -->
<TYPEOBJECT OBJECTTYPENAME="ALL" RESOLUTION="REPLACE"/>
<!--SPECIFICOBJECT allows a particular object(name, typename etc.) to apply replace/reuse upon conflict -->
<!--NAME Object name-->
<!--EXTRANAME Source DBD name - required for source object to identify uniquely-->
<!--OBJECTTYPENAME Object type name-->
<!--FOLDERNAME Folder which the object belongs to-->
<!--REPOSITORYNAME Repository name that this object belongs to-->
<!--RESOLUTION Resolution to apply for the object in case of conflict-->
<!--SPECIFICOBJECT NAME="your_object" OBJECTTYPENAME="your_object_type" FOLDERNAME="your_source_folder" REPOSITORYNAME="your_source_repo" RESOLUTION="REPLACE"/-->
</RESOLVECONFLICT>
</IMPORTPARAMS>

OFBiz-11.04 deployment in JBoss-5.1.0

In order to get flexibility in load balancing and clustering, I thought of deploying my OFBiz application in JBoss-5.1.0 as per document (https://cwiki.apache.org/OFBTECH/deploying-ofbiz-904-on-jboss-510.html).
Build was successful and I could see all WAR files in server/default/deploy/OFBiz.ear and other JAR files in lib folder. But I am getting a few issues when starting JBoss server. Please take a look and help me if you have any clues.
Issues:
Could not find definition for entity name EntityKeyStore
......................
Could not find definition for entity name JobSandbox
...................
Entity definitions for EntityKeyStore is located in entitymodel.xml of framework/entity/entitydef folder. I could not find this xml anywhere inside OFBiz.ear. (Not only this XML, none of the entitymodel.xml s are found in ear. But no issue with other entities. I do not know why it is so). I checked my database (server/default/data/derby) and found out ENTITY_KEY_STORE there.
The same is the case for JobSandBox.
After this exception, the server seems to proceed with creating dispatcher for each component and it started with accounting. I am getting another issue here.
Could not get root location for component with name [common], error was: org.ofbiz.base.component.ComponentException: No component found named : common
.....
....
....
---- exception report ----------------------------------------------------------
Error processing include at [component://common/webcommon/WEB-INF/common-controller.xml]:java.net.MalformedURLException: Could not get root location for component with name [common], error was: org.ofbiz.base.component.ComponentException: No component found named : common
Exception: java.net.MalformedURLException
This exception is repeatedly printed in log file. And down the line, the same kind of exception is thrown for other components like commonext, accounting and ecommerce.
After these exceptions "Could not find definition for entity name Tenant" is also thrown.
My OFBiz application uses a multitenant environment. Any help is greatly appreciated.