问题描述
我正在使用Apache Jena处理应用程序,以使用SPARQL访问DBPEDIA.好吧,我是DBPEDIA和Apache Jena的新手,我进行了一些研究,并从一些示例代码开始创建VCARD.
公共类dppedia扩展了对象{
static String personURI = "<!..http://def/JohnSmith..!>"; static String fullName = "John Smith"; static String Fullname = "Pulkit Gupta"; public static void main (String args[]) { // create an empty model Model model = ModelFactory.createDefaultModel(); // create the resource Resource johnSmith = model.createResource(personURI); Resource pulkitgupta=model.createResource(personABC); // add the property johnSmith.addProperty(VCARD.FN, fullName); pulkitgupta.addProperty(VCARD.FN,Fullname); }
}
但是,当我尝试执行此代码时.最终出现了一个错误
log4j:警告logger(org.apache.jena.riot.stream.jenaioenvironment)找不到附录. log4j:警告请正确初始化log4j系统. log4j:warn参见 .html#noconfig 有关更多信息.
看来我的日食未正确配置,我需要安装log4j.好吧,我下载了文件,但不确定如何使用Eclipse配置它.
推荐答案
jena使用log4j作为记录系统,警告消息明确告诉您您缺少log4j.properties来初始化它.
"这是当找不到默认配置文件log4j.properties和log4j.xml时发生,并且应用程序没有执行明确的配置."
在src和重试下创建log4j.properties文件.您可以找到一些示例配置文件在这里
其他推荐答案
最简单的方法是转到提取Apache Jena的文件夹.
-
找到一个命名的属性文件:jena-log4j.properties.复制此
-
导航到您拥有源项目的工作区文件夹.
-
转到bin文件夹,然后将文件粘贴在那里.确保将文件重命名为log4j.properties
-
清洁项目并运行它.
错误现在已经消失了.
其他推荐答案
使用org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.OFF);
问题描述
I am working on an application using apache jena, to access dbpedia using sparql. Well I am very new to DBPedia and apache jena, I did some research and started with some sample code to create VCARD.
public class DpPedia extends Object {
static String personURI = "<!..http://def/JohnSmith..!>"; static String fullName = "John Smith"; static String Fullname = "Pulkit Gupta"; public static void main (String args[]) { // create an empty model Model model = ModelFactory.createDefaultModel(); // create the resource Resource johnSmith = model.createResource(personURI); Resource pulkitgupta=model.createResource(personABC); // add the property johnSmith.addProperty(VCARD.FN, fullName); pulkitgupta.addProperty(VCARD.FN,Fullname); }
}
However when i tried to execute this code .. It end up with an error
log4j:WARN No appenders could be found for logger (org.apache.jena.riot.stream.JenaIOEnvironment). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
it seems my eclipse is not configured properly and I need to install Log4j. Well I downloaded the files, but not sure how up configure it with eclipse.
推荐答案
jena use log4j as logging system, and the warning messages tell explicitly that you are lacking of a log4j.properties to initialize it.
"This occurs when the default configuration files log4j.properties and log4j.xml can not be found and the application performs no explicit configuration."
Create log4j.properties file under src and retry. You can find some sample config files here
其他推荐答案
The easiest way to do this is by going to the folder where you extracted apache jena.
Find a properties file named : jena-log4j.properties. Copy this
Navigate to your workspace folder where you have your source project.
Go to bin folder and paste the file there. Make sure you rename the file to just log4j.properties
Clean the project and run it.
The errors would now have gone.
其他推荐答案
use org.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.OFF);