Ok, sorry; i'm trying to use query and queryFactory classes of jena in my
code in this way:


            String que=getConf().get("ARQ.query"); //ARQ in a string
parameter in input (the query, for example SELECT *)
            System.out.println("request to process query : "+que);
            Query query = QueryFactory.create(que);

in the third line i got error....

i used maven to create my project and i wrote a pom with dependencies; this
is the cut of my pom:

    <dependencies>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-core</artifactId>
            <version>1.2.1</version>
        </dependency>
            <dependency>
            <groupId>org.apache.giraph</groupId>
            <artifactId>giraph-core</artifactId>
            <version>1.1.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.jena</groupId>
            <artifactId>jena-arq</artifactId>
        <version>2.12.0-SNAPSHOT</version>
        </dependency>
    </dependencies>


this is the dependency tree:

[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ sisinflab ---
[INFO] sisinflab:sisinflab:jar:1.0-SNAPSHOT
[INFO] +- org.apache.hadoop:hadoop-core:jar:1.2.1:compile
[INFO] |  +- commons-cli:commons-cli:jar:1.2:compile
[INFO] |  +- xmlenc:xmlenc:jar:0.52:compile
[INFO] |  +- com.sun.jersey:jersey-core:jar:1.8:compile
[INFO] |  +- com.sun.jersey:jersey-json:jar:1.8:compile
[INFO] |  |  +- org.codehaus.jettison:jettison:jar:1.1:compile
[INFO] |  |  |  \- stax:stax-api:jar:1.0.1:compile
[INFO] |  |  +- com.sun.xml.bind:jaxb-impl:jar:2.2.3-1:compile
[INFO] |  |  |  \- javax.xml.bind:jaxb-api:jar:2.2.2:compile
[INFO] |  |  |     +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] |  |  |     \- javax.activation:activation:jar:1.1:compile
[INFO] |  |  +- org.codehaus.jackson:jackson-core-asl:jar:1.7.1:compile
[INFO] |  |  +- org.codehaus.jackson:jackson-jaxrs:jar:1.7.1:compile
[INFO] |  |  \- org.codehaus.jackson:jackson-xc:jar:1.7.1:compile
[INFO] |  +- com.sun.jersey:jersey-server:jar:1.8:compile
[INFO] |  |  \- asm:asm:jar:3.1:compile
[INFO] |  +- commons-io:commons-io:jar:2.1:compile
[INFO] |  +- commons-httpclient:commons-httpclient:jar:3.0.1:compile
[INFO] |  |  +- junit:junit:jar:3.8.1:compile
[INFO] |  |  \- commons-logging:commons-logging:jar:1.0.3:compile
[INFO] |  +- commons-codec:commons-codec:jar:1.4:compile
[INFO] |  +- org.apache.commons:commons-math:jar:2.1:compile
[INFO] |  +- commons-configuration:commons-configuration:jar:1.6:compile
[INFO] |  |  +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] |  |  +- commons-lang:commons-lang:jar:2.4:compile
[INFO] |  |  +- commons-digester:commons-digester:jar:1.8:compile
[INFO] |  |  |  \- commons-beanutils:commons-beanutils:jar:1.7.0:compile
[INFO] |  |  \- commons-beanutils:commons-beanutils-core:jar:1.8.0:compile
[INFO] |  +- commons-net:commons-net:jar:1.4.1:compile
[INFO] |  +- org.mortbay.jetty:jetty:jar:6.1.26:compile
[INFO] |  |  \- org.mortbay.jetty:servlet-api:jar:2.5-20081211:compile
[INFO] |  +- org.mortbay.jetty:jetty-util:jar:6.1.26:compile
[INFO] |  +- tomcat:jasper-runtime:jar:5.5.12:compile
[INFO] |  +- tomcat:jasper-compiler:jar:5.5.12:compile
[INFO] |  +- org.mortbay.jetty:jsp-api-2.1:jar:6.1.14:compile
[INFO] |  |  \- org.mortbay.jetty:servlet-api-2.5:jar:6.1.14:compile
[INFO] |  +- org.mortbay.jetty:jsp-2.1:jar:6.1.14:compile
[INFO] |  |  \- ant:ant:jar:1.6.5:compile
[INFO] |  +- commons-el:commons-el:jar:1.0:compile
[INFO] |  +- net.java.dev.jets3t:jets3t:jar:0.6.1:compile
[INFO] |  +- hsqldb:hsqldb:jar:1.8.0.10:compile
[INFO] |  +- oro:oro:jar:2.0.8:compile
[INFO] |  +- org.eclipse.jdt:core:jar:3.1.1:compile
[INFO] |  \- org.codehaus.jackson:jackson-mapper-asl:jar:1.8.8:compile
[INFO] +- org.apache.giraph:giraph-core:jar:1.1.0:compile
[INFO] \- org.apache.jena:jena-arq:jar:2.12.0-SNAPSHOT:compile
[INFO]    +- org.apache.jena:jena-core:jar:2.12.0-SNAPSHOT:compile
[INFO]    |  +- org.apache.jena:jena-iri:jar:1.1.0-SNAPSHOT:compile
[INFO]    |  \- xerces:xercesImpl:jar:2.11.0:compile
[INFO]    |     \- xml-apis:xml-apis:jar:1.4.01:compile
[INFO]    +- org.apache.httpcomponents:httpclient:jar:4.2.6:compile
[INFO]    |  \- org.apache.httpcomponents:httpcore:jar:4.2.5:compile
[INFO]    +- com.github.jsonld-java:jsonld-java:jar:0.5.0:compile
[INFO]    |  +- com.fasterxml.jackson.core:jackson-core:jar:2.3.3:compile
[INFO]    |  \-
com.fasterxml.jackson.core:jackson-databind:jar:2.3.3:compile
[INFO]    |     \-
com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0:compile
[INFO]    +- org.apache.httpcomponents:httpclient-cache:jar:4.2.6:compile
[INFO]    +- org.slf4j:jcl-over-slf4j:jar:1.7.6:compile
[INFO]    +- org.slf4j:slf4j-api:jar:1.7.6:compile
[INFO]    +- org.slf4j:slf4j-log4j12:jar:1.7.6:compile
[INFO]    \- log4j:log4j:jar:1.2.17:compile

