You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by Martin Perez <mp...@gmail.com> on 2005/10/14 18:53:03 UTC

Unknown language: XPath

I'm getting that exception when running:

Workspace workspace = session.getWorkspace();
QueryManager queryManager = workspace.getQueryManager();
javax.jcr.query.Query query =
queryManager.createQuery(statement,javax.jcr.query.Query.XPATH);

javax.jcr.query.InvalidQueryException: Unsupported language: xpath
at
org.apache.jackrabbit.core.query.QueryTreeBuilderRegistry.getQueryTreeBuilder
(QueryTreeBuilderRegistry.java:69)
....

Looking at jackrabbit source code, it seems that the line Iterator it =
ServiceRegistry.lookupProviders(QueryTreeBuilder.class); in
QueryTreeBuilderRegistry class is unable to load any BUILDERS.

What I'm missing? Do I have to touch any configuration file to add XPath
support?

Thanks.

Martin

Re: Unknown language: XPath

Posted by Marcel Reutegger <ma...@gmx.net>.
Hi Srinu,

can you please create a jira issue and specify the tomcat version you 
are using and also how you deployed jackrabbit? as a resource or 
embedded with your web application?

thanks

regards
  marcel

srinivas reddy wrote:
> Hi,
> 
> I am having the same problem. I m using the latest jcr jar. In tomcat it is 
> showing in META-INF/services/
> 
> # Copyright 2004-2005 The Apache Software Foundation or its licensors,
> #                     as applicable.
> #
> # Licensed under the Apache License, Version 2.0 (the "License");
> # you may not use this file except in compliance with the License.
> # You may obtain a copy of the License at
> #
> #      http://www.apache.org/licenses/LICENSE-2.0
> #
> # Unless required by applicable law or agreed to in writing, software
> # distributed under the License is distributed on an "AS IS" BASIS,
> # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> # See the License for the specific language governing permissions and
> # limitations under the License.
> 
> #
> # This file lists all available query language implementations that are shipped
> # with Jackrabbit.
> #
> 
> org.apache.jackrabbit.core.query.xpath.QueryBuilder
> org.apache.jackrabbit.core.query.sql.QueryBuilder
> 
> ------------------
> 
> 
> But when i execute the same query in standalone it is working fine. Can u help 
> me in this ...
> 
> This is the java file i m using to fetch the content
> 
>   public static void fetchAllContent()
>     {
>         try{
>             Repository repository =
>             new TransientRepository(CONFIG_FILE, DIRECTORY);
>             
>             // Login to the default workspace as a dummy user
>             Session session = repository.login(new SimpleCredentials
> ("anonymousId", "anonymous".toCharArray()));
>             
>             // Use the root node as a starting point
>             Node root = session.getRootNode();
>             Workspace ws = session.getWorkspace();
>             QueryManager qm = ws.getQueryManager();
>             
>             //Specify a query using the XPATH query language 
>             Query q =qm.createQuery("//content", Query.XPATH);
>             QueryResult res = q.execute();
>             
>             //Obtain a node iterator
>             NodeIterator it = res.getNodes();
>             
>             while (it.hasNext()) {
>                 
>                 Node n = it.nextNode();
>                 //Property prop = n.getProperty("blogtitle");
>                 PropertyIterator iter=n.getProperties();
>                 
>                 while(iter.hasNext()){
>                     Property prop=iter.nextProperty();
>                     System.out.println(prop.getString());
>                 }
>             }
>             
>             session.logout();
>         } catch (Exception e) {
>             e.printStackTrace();
>         }
> 
> 
> Thanks in advance.
> srinu.
> 
> 
> 
> 
> 



Re: Unknown language: XPath

Posted by srinivas reddy <sr...@yahoo.com>.

Martin Perez <mpermar <at> gmail.com> writes:

> 
> Marcel I built jackrabbit just now, and .........
> ...
> ...
> 
> it worked !
> 
> So, no need to worry :)
> 
> Thanks for your help.
> 
> Martin
> 
> On 10/18/05, Martin Perez <mpermar <at> gmail.com> wrote:
> >
> > Marcel, then I'll build jackrabbit again just today. I'm using a jar file
> > from two weeks ago. I'll send another messages with the result.
> >
> > Thanks!
> >
> > Martin
> >
> > On 10/18/05, Marcel Reutegger <marcel.reutegger <at> gmx.net> wrote:
> > >
> > > Hi Martin,
> > >
> > > Martin Perez wrote:
> > > > I have looked inside the jar file and it contains:
> > > >
> > > > META-INF
> > > > META-INF/services
> > > > META-INF/services/org.apache.jackrabbit.core.query.QueryTreeBuilder
> > > > META-INF/services/org.apache.jackrabbit.core.query.TextFilterService
> > > >
> > > > The contents of QueryTreeBuilder file lists:
> > > >
> > > > #
> > > > # This file lists all available query language implementations that
> > > are
> > > > shipped
> > > > # with Jackrabbit.
> > > > #
> > > > org.apache.jackrabbit.core.query.xpath.QueryBuilder
> > > > org.apache.jackrabbit.core.query.sql.QueryBuilder
> > > >
> > > > So it seems that all is ok.
> > > >
> > > > I don't know where can be the bug. Maybe it could be that I'm
> > > developing an
> > > > Eclipse RCP application and Eclipse has its own custom classloader, so
> > > it
> > > > could be some classloader related issue.
> > > >
> > > > Any suggestions? Is there any other way to specify the languages
> > > without
> > > > using that ServiceRegistry? Anyone knows why I can't search?
> > >
> > > using the service registry is the only way to register query languages.
> > > Some time ago, I had a similar problem when I deployed two jackrabbit
> > > instances in the same jvm. A fix for the QueryTreeBuilderRegistry solved
> > > the issue. the svn revision for that change is: 312874
> > >
> > > Your initial mail indicates that you are using an older version, though.
> > >
> > >
> > > If you know you are using a more recent revision to build your jar file
> > > then I probably have to change the dynamic loading of QueryBuilder
> > > (again) :-/
> > >
> > > regards
> > > marcel
> > >
> >
> >
> 



