I'm trying to create a client for Adobe Experience Manager. To begin with I'm following the Adobe Article: https://helpx.adobe.com/experience-manager/using/java-swing-applications.html.
Followed the instructions, and my pom for this application looks like :
<dependencies><dependency><groupId>org.apache.jackrabbit</groupId><artifactId>jackrabbit-jcr-commons</artifactId><version>2.6.4</version></dependency><dependency><groupId>javax.jcr</groupId><artifactId>jcr</artifactId><version>2.0</version></dependency><dependency><groupId>org.apache.jackrabbit</groupId><artifactId>jackrabbit-core</artifactId><version>1.0</version></dependency><dependency><groupId>javax.jcr</groupId><artifactId>jcr</artifactId><version>1.0</version></dependency><dependency><groupId>org.apache.jackrabbit</groupId><artifactId>jackrabbit-jcr2dav</artifactId><version>2.0-beta6</version></dependency><dependency><groupId>net.sourceforge.jexcelapi</groupId><artifactId>jxl</artifactId><version>2.6.12</version></dependency></dependencies>
Note: 1) jackrabbit-standalone-2.4.5.jar is in class path
2) jackrabbit-jcr2dav is avaliable in maven dependencies.
3) I have started the stand alone jar and is available on localhost:8080
4) Trying to connect to the repository using the url localhost:8080/server
5) I'm able to access this url using browser.
But while starting the application I'm getting the following error :
SLF4J: Found binding in [jar:file:/C:/apps/jackrabbit-standalone/jackrabbit-standalone-2.4.5.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: Found binding in [jar:file:/C:/apps/MAVEN/repo/local/org/slf4j/slf4j-log4j12/1.0/slf4j-log4j12-1.0.jar!/org/slf4j/impl/StaticLoggerBinder.class] SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation. javax.jcr.RepositoryException: Unauthorized at org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConverter.java:120) at org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConverter.java:51) at org.apache.jackrabbit.spi2dav.ExceptionConverter.generate(ExceptionConverter.java:45) at org.apache.jackrabbit.spi2dav.RepositoryServiceImpl.obtain(RepositoryServiceImpl.java:804) at org.apache.jackrabbit.spi2dav.RepositoryServiceImpl.obtain(RepositoryServiceImpl.java:748) at org.apache.jackrabbit.spi2davex.RepositoryServiceImpl.obtain(RepositoryServiceImpl.java:309) at org.apache.jackrabbit.jcr2spi.RepositoryImpl.login(RepositoryImpl.java:151) at org.apache.jackrabbit.commons.AbstractRepository.login(AbstractRepository.java:123) at org.caesars.cq.explorer.FileModel.getRepository(FileModel.java:104) at org.caesars.cq.explorer.FileModel.setFileStats(FileModel.java:81) at org.caesars.cq.explorer.FileModel.<init>(FileModel.java:44) at org.caesars.cq.explorer.FileModel.<init>(FileModel.java:35) at org.caesars.cq.explorer.FileTable.<init>(FileTable.java:37) at org.caesars.cq.explorer.FileTable.main(FileTable.java:119) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) Caused by: org.apache.jackrabbit.webdav.DavException: Unauthorized at org.apache.jackrabbit.webdav.client.methods.DavMethodBase.getResponseException(DavMethodBase.java:165) at org.apache.jackrabbit.webdav.client.methods.DavMethodBase.getResponseBodyAsMultiStatus(DavMethodBase.java:91) at org.apache.jackrabbit.spi2dav.RepositoryServiceImpl.obtain(RepositoryServiceImpl.java:776) ... 15 more
Bit confused with this error. Any help is greatly appreciated.
Thanks in advance.
Solved! Go to Solution.
I got this to work:
Try adding the jackrabbit-standalone-2.6.5.jar to the project's class path.
Also in the FileModel class- make sure you specify the correct user name and password:
//Retrieve member data from the JCR
public List<members> getRepository(String url)
{
try {
String aemUrl = "http://"+url +"/crx/server" ;
//Create a connection to the CQ repository running on local host
Repository repository = JcrUtils.getRepository(aemUrl);
//Allocate memory to the List
memberList = new ArrayList();
//Create a Session
javax.jcr.Session session = repository.login( new SimpleCredentials("admin", "admin".toCharArray()));
This will address the javax.jcr.RepositoryException: Unauthorized exception. I will update the article and put admin/admin.
This article was written back a few years and was for AEM 5.6. At the time - it worked perfectly. I will test now and see what occurs and post back the findings.
I got this to work:
Try adding the jackrabbit-standalone-2.6.5.jar to the project's class path.
Also in the FileModel class- make sure you specify the correct user name and password:
//Retrieve member data from the JCR
public List<members> getRepository(String url)
{
try {
String aemUrl = "http://"+url +"/crx/server" ;
//Create a connection to the CQ repository running on local host
Repository repository = JcrUtils.getRepository(aemUrl);
//Allocate memory to the List
memberList = new ArrayList();
//Create a Session
javax.jcr.Session session = repository.login( new SimpleCredentials("admin", "admin".toCharArray()));
This will address the javax.jcr.RepositoryException: Unauthorized exception. I will update the article and put admin/admin.
Thanks a lot.
Sorry I've taken so long to reply
Will check and update by today.
Views
Replies
Total Likes
smacdonald2008 wrote...
I got this to work:
Try adding the jackrabbit-standalone-2.6.5.jar to the project's class path.
Also in the FileModel class- make sure you specify the correct user name and password:
//Retrieve member data from the JCR
public List<members> getRepository(String url)
{
try {
String aemUrl = "http://"+url +"/crx/server" ;
//Create a connection to the CQ repository running on local host
Repository repository = JcrUtils.getRepository(aemUrl);
//Allocate memory to the List
memberList = new ArrayList();
//Create a Session
javax.jcr.Session session = repository.login( new SimpleCredentials("admin", "admin".toCharArray()));
This will address the javax.jcr.RepositoryException: Unauthorized exception. I will update the article and put admin/admin.
Just tried with the modification.
{ WriteExcel excel = new WriteExcel(); return excel.exportExcel(l) ; } public FileModel(String dir) { setFileStats(-1, "localhost:4502") ; } // Implement the methods of the TableModel interface // Only getRowCount(), getColumnCount() and getValueAt() are // required. The other methods tailor the look of the table. public int getRowCount() { return l.size();} public int getColumnCount() { return titles.length; } public String getColumnName(int c) { return titles[c]; } public Class getColumnClass(int c) { return types[c]; } //Use the List data member to populate the JTable public Object getValueAt(int rowIndex, int columnIndex) { if(columnIndex==0){ return l.get(rowIndex).getNum(); } if(columnIndex==1){ return l.get(rowIndex).getScore(); } else if(columnIndex==2){ return l.get(rowIndex).getName(); } else if(columnIndex==3){ return l.get(rowIndex).getDisplay(); } return null; } // called from the FileTable class public void setFileStats(int stars, String url) { //Set the community score level m_stars = stars ; List<members> theList = getRepository(url); l = theList ; // Just in case anyone's listening... fireTableDataChanged(); } //Retrieve member data from the JCR public List<members> getRepository(String url) { try { String aemUrl = "http://"+url +"/crx/server" ; //Create a connection to the CQ repository running on local host Repository repository = JcrUtils.getRepository(aemUrl); //Allocate memory to the List memberList = new ArrayList(); //Create a Session //javax.jcr.Session session = repository.login( new SimpleCredentials("readonly", "readonly".toCharArray())); javax.jcr.Session session = repository.login( new SimpleCredentials("admin", "admin".toCharArray())); //Obtain the query manager for the session ... javax.jcr.query.QueryManager queryManager = session.getWorkspace().getQueryManager();
I'm getting another exception now.
Exception in thread "main" java.lang.ExceptionInInitializerError at org.caesars.cq.explorer.FileModel.getRepository(FileModel.java:97) at org.caesars.cq.explorer.FileModel.setFileStats(FileModel.java:81) at org.caesars.cq.explorer.FileModel.<init>(FileModel.java:44) at org.caesars.cq.explorer.FileModel.<init>(FileModel.java:35) at org.caesars.cq.explorer.FileTable.<init>(FileTable.java:37) at org.caesars.cq.explorer.FileTable.main(FileTable.java:119) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144) Caused by: java.lang.IllegalArgumentException: unknown type: 10 at javax.jcr.PropertyType.nameFromValue(PropertyType.java:92) at org.apache.jackrabbit.commons.JcrUtils.<clinit>(JcrUtils.java:840) ... 11 more
This is my environment.
1. jackrabbit-standalone-2.6.5.jar in class path
2. AEM 5.6 is running in port 4502 with admin/admin credentials
Views
Replies
Total Likes
Send me an email at scottm@adobe.com. I can setup a session with you to solve this.
Views
Replies
Total Likes
Finally I'm able to execute the the application by adding
<dependency> <groupId>org.apache.jackrabbit</groupId> <artifactId>jackrabbit-core</artifactId> <version>2.6.5</version> </dependency>
in POM, replacing the original 1.0.
But, as the application tries to retrieve "screen_name" and "displayName" I'm getting the following exception.
Connected to the target VM, address: '127.0.0.1:62422', transport: 'socket' javax.jcr.PathNotFoundException: screen_name at org.apache.jackrabbit.jcr2spi.NodeImpl.getProperty(NodeImpl.java:474) at org.caesars.cq.explorer.FileModel.getProfileNode(FileModel.java:178) at org.caesars.cq.explorer.FileModel.getRepository(FileModel.java:128) at org.caesars.cq.explorer.FileModel.setFileStats(FileModel.java:81) at org.caesars.cq.explorer.FileModel.<init>(FileModel.java:44) at org.caesars.cq.explorer.FileModel.<init>(FileModel.java:35) at org.caesars.cq.explorer.FileTable.<init>(FileTable.java:37) at org.caesars.cq.explorer.FileTable.main(FileTable.java:119)
I assume that the the key "screen_name" might got changed in the long run. From where can I found those changes?
Views
Replies
Total Likes
This was code against an old example user JCR schema. I will update the code in the article.
Views
Likes
Replies