after i created jar and executed this one using hadoop

in a first time the problem was NoClassDefFound com.hp.hpl.jena.query
now the output is NoClassDefFound org.apache.xerces.util.XMLChar




2014-07-29 13:43 GMT+02:00 Rob Vesse <[email protected]>:

> Carmen
>
> It would be helpful if you showed us what you are doing, otherwise we can
> only guess and offer vague suggestions.
>
> Assuming you are using Maven as previously stated please provide the
> <dependencies> section of your POM
>
> It is also worth running mvn dependency:tree and checking that you don't
> have multiple entries for Jena libraries present.  Including the output of
> this would also help us debug your problem
>
> Rob
>
> On 29/07/2014 12:08, "Carmen Manzulli" <[email protected]> wrote:
>
> >i've proved with jena-arq and jena-core 2.12.0 but these don't fix my
> >problem...the output is the same:
> >
> >NoClassDefFoundError: com/hp/hpl/jena/shared/PrefixMapping
> >
> >
> >can you suggest me a right way to insert jena as dependency keeping in
> >mind
> >that i need only Query and QueryFactory classes?
> >
> >
> >2014-07-28 18:21 GMT+02:00 Andy Seaborne <[email protected]>:
> >
> >> On 28/07/14 16:36, Carmen Manzulli wrote:
> >>
> >>> ok....i'm using giraph 1.1.0, hadoop 1.2.1  jena arq 2.12.0 and
> >>> com.hp.hpl.jena 2.8.8; I've introduced the last one because there were
> >>> class not found exceptions for query and queryfactory....i make use of
> >>> these two classes to implement a simple select  and just for the moment
> >>> i'm
> >>> using select* as query string to test the code!
> >>>
> >>
> >> jena arq 2.12.0 and jena-core 2.8.8 don't mix.
> >>
> >> Use a consistent cut of jena.
> >>
> >>         Andy
> >>
> >>
> >>
> >>>
> >>> 2014-07-28 16:43 GMT+02:00 Andy Seaborne <[email protected]>:
> >>>
> >>>  On 28/07/14 15:00, Carmen Manzulli wrote:
> >>>>
> >>>>  Hi experts,
> >>>>>
> >>>>> i'm trying to use some jena classes (as Query and QueryFactory) in a
> >>>>> project  but when i run my code i get:
> >>>>>
> >>>>>    java.lang.NoClassDefFoundError:
> >>>>> com/hp/hpl/jena/shared/PrefixMapping$IllegalPrefixException
> >>>>>          at com.hp.hpl.jena.query.QueryFactory.create(
> >>>>> QueryFactory.java:68)
> >>>>>          at com.hp.hpl.jena.query.QueryFactory.create(
> >>>>> QueryFactory.java:40)
> >>>>>          at com.hp.hpl.jena.query.QueryFactory.create(
> >>>>> QueryFactory.java:28)
> >>>>>          at sisinflab.Query2.compute(Query2.java:27)
> >>>>>
> >>>>> and also :
> >>>>>
> >>>>> java.lang.ClassNotFoundException:
> >>>>> com.hp.hpl.jena.shared.PrefixMapping$IllegalPrefixException
> >>>>>          at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
> >>>>>          at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
> >>>>>          at java.security.AccessController.doPrivileged(Native
> >>>>>Method)
> >>>>>          at
> >>>>>java.net.URLClassLoader.findClass(URLClassLoader.java:354)
> >>>>>          at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
> >>>>>          at sun.misc.Launcher$AppClassLoader.loadClass(
> >>>>> Launcher.java:308)
> >>>>>          at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
> >>>>>          ... 12 more
> >>>>>
> >>>>> who can help me?
> >>>>>
> >>>>>
> >>>> "NoClassDefFoundError" means it was there are compile time (of Jena)
> >>>>and
> >>>> not at runtime (of your code).
> >>>>
> >>>> You have an incomplete or incompatible set of jars files.
> >>>>
> >>>>          Andy
> >>>>
> >>>> PS Please could you include things like version numbers (needed for
> >>>>line
> >>>> numbers to mean anything), the query in question, etc when describing
> >>>> something.
> >>>>
> >>>>
> >>>>
> >>>>>
> >>>>
> >>>
> >>
>
>
>
>
>

Reply via email to