Hi,

I am having the same problem. I m using the latest jcr jar. In tomcat it is 
showing in META-INF/services/

# Copyright 2004-2005 The Apache Software Foundation or its licensors,
#                     as applicable.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#
# This file lists all available query language implementations that are shipped
# with Jackrabbit.
#

org.apache.jackrabbit.core.query.xpath.QueryBuilder
org.apache.jackrabbit.core.query.sql.QueryBuilder

------------------


But when i execute the same query in standalone it is working fine. Can u help 
me in this ...

This is the java file i m using to fetch the content

  public static void fetchAllContent()
    {
        try{
            Repository repository =
            new TransientRepository(CONFIG_FILE, DIRECTORY);
            
            // Login to the default workspace as a dummy user
            Session session = repository.login(new SimpleCredentials
("anonymousId", "anonymous".toCharArray()));
            
            // Use the root node as a starting point
            Node root = session.getRootNode();
            Workspace ws = session.getWorkspace();
            QueryManager qm = ws.getQueryManager();
            
            //Specify a query using the XPATH query language 
            Query q =qm.createQuery("//content", Query.XPATH);
            QueryResult res = q.execute();
            
            //Obtain a node iterator
            NodeIterator it = res.getNodes();
            
            while (it.hasNext()) {
                
                Node n = it.nextNode();
                //Property prop = n.getProperty("blogtitle");
                PropertyIterator iter=n.getProperties();
                
                while(iter.hasNext()){
                    Property prop=iter.nextProperty();
                    System.out.println(prop.getString());
                }
            }
            
            session.logout();
        } catch (Exception e) {
            e.printStackTrace();
        }


Thanks in advance.
srinu.





Re: Unknown language: XPath

Posted by Martin Perez <mp...@gmail.com>.
Marcel I built jackrabbit just now, and .........
...
...

it worked !

So, no need to worry :)

Thanks for your help.

Martin

