cancel
Showing results for 
Search instead for 
Did you mean: 

using alfresco-remote in java repository service

mtielemans
Champ in-the-making
Champ in-the-making
I've created an ImporterJobSPI-implementation bean that I registered for use with the QuartzScheduler. In the implementation, I run a lucene query using code from the SDK's 'AlfrescoRemote' packages, mostly org.alfresco.webservice.

On deploying the code as a jar against alfresco, alfresco won't start anymore with the error 'java.lang.ClassNotFoundException: org.alfresco.webservice.util.WebServiceFactory'. If I modify the code in any way, it throws this error simply with the first class used from AlfrescoRemote.

I don't suppose I should deploy the SDKAlfrescoRemote along with my code just to run a lucene query, so I must be missing some config here. Unfortunately, I can't seem to find what I miss exactly.
1 REPLY 1

mtielemans
Champ in-the-making
Champ in-the-making
Resolved: I resorted to using AlfrescoEmbedded packages to run my lucene queries instead:

<java>
public static List<NodeRef> query(final StoreRef store, final String searchQuery) {
        try {
            logger.debug("Search: " + searchQuery);
            final SearchParameters sp = new SearchParameters();
            sp.addStore(store);
            sp.setLanguage(SearchService.LANGUAGE_LUCENE);
            sp.setQuery(searchQuery);
            ResultSet results = null;
            try {
                results = Services.getServiceRegistry().getSearchService().query(sp);
                if(results == null) {
                   logger.debug("No results.");
                   return null;
                }
                List<NodeRef> nodeList = new ArrayList<NodeRef>();
                logger.info("Results found: "+results.length());
                for (ResultSetRow row : results) {
                   NodeRef nodeRef = row.getNodeRef();
                    logger.debug("found row: "+row.getNodeRef().toString());
                    nodeList.add(nodeRef);
                }
                return nodeList;
            } finally {
                if (results != null) {
                    results.close();
                }
            }
        } catch (Exception e) {
            logger.error(e);
        }
        return null;
    }
</java>