File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes SWRLRuleEninge does not work in a servlet with tomcat7 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "SWRLRuleEninge does not work in a servlet with tomcat7" Watch "SWRLRuleEninge does not work in a servlet with tomcat7" New topic
Author

SWRLRuleEninge does not work in a servlet with tomcat7

Nada Bajnaid
Ranch Hand

Joined: Aug 14, 2011
Posts: 45
I manipulated ontology in a web application using eclipse and tomcat7. When I create OWLModel everything works fine but when I use bridge to create inferred model through jess I got the following error

NoClassDefFoundError: edu/stanford/smi/protege/model/KnowledgeBase

I use the following code that works in a simple java program but not with tomcat7

FileInputStream file = new FileInputStream ("C:/Program Files/Protege_3.4.6/examples/SQOntology/SQOntologyNewView.owl");
Reader in = new InputStreamReader (file);
OWLModel owlModel = ProtegeOWL.createJenaOWLModelFromReader(in);
System.out.println ("I'm here");

SWRLRuleEngine ruleEngine = SWRLRuleEngineFactory.create(owlModel);

Collection clses = owlModel.getUserDefinedOWLNamedClasses();
model = new JenaCreator(owlModel, false, true, clses, null).createOntModel();


I use protege_3.4.6 and I placed the following jars to the project build path
protege.jar
unicode_panel.jar
looks.jar
jess.jar
ProtegeOWL (a library containing all jars from protegex.owl plugin)
Jena/lib jars

I also copied all jars from jena/lib and protegex.owl plugin into the lib directory of my web application

still not working
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41052
    
  43
The build path is irrelevant. Whatever you need at runtime must be in WEB-INF/lib.


Ping & DNS - my free Android networking tools app
Nada Bajnaid
Ranch Hand

Joined: Aug 14, 2011
Posts: 45
Does that mean that I need to move all jars to the lib direcory of my application? What about the OWL Model the code works fine with it but not with the SWRL Rule Engine? Would you please clarify what exactly I need to place in the lib directory

thanks
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41052
    
  43
Yes. What have you tried?
Nada Bajnaid
Ranch Hand

Joined: Aug 14, 2011
Posts: 45
Thanks a lot it works eventhough it is a bit slow
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SWRLRuleEninge does not work in a servlet with tomcat7
 
Similar Threads
Class loading issue when "Package" names are same (WEB-INF/classes and WEB-INF/lib)
Error compiling a class in JSF Application.
Apache 2 and Tomcat 7 on Ubuntu 10.04 in VirtualBox 4.06xxx
Redeploy application
Tomcat 5.5 Class loading issues--and I have done some home work on this one