On 10/18/05, Martin Perez <mp...@gmail.com> wrote:
>
> Marcel, then I'll build jackrabbit again just today. I'm using a jar file
> from two weeks ago. I'll send another messages with the result.
>
> Thanks!
>
> Martin
>
> On 10/18/05, Marcel Reutegger <ma...@gmx.net> wrote:
> >
> > Hi Martin,
> >
> > Martin Perez wrote:
> > > I have looked inside the jar file and it contains:
> > >
> > > META-INF
> > > META-INF/services
> > > META-INF/services/org.apache.jackrabbit.core.query.QueryTreeBuilder
> > > META-INF/services/org.apache.jackrabbit.core.query.TextFilterService
> > >
> > > The contents of QueryTreeBuilder file lists:
> > >
> > > #
> > > # This file lists all available query language implementations that
> > are
> > > shipped
> > > # with Jackrabbit.
> > > #
> > > org.apache.jackrabbit.core.query.xpath.QueryBuilder
> > > org.apache.jackrabbit.core.query.sql.QueryBuilder
> > >
> > > So it seems that all is ok.
> > >
> > > I don't know where can be the bug. Maybe it could be that I'm
> > developing an
> > > Eclipse RCP application and Eclipse has its own custom classloader, so
> > it
> > > could be some classloader related issue.
> > >
> > > Any suggestions? Is there any other way to specify the languages
> > without
> > > using that ServiceRegistry? Anyone knows why I can't search?
> >
> > using the service registry is the only way to register query languages.
> > Some time ago, I had a similar problem when I deployed two jackrabbit
> > instances in the same jvm. A fix for the QueryTreeBuilderRegistry solved
> > the issue. the svn revision for that change is: 312874
> >
> > Your initial mail indicates that you are using an older version, though.
> >
> >
> > If you know you are using a more recent revision to build your jar file
> > then I probably have to change the dynamic loading of QueryBuilder
> > (again) :-/
> >
> > regards
> > marcel
> >
>
>

Re: Unknown language: XPath

Posted by Martin Perez <mp...@gmail.com>.
Marcel, then I'll build jackrabbit again just today. I'm using a jar file
from two weeks ago. I'll send another messages with the result.

Thanks!

Martin

On 10/18/05, Marcel Reutegger <ma...@gmx.net> wrote:
>
> Hi Martin,
>
> Martin Perez wrote:
> > I have looked inside the jar file and it contains:
> >
> > META-INF
> > META-INF/services
> > META-INF/services/org.apache.jackrabbit.core.query.QueryTreeBuilder
> > META-INF/services/org.apache.jackrabbit.core.query.TextFilterService
> >
> > The contents of QueryTreeBuilder file lists:
> >
> > #
> > # This file lists all available query language implementations that are
> > shipped
> > # with Jackrabbit.
> > #
> > org.apache.jackrabbit.core.query.xpath.QueryBuilder
> > org.apache.jackrabbit.core.query.sql.QueryBuilder
> >
> > So it seems that all is ok.
> >
> > I don't know where can be the bug. Maybe it could be that I'm developing
> an
> > Eclipse RCP application and Eclipse has its own custom classloader, so
> it
> > could be some classloader related issue.
> >
> > Any suggestions? Is there any other way to specify the languages without
> > using that ServiceRegistry? Anyone knows why I can't search?
>
> using the service registry is the only way to register query languages.
> Some time ago, I had a similar problem when I deployed two jackrabbit
> instances in the same jvm. A fix for the QueryTreeBuilderRegistry solved
> the issue. the svn revision for that change is: 312874
>
> Your initial mail indicates that you are using an older version, though.
>
> If you know you are using a more recent revision to build your jar file
> then I probably have to change the dynamic loading of QueryBuilder
> (again) :-/
>
> regards
> marcel
>

Re: Unknown language: XPath

Posted by Marcel Reutegger <ma...@gmx.net>.
Hi Martin,

Martin Perez wrote:
> I have looked inside the jar file and it contains:
> 
> META-INF
> META-INF/services
> META-INF/services/org.apache.jackrabbit.core.query.QueryTreeBuilder
> META-INF/services/org.apache.jackrabbit.core.query.TextFilterService
> 
> The contents of QueryTreeBuilder file lists:
> 
> #
> # This file lists all available query language implementations that are
> shipped
> # with Jackrabbit.
> #
> org.apache.jackrabbit.core.query.xpath.QueryBuilder
> org.apache.jackrabbit.core.query.sql.QueryBuilder
> 
> So it seems that all is ok.
> 
> I don't know where can be the bug. Maybe it could be that I'm developing an
> Eclipse RCP application and Eclipse has its own custom classloader, so it
> could be some classloader related issue.
> 
> Any suggestions? Is there any other way to specify the languages without
> using that ServiceRegistry? Anyone knows why I can't search?

