Look for startup logs, it is possible that your jar isn't deployed
correctly because some reasons.
Thx, Radu
Chris Pioli wrote:
> I’m running into trouble with my new document type. I am trying to create a
> search UI, and it’s not working properly.
>
> I created a new tab in my new document type, which contains a search prompt.
> All my documents have some space set aside for keywords, and the search UI
> I’m
> designing is going to search all documents and return the documents that have
> the matching keyword. I go to the tab, type in the keyword I want to search
> for, and then I click the “search” button, and then this error appears in the
> browser:
>
> /incl/tabs/my_view.xhtml @22,80 value="#{myFileManager.keyword}": Target
> Unreachable, identifier 'myFileManager' resolved to null
>
> I have a feeling it relates to the connection between the .xhtml file and my
> Bean. Has anyone seen this error before, and how do I solve it?
>
> This was the code for my .xhtml document:
>
> <div xmlns="http://www.w3.org/1999/xhtml"
> xmlns:f="http://java.sun.com/jsf/core"
> xmlns:h="http://java.sun.com/jsf/html">
>
> <h2>Searching for documents by keywords</h2>
>
> <h:messages styleClass="errorMessage" />
>
> <h:form>
> <h:panelGrid columns="3" styleClass="dataInput"
> columnClasses="labelColumn, fieldColumn, fieldColumn">
> <h:outputLabel value="Enter a keyword to search for" />
> <h:inputText id="theKeyword" value="#{myFileManager.keyword}"
> required="true" />
> <h:commandButton type="submit" value="Search" action="#
> {myFileManager.performSearch}" class="button"/>
> <h:message for="theKeyword" styleClass="errorMessage" />
> </h:panelGrid>
> </h:form>
>
> The code for my Bean is below. Please note the fact that I liberally took
> parts of the SearchActionsBean and put them into my class, and I also added
> in
> the search method from the BookManagerBean incase I could use that (I haven't
> done so yet, though).
>
> @Scope(ScopeType.CONVERSATION)
> @Name("myFileManager")
> public class MyFileManagerBean {
> private static final Log log = LogFactory.getLog
> (MyFileManagerBean.class);
>
> private static final String ACTION_PAGE_SEARCH_NXQL
> = "search_results_nxql";
>
> private static final String PROV_NXQL = "SEARCH_BEAN_NXQL_PROVIDER";
>
> private static final String ACTION_PAGE_SEARCH_QUERY_ERROR = null;
>
> private static final String ACTION_PAGE_SEARCH_NO_KEYWORDS = null;
>
> private String queryErrorMsg;
>
> @In(required = false, create = true)
> private transient ResultsProvidersCache resultsProvidersCache;
>
> @In(create = true)
> private transient Context conversationContext;
>
> @PrePassivate
> public void prePassivate() {
> log.debug("prePassivate");
> }
>
> @PostActivate
> public void postActivate() {
> log.debug("postActivate");
> }
>
> @Remove
> @Destroy
> public void destroy() {
> log.debug("destroy");
> }
>
> @In(create = true)
> protected transient NavigationContext navigationContext;
>
> @In(create = true)
> protected transient WebActions webActions;
>
> @In(create = true)
> protected transient CoreSession documentManager;
>
> @In(create = true)
> protected transient FacesMessages facesMessages;
>
> @In(create = true)
> protected transient ResourcesAccessor resourcesAccessor;
>
> private String keyword;
>
> public String getKeyword() {
> if (keyword == null) {
> keyword="";
> }
> return keyword;
> }
>
> public void setKeyword(String t) {
> keyword = t;
> }
>
> public ResultSet getSearchResults() throws Exception {
> SearchService searchService = Framework.getService
> (SearchService.class);
> ComposedNXQuery query = new ComposedNXQueryImpl("SELECT * FROM
> Document WHERE"
> + " ecm:primaryType = 'MyFile'"
>
> + " AND ht:myKeywords = '"
>
> + keyword + "'");
> ResultSet resultSet = searchService.searchQuery(query, 0, 10);
> return resultSet;
> }
>
> public String performSearch() throws ClientException,
> ECInvalidParameterException {
>
> if (log.isDebugEnabled()) {
> log.debug("performing searchType: NXQL");
> }
> try {
> String page;
> PagedDocumentsProvider resultsProvider = null;
> if (tag == null) {
> log.warn("Tagging search: no tag query has
> been provided");
> return ACTION_PAGE_SEARCH_NO_KEYWORDS;
> }
> log.debug("Query: " + "SELECT * FROM Document WHERE"
> + "
> ecm:primaryType = 'MyFile'"
> + " AND
> ht:myKeywords = '" + keyword + "'");
> resultsProvidersCache.invalidate(PROV_NXQL);
> resultsProvider = resultsProvidersCache.get(PROV_NXQL);
> page = ACTION_PAGE_SEARCH_NXQL;
>
> if (resultsProvider instanceof SearchPageProvider) {
> String lastQuery = ((SearchPageProvider)
> resultsProvider).getQuery();
> conversationContext.set("search.lastQuery",
> lastQuery);
> } else {
> conversationContext.set("search.lastQuery",
> null);
> }
>
> return page;
> } catch (SortNotSupportedException e) {
> queryErrorMsg = e.getMessage();
> log.debug("Search error " + e.getMessage(), e);
> return ACTION_PAGE_SEARCH_QUERY_ERROR;
> } catch (ClientException e) {
> // Present to user: we should make the difference
> between
> // QueryException and actual errors (hey, I'm just
> copying what
> // they said)
> queryErrorMsg = e.getMessage();
> log.debug("Search error: " + e.getMessage(), e);
> return ACTION_PAGE_SEARCH_QUERY_ERROR;
> }
> }
> }
>
>
>
>
> _______________________________________________
> ECM mailing list
> [email protected]
> http://lists.nuxeo.com/mailman/listinfo/ecm
_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm