Appian Community
Site
Search
Sign In/Register
Site
Search
User
DISCUSS
LEARN
SUCCESS
SUPPORT
Documentation
AppMarket
More
Cancel
I'm looking for ...
State
Not Answered
Replies
9 replies
Subscribers
5 subscribers
Views
3812 views
Users
0 members are here
Share
More
Cancel
Related Discussions
Home
»
Discussions
»
Plug-Ins
Recently we copied our _admin folder and KDBs from other environment to our stag
Mahesh Sanga
over 8 years ago
Recently we copied our _admin folder and KDBs from other environment to our staging/UAT. Since then, while using the smart service "Appian document from Base64 String" we are getting below Alert
The document could not be created. Error: Attempt to write over a file that already exists [fileName = E:\\appian\\_admin\\accdocs2\\8\\10264112.pdf].
Do we need to re import our accdocs folders to fix this issue?
Also can anyone let us know the why this error is occurring?
OriginalPostID-168903
OriginalPostID-168903
Discussion posts and replies are publicly visible
0
Mahesh Sanga
over 8 years ago
* Do we need to copy our accdocs folders again?
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Eduardo Fuentes
Appian Employee
over 8 years ago
There's a relationship between the COLLAB engine and the ACCDOCS folder.
COLLAB has an internal counter to determine the next internal file name when creating a document, in this example, COLLAB knows it has to create a document with the internal file name 10264112.pdf but it turns out that it already exists in the file system, therefore you get the error.
This clearly shows that there's a mismatch between your COLLAB engine and the ACCDOCS folder. Any time you move ENGINES from one server to another you also need to copy _admin
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Mahesh Sanga
over 8 years ago
Thanks for the explanation Eduardo. The issue is we have 200 GB of files to copy so we cant copy ACCDOCS folder at the same time we copied the COLLAB engine.
I think the solution would be to go into ACCDOCS folder and find out the list of files created since the backup and delete them.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Eduardo Fuentes
Appian Employee
over 8 years ago
I think it's more complex than that:
1. Upload the attached file via the Documents tab
2. Search in accdocs for *.mahesh
3. Write down the internal file name this file received
4. That's the current value for the COLLAB counter
5. Anything greater than that can be deleted from disk
test.mahesh
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
malcolmp
over 8 years ago
Eduardo, I have a question that I think is related to what you just described about the relationship between the COLLAB engine and the ACCDOCS folder.
I wrote a plugin for Appian whose purpose was to combine two pdf documents into one document, then put that document in the Appian file system and make it available for download.
The plugin successfully combines the files (I can open the file and view it in Windows explorer) and puts the new file in the Appian file system with the name I gave it, "Merge_Result_Doc", and in windows explorer it also shows up as "Merge_Result_Doc".
When I click on the document download link in the form, however, I get an error 404 web page not found error. And when I click it in the Documents tab in Appian it does not open but I get the following error message in the console:
22:56:36,423 INFO [stdout] (http-/0.0.0.0:8080-8) 2015-09-24 22:56:36,423
[http-/0.0.0.0:8080-8] ERROR com.appiancorp.km.actions.GetDocumentAction - The file for the Document could not be found on the server. (id=2656, path=C:/appian/_admin/accdocs3\\2050\\10001257.pdf)
Also, I noticed that when I delete it in Appian, it does not delete from the local file system (I can still see it in Windows Explorer). One other thing I noticed is that in the Appian file system the file shows up as <1kb in size.
Can you or anyone explain to me what causes this behavior?
Thanks.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Eduardo Fuentes
Appian Employee
over 8 years ago
Are you explicitly overriding the physical name assigned by Appian? That's not going to work. You don't have to do that. Appian stores the display name too in such a way that when you click download the display name is preserved but internally the physical name will be 10001257.pdf. You should never change this name otherwise links in Appian to that document won't work.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
malcolmp
over 8 years ago
Eduardo, thanks for your response. That's actually exactly what I did. I did it because without doing that my internal filename was null, which in turn caused my code to not work. How can I tell Appian to go ahead and set its internal filename and id and then return them to me? I figured out what I could from the public Java API, but for lack of more thorough knowledge on Appian's internal workings this is my code looks:
String mergeResultDocName = "Merge_Result_Doc";
String mergeResultDocExtension = "pdf";
Document mergeResultDoc = new Document(folder, mergeResultDocName, mergeResultDocExtension);
mergeResultDoc.setSize(1);
mergeResultDoc.setFileSystemId(ContentConstants.ALLOCATE_FSID);
mergeResultDoc.setInternalFilename("C:\\\\appian\\\\_admin\\\\accdocs3\\\\2050\\\\" + mergeResultDocName + ".pdf");
mergeResultDoc.setState(ContentConstants.STATE_ACTIVE_PUBLISHED);
Long docId = cs.create(mergeResultDoc, ContentConstants.UNIQUE_FOR_TYPE);
mergeResultDoc.setId(docId);
try {
File destinationFile = new File(mergeResultDoc.getInternalFilename());
FileOutputStream fos = new FileOutputStream(destinationFile, true);
Rectangle size = RectangleFinder.getRectangleSize(inputs);
PdfVeryDenseMergeTool tool = new PdfVeryDenseMergeTool(size, paddingSize, paddingSize, contentGapSize);
tool.merge(fos, inputs);
} catch (Exception e) {
System.out.println("*******There has been an error creating the fileoutput stream and running the merge tool.******");
System.out.println(e);
}
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
Eduardo Fuentes
Appian Employee
over 8 years ago
Thank you for posting the code, with it, I can now see where the problem is.
Take a look at this Shared Component for an example on how to merge documents and create a new one
forum.appian.com/.../summary
In particular, you should review
<PLUG_IN_JAR>\\src\\com\\appiancorp\\ps\\pdftools\\AbstractPDFDocumentGeneration.createDocument
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel
0
malcolmp
over 8 years ago
Thank you very much Eduardo. I will take a look at that.
Cancel
Vote Up
0
Vote Down
Sign in to reply
Verify Answer
Cancel