using the service registry is the only way to register query languages. 
Some time ago, I had a similar problem when I deployed two jackrabbit 
instances in the same jvm. A fix for the QueryTreeBuilderRegistry solved 
the issue. the svn revision for that change is: 312874

Your initial mail indicates that you are using an older version, though.

If you know you are using a more recent revision to build your jar file 
then I probably have to change the dynamic loading of QueryBuilder 
(again) :-/

regards
  marcel

Re: Unknown language: XPath

Posted by Martin Perez <mp...@gmail.com>.
I have looked inside the jar file and it contains:

META-INF
META-INF/services
META-INF/services/org.apache.jackrabbit.core.query.QueryTreeBuilder
META-INF/services/org.apache.jackrabbit.core.query.TextFilterService

The contents of QueryTreeBuilder file lists:

#
# This file lists all available query language implementations that are
shipped
# with Jackrabbit.
#
org.apache.jackrabbit.core.query.xpath.QueryBuilder
org.apache.jackrabbit.core.query.sql.QueryBuilder

So it seems that all is ok.

I don't know where can be the bug. Maybe it could be that I'm developing an
Eclipse RCP application and Eclipse has its own custom classloader, so it
could be some classloader related issue.

Any suggestions? Is there any other way to specify the languages without
using that ServiceRegistry? Anyone knows why I can't search?

Thanks again.

Martin

On 10/17/05, Marcel Reutegger <ma...@gmail.com> wrote:
>
> please make sure that the new file
> META-INF/services/org.apache.jackrabbit.core.query.QueryTreeBuilder is
> included in the jar file when you build jackrabbit.
>
> if you are using an up-to-date revision of the project.xml, maven should
> take care of that.
>
> regards
> marcel
>
> Martin Perez wrote:
> > I'm getting that exception when running:
> >
> > Workspace workspace = session.getWorkspace();
> > QueryManager queryManager = workspace.getQueryManager();
> > javax.jcr.query.Query query =
> > queryManager.createQuery(statement,javax.jcr.query.Query.XPATH);
> >
> > javax.jcr.query.InvalidQueryException: Unsupported language: xpath
> > at
> >
> org.apache.jackrabbit.core.query.QueryTreeBuilderRegistry.getQueryTreeBuilder
> > (QueryTreeBuilderRegistry.java:69)
> > ....
> >
> > Looking at jackrabbit source code, it seems that the line Iterator it =
> > ServiceRegistry.lookupProviders(QueryTreeBuilder.class); in
> > QueryTreeBuilderRegistry class is unable to load any BUILDERS.
> >
> > What I'm missing? Do I have to touch any configuration file to add XPath
> > support?
> >
> > Thanks.
> >
> > Martin
> >
>

Re: Unknown language: XPath

Posted by Marcel Reutegger <ma...@gmail.com>.
please make sure that the new file 
META-INF/services/org.apache.jackrabbit.core.query.QueryTreeBuilder is 
included in the jar file when you build jackrabbit.

if you are using an up-to-date revision of the project.xml, maven should 
take care of that.

regards
  marcel

Martin Perez wrote:
> I'm getting that exception when running:
> 
> Workspace workspace = session.getWorkspace();
> QueryManager queryManager = workspace.getQueryManager();
> javax.jcr.query.Query query =
> queryManager.createQuery(statement,javax.jcr.query.Query.XPATH);
> 
> javax.jcr.query.InvalidQueryException: Unsupported language: xpath
> at
> org.apache.jackrabbit.core.query.QueryTreeBuilderRegistry.getQueryTreeBuilder
> (QueryTreeBuilderRegistry.java:69)
> ....
> 
> Looking at jackrabbit source code, it seems that the line Iterator it =
> ServiceRegistry.lookupProviders(QueryTreeBuilder.class); in
> QueryTreeBuilderRegistry class is unable to load any BUILDERS.
> 
> What I'm missing? Do I have to touch any configuration file to add XPath
> support?
> 
> Thanks.
> 
> Martin
>