Hello all!
I've been trying to upload packages into CQ5 via Java, based on the documented curl commands at http://dev.day.com/docs/en/crx/current/how_to/package_manager.html, but I've hit a strange issue when trying to upload packages to publish instances. The reason I'm uploading to the publisher directly is because the package only contains ACL nodes, and these do not seem to replicate from author to publisher (from everything that I've read and tried).
I'm using the older /crx/packmgr/service.jsp method in my Java - I know that this is outdated, but it gives me a better debug output of what goes wrong than the /crx/packmgr/service/.json/?cmd=upload method. I get the same failures with the newer json methos as well.
When I run my code specifying "author", I get the following response, and the package has uploaded successfully:
<crx version="2.3.15" user="admin" workspace="crx.default">
<request>
<param name="file" value="author_package.zip"/>
<param name="name" value="author_packagename"/>
</request>
<response>
<data>
<package>
<group></group>
<name>author_packagename</name>
<version>0.01</version>
<downloadName>author_package.zip</downloadName>
<size>1754056</size>
<created></created>
<createdBy>admin</createdBy>
<lastModified></lastModified>
<lastModifiedBy>admin</lastModifiedBy>
<lastUnpacked></lastUnpacked>
<lastUnpackedBy>null</lastUnpackedBy>
</package>
</data>
<status code="200">ok</status>
</response>
</crx>
If I run the following curl command, I get the exact same response as my Java, so I'm happy that the Java is correct and working:
curl -u admin:admin -F file=@author_package.zip -F name=author_packagename http://127.0.0.1:4504/crx/packmgr/service.jsp
If I run my Java code specifying "publisher", I get the following response, and the package does not upload:
<crx version="2.3.15" user="anonymous" workspace="crx.default">
<request>
<param name="file" value="publisher_package.zip"/>
<param name="name" value="publisher_packagename"/>
</request>
<response>
<status code="500">javax.jcr.ItemExistsException: This node already exists: /etc/packages</status>
</response>
</crx>
Trying the equivelant curl command, I get the following response, and the package has uploaded:
curl -u admin:admin -F file=@publisher_package.zip -F name=publisher_packagename http://127.0.0.1:4505/crx/packmgr/service.jsp
<crx version="2.3.15" user="admin" workspace="crx.default">
<request>
<param name="file" value="publisher_package.zip"/>
<param name="name" value="publisher_packagename"/>
</request>
<response>
<data>
<package>
<group></group>
<name>publisher_packagename</name>
<version>0.99</version>
<downloadName>publisher_package.zip</downloadName>
<size>12890709</size>
<created></created>
<createdBy>null</createdBy>
<lastModified></lastModified>
<lastModifiedBy>null</lastModifiedBy>
<lastUnpacked></lastUnpacked>
<lastUnpackedBy>null</lastUnpackedBy>
</package>
</data>
<status code="200">ok</status>
</response>
</crx>
If I take away the -u parameter of the successful curl command, I get the following response, which is the same as my "publisher" Java response:
curl -F file=@publisher_package.zip -F name=publisher_packagename http://127.0.0.1:4505/crx/packmgr/service.jsp
<crx version="2.3.15" user="anonymous" workspace="crx.default">
<request>
<param name="file" value="publisher_package.zip"/>
<param name="name" value="publisher_packagename"/>
</request>
<response>
<status code="500">javax.jcr.ItemExistsException: This node already exists: /etc/packages</status>
</response>
</crx>
So....
Does anyone know if a publish instance deals with authentication in a different way from an author instance? The Java code does not change, but the results are different depending on the type of server I'm trying to upload to. The fact that the Java "publish" upload reports back as being an anonymous user (which I replicated with the last curl call), but uses the same code as the successful (and authorised) "author" upload besides the package details and port, leads me to believe that it's the CQ5 server that is turning this into an anonymous call.
Anyone have any thoughts on what might be happening here, and the best way to solve it?
Cheers,
K