2016-07-23 12 views
1

私はalfrescoのapache-chemistryを使用してテキスト文書を作成しようとしています。私のコードは、文書を作成するためのものであるAlfresco:ストリームがすでに閉じられています

ドキュメントドキュメント= FileUtils.createTextDocument( "/"、 "あるtest.txt"、 "試験文書"、BaseTypeId.CMIS_DOCUMENT.value()、VersioningState.MAJOR、セッション)です。

私は私のコードを実行したときに、私は次の例外

org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionExceptionを取得しています:「http://localhost:8080/alfresco/api/-default-/public/cmis/versions/1.1/atom/children?id=5717e8a0-61b2-4bcb-8a91-2f4b61ebfefa&versioningState=major」にアクセスすることはできません:ストリームがすでに閉じられています! at org.apache.chemistry.opencmis.client.bindings.spi.http.DefaultHttpInvoker.invoke(DefaultHttpInvoker.java:233) at org.apache.chemistry.opencmis.client.bindings.spi.http.DefaultHttpInvoker.invokePOST( (AbstractAttomPubService.java:713) at org.apache.chemistry.opencmis.client.bindings.spi。 atompub.ObjectServiceImpl.createDocument(ObjectServiceImpl.java:122) at org.apache.chemistry.opencmis.client.runtime.SessionImpl.createDocument(SessionImpl.java:1165) at org.apache.chemistry.opencmis.client.runtime。 FolderImpl.createDocument(FolderImpl.java:77) at org.apache.chemistry.opencmis.client.runtime.FolderImpl.createDocument(FolderImpl.java:460)HTTPS:org.apache.chemistry.opencmis.client.util.FileUtils.createTextDocument(FileUtils.java:168)

+0

をお試しください: //chemistry.apache.org/docs/cmis-samples/samples/create-objects/index.html#creating-a-document https://chemistry.apache.org/docs/cmis-samples/samples/content/ index.html –

+0

私の例を試して、私たちにフィードバックを与えてください –

答えて

1

では以下のページをチェックしてください、これは私のためにうまく働いた

public static void main(String args[]) { 
String serverUrl = args[0]; 
String username = args[1]; 
String password = args[2]; 
Session session = getSession(serverUrl, username, password); 
Folder root = session.getRootFolder(); 
Map<String, Object> properties = new HashMap<String, Object>(); 
properties.put(PropertyIds.OBJECT_TYPE_ID, BaseTypeId.CMIS_ 
DOCUMENT.value()); 
String name = "New Document (" + System.currentTimeMillis() + 
").txt"; 
properties.put(PropertyIds.NAME, name); 
List<Ace> addAces = new LinkedList<Ace>(); 
List<Ace> removeAces = new LinkedList<Ace>(); 
List<Policy> policies = new LinkedList<Policy>(); 
String content = "The quick brown fox jumps over the lazy dog."; 
ContentStream contentStream = new ContentStreamImpl("text.txt", 
BigInteger.valueOf(content.length()), 
"text/plain", new ByteArrayInputStream(content. 
getBytes())); 
Document newDocument = root.createDocument(properties, 
contentStream, VersioningState.MAJOR, policies, addAces, removeAces, 
session.getDefaultContext()); 
System.out.println(newDocument.getId()); 
}     
+0

何か問題がありますか?返信は –

+0

thnx、はいコードは正常に実行されています。私は1つの質問を持っています。 Windowsシステムのフォルダや文書のショートカットを作成するのと同じように、アルフレコでは、もう一度 – deen

+0

新しいトピックを開き、私はあなたを助けようとします。「Alfresco:ディレクトリを作成できませんでした。」 –

関連する問題