You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by vijayalakshmi <vi...@gmail.com> on 2012/02/25 18:21:53 UTC
importing jena in java
I have deployed a java servlet in tomcat6.0. I am unable to use jena
libraries in the servlet.
I tried placing the JENA JAR files inside both $tomcat/WEB-INF/lib
and $tomcat/WEB-INF/classes/
I also tried setting the classpath to $jena/lib in control
panel->system->advanced->environment variables
but i am getting the following errors.
C:\Program Files\Apache Software Foundation\Tomcat
6.0\webapps\MyFiles\WEB-INF\c
lasses>javac submitBlog.java
.\Hello.java:6: package com.hp.hpl.jena.rdf.model does not exist
import com.hp.hpl.jena.rdf.model.*;
^
.\Hello.java:7: package com.hp.hpl.jena.vocabulary does not exist
import com.hp.hpl.jena.vocabulary.*;
^
.\Hello.java:32: cannot find symbol
symbol : class Model
location: class Hello
Model model = ModelFactory.createDefaultModel();
^
.\Hello.java:32: cannot find symbol
symbol : variable ModelFactory
location: class Hello
Model model = ModelFactory.createDefaultModel();
^
.\Hello.java:36: cannot find symbol
symbol : class Resource
location: class Hello
Resource johnSmith
^
.\Hello.java:39: cannot find symbol
symbol : variable VCARD
location: class Hello
.addProperty(VCARD.N,
^
.\Hello.java:42: cannot find symbol
symbol : variable VCARD
location: class Hello
.addProperty(VCARD.Family, familyName));
^
.\Hello.java:41: cannot find symbol
symbol : variable VCARD
location: class Hello
.addProperty(VCARD.Given, givenName)
^
.\Hello.java:38: cannot find symbol
symbol : variable VCARD
location: class Hello
.addProperty(VCARD.FN, fullName)
^
9 errors
C:\Program Files\Apache Software Foundation\Tomcat
6.0\webapps\MyFiles\WEB-INF\c
lasses>
I want to know where I should place the library files.
Re: importing jena in java
Posted by Andy Seaborne <an...@apache.org>.
On 25/02/12 17:32, Amol Mandar wrote:
> Have you restarted tomcat service after placing jena.jar file at
> /WEB-INF/lib?
> Otherwise put it at \jdk1.6.0\jre\lib\ext\ under windows sometimes placing
> .jar files here will work.
>
> Prabodh Vekhande
>
> On 25 February 2012 22:51, vijayalakshmi<vi...@gmail.com> wrote:
>
>> I have deployed a java servlet in tomcat6.0. I am unable to use jena
>> libraries in the servlet.
>>
>> I tried placing the JENA JAR files inside both $tomcat/WEB-INF/lib
>> and $tomcat/WEB-INF/classes/
>>
>> I also tried setting the classpath to $jena/lib in control
>> panel->system->advanced->environment variables
>>
>> but i am getting the following errors.
Putting the files in WEB-INF/lib makes them available at runtime to
Tomcat but does not affect your compiler setup.
>>
>>
>> C:\Program Files\Apache Software Foundation\Tomcat
>> 6.0\webapps\MyFiles\WEB-INF\c
>> lasses>javac submitBlog.java
Using an IDE such as Eclipse is usually easier.
javac -cp 'X\lib\*;' submitBlog.java
where X is the directory should work.
But learning to use IDE is well worth it.
Andy
>> .\Hello.java:6: package com.hp.hpl.jena.rdf.model does not exist
>> import com.hp.hpl.jena.rdf.model.*;
>> ^
>> .\Hello.java:7: package com.hp.hpl.jena.vocabulary does not exist
>> import com.hp.hpl.jena.vocabulary.*;
>> ^
>> .\Hello.java:32: cannot find symbol
>> symbol : class Model
>> location: class Hello
>> Model model = ModelFactory.createDefaultModel();
>> ^
>> .\Hello.java:32: cannot find symbol
>> symbol : variable ModelFactory
>> location: class Hello
>> Model model = ModelFactory.createDefaultModel();
>> ^
>> .\Hello.java:36: cannot find symbol
>> symbol : class Resource
>> location: class Hello
>> Resource johnSmith
>> ^
>> .\Hello.java:39: cannot find symbol
>> symbol : variable VCARD
>> location: class Hello
>> .addProperty(VCARD.N,
>> ^
>> .\Hello.java:42: cannot find symbol
>> symbol : variable VCARD
>> location: class Hello
>> .addProperty(VCARD.Family, familyName));
>> ^
>> .\Hello.java:41: cannot find symbol
>> symbol : variable VCARD
>> location: class Hello
>> .addProperty(VCARD.Given, givenName)
>> ^
>> .\Hello.java:38: cannot find symbol
>> symbol : variable VCARD
>> location: class Hello
>> .addProperty(VCARD.FN, fullName)
>> ^
>> 9 errors
>>
>> C:\Program Files\Apache Software Foundation\Tomcat
>> 6.0\webapps\MyFiles\WEB-INF\c
>> lasses>
>>
>>
>>
>> I want to know where I should place the library files.
>>
>
Re: importing jena in java
Posted by Andy Seaborne <an...@apache.org>.
On 25/02/12 18:06, vijayalakshmi wrote:
> I put it in \jdk1.6.0\jre\lib\ext\ . Its working.
>
> now I have progressed to getting the next level exception ;)
>
> I am attaching my code and the result with this mail. I want to know
> what causes the error. I tried googling it. But nothing useful.
>
> When the user clicks the submit button in the HTML page, the servlet
> called "submitBlog" is invoked. This calls a method named "Hello" in
> another java program. Both the programs are put inside the
> WEB-INF\classes\ directory. The "hello" method uses the JENA libraries.
> When I execute the program, the following error is displayed.
>
> Please help!!
NoClassDefFoundError for Jena RDFNode.
It's not finding the Jena jar - don't know why; insufficient
information. I don't use Tomcat but (1) is it using that exact JRE and
not an installed separate JRE0 (2) Tomcat is careful on security - maybe
it's not exposing installed extensions because ...
... using \jdk1.6.0\jre\lib\ext\ is not a good idea.
Andy
PS Eclipse can also be used to set up tomcat.
Re: importing jena in java
Posted by Dave Reynolds <da...@gmail.com>.
On 25/02/12 18:06, vijayalakshmi wrote:
> I put it in \jdk1.6.0\jre\lib\ext\ . Its working.
That should not be necessary.
> now I have progressed to getting the next level exception ;)
>
> I am attaching my code and the result with this mail. I want to know
> what causes the error. I tried googling it. But nothing useful.
Just another way of telling you it can't find the jena jars.
The jena jars should go in the WEB-INF/lib of your servlet.
Make sure you include all the jars from an up to date jena distribution.
I know you said you tried that but that's the correct location so if
that isn't working there is some other problem with how you are
deploying your servlet.
Dave
Re: importing jena in java
Posted by vijayalakshmi <vi...@gmail.com>.
I put it in \jdk1.6.0\jre\lib\ext\ . Its working.
now I have progressed to getting the next level exception ;)
I am attaching my code and the result with this mail. I want to know what
causes the error. I tried googling it. But nothing useful.
When the user clicks the submit button in the HTML page, the servlet called
"submitBlog" is invoked. This calls a method named "Hello" in another java
program. Both the programs are put inside the WEB-INF\classes\ directory.
The "hello" method uses the JENA libraries. When I execute the program, the
following error is displayed.
Please help!!
Re: importing jena in java
Posted by Amol Mandar <am...@gmail.com>.
Have you restarted tomcat service after placing jena.jar file at
/WEB-INF/lib?
Otherwise put it at \jdk1.6.0\jre\lib\ext\ under windows sometimes placing
.jar files here will work.
Prabodh Vekhande
On 25 February 2012 22:51, vijayalakshmi <vi...@gmail.com> wrote:
> I have deployed a java servlet in tomcat6.0. I am unable to use jena
> libraries in the servlet.
>
> I tried placing the JENA JAR files inside both $tomcat/WEB-INF/lib
> and $tomcat/WEB-INF/classes/
>
> I also tried setting the classpath to $jena/lib in control
> panel->system->advanced->environment variables
>
> but i am getting the following errors.
>
>
> C:\Program Files\Apache Software Foundation\Tomcat
> 6.0\webapps\MyFiles\WEB-INF\c
> lasses>javac submitBlog.java
> .\Hello.java:6: package com.hp.hpl.jena.rdf.model does not exist
> import com.hp.hpl.jena.rdf.model.*;
> ^
> .\Hello.java:7: package com.hp.hpl.jena.vocabulary does not exist
> import com.hp.hpl.jena.vocabulary.*;
> ^
> .\Hello.java:32: cannot find symbol
> symbol : class Model
> location: class Hello
> Model model = ModelFactory.createDefaultModel();
> ^
> .\Hello.java:32: cannot find symbol
> symbol : variable ModelFactory
> location: class Hello
> Model model = ModelFactory.createDefaultModel();
> ^
> .\Hello.java:36: cannot find symbol
> symbol : class Resource
> location: class Hello
> Resource johnSmith
> ^
> .\Hello.java:39: cannot find symbol
> symbol : variable VCARD
> location: class Hello
> .addProperty(VCARD.N,
> ^
> .\Hello.java:42: cannot find symbol
> symbol : variable VCARD
> location: class Hello
> .addProperty(VCARD.Family, familyName));
> ^
> .\Hello.java:41: cannot find symbol
> symbol : variable VCARD
> location: class Hello
> .addProperty(VCARD.Given, givenName)
> ^
> .\Hello.java:38: cannot find symbol
> symbol : variable VCARD
> location: class Hello
> .addProperty(VCARD.FN, fullName)
> ^
> 9 errors
>
> C:\Program Files\Apache Software Foundation\Tomcat
> 6.0\webapps\MyFiles\WEB-INF\c
> lasses>
>
>
>
> I want to know where I should place the library files.
>