I've tried Emanuele's method, and also followed some of the instructions found in this post:
http://jackrabbit.510166.n4.nabble.com/Doubt-with-username-and-password-td3173401.html
Nothing worked for me. Neither the jcr tools: SPT JCR Manager, jackrabbitexplorer, Toromiro, JCR Explorer or phpcr-browser.
My Jackrabbit webapp (3.0-SNAPSHOT) is deployed in a tomcat7, with aws as datastore and derby as persistence manager.
After struggling for several hours, the only solution that worked for me was invoking this simple jsp file, previously placed in the web application root:
<%@ page import="org.apache.jackrabbit.api.JackrabbitSession,
org.apache.jackrabbit.api.security.user.Authorizable,
org.apache.jackrabbit.api.security.user.User,
org.apache.jackrabbit.api.security.user.UserManager,
org.apache.jackrabbit.core.TransientRepository,
javax.jcr.Repository,
javax.jcr.Session,
javax.jcr.SimpleCredentials,
java.io.File,
org.apache.jackrabbit.commons.JcrUtils,
org.apache.jackrabbit.j2ee.RepositoryAccessServlet"
%>
<%
Repository repository;
try {
repository = RepositoryAccessServlet.getRepository(pageContext.getServletContext());
Session jackrabbitSession = repository.login(new SimpleCredentials("admin", "oldpass".toCharArray()));
UserManager userManager = ((JackrabbitSession) jackrabbitSession).getUserManager();
Authorizable authorizable = userManager.getAuthorizable("admin");
((User) authorizable).changePassword("newpass");
jackrabbitSession.save();
jackrabbitSession.logout();
} catch (Throwable e) {
%><jsp:forward page="bootstrap/error.jsp"/><%
}
request.setAttribute("title", "Apache Jackrabbit JCR Server");
%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
Although is similar to Emanuele's answer, the only way I could actually change the current admin password was retrieving the repository using org.apache.jackrabbit.j2ee.RepositoryAccessServlet
.