problem when run ..

85 views
Skip to first unread message

manoj chauhan

unread,
Feb 15, 2012, 11:44:05 PM2/15/12
to jwpl-users
hi
i got a problem when i run a program in eclipse .

problem is

Exception in thread "main" org.hibernate.NonUniqueResultException:
query did not return a unique result: 2
at
org.hibernate.impl.AbstractQueryImpl.uniqueElement(AbstractQueryImpl.java:
820)
at
org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:
811)
at de.tudarmstadt.ukp.wikipedia.api.MetaData.<init>(MetaData.java:41)
at de.tudarmstadt.ukp.wikipedia.api.Wikipedia.<init>(Wikipedia.java:
79)
at Catogaries.main(Catogaries.java:43)


and program is:



import de.tudarmstadt.ukp.wikipedia.api.*;
import de.tudarmstadt.ukp.wikipedia.api.exception.WikiApiException;

/**
* Tutorial 1a
*
* Get the text of a wikipedia article.
* The text will be formatted with MediaWiki markup.
*
* Throws an exception, if no page with the given title exists.
*
* @author zesch
*
*/
public class HelloWorld implements WikiConstants {

public static void main(String[] args) throws WikiApiException {

// configure the database connection parameters
DatabaseConfiguration dbConfig = new DatabaseConfiguration();
dbConfig.setHost("localhost");
dbConfig.setDatabase("JWPL");
dbConfig.setUser("root");
dbConfig.setPassword("matlab");
dbConfig.setLanguage(Language.english);

// Create a new German wikipedia.
Wikipedia wiki = new Wikipedia(dbConfig);

// Get the page with title "Hello world".
// May throw an exception, if the page does not exist.
Page page = wiki.getPage("Stephen_Leacock");
System.out.println(page.getText());

}
}

Oliver Ferschke

unread,
Feb 16, 2012, 4:50:09 AM2/16/12
to jw...@googlegroups.com
Which JWPL Version?


________________________________________
Von: jw...@googlegroups.com [jw...@googlegroups.com]&quot; im Auftrag von &quot;manoj chauhan [chauhan...@gmail.com]
Gesendet: Donnerstag, 16. Februar 2012 05:44
An: jwpl-users
Betreff: [jwpl-users] problem when run ..

manoj chauhan

unread,
Feb 16, 2012, 6:14:36 AM2/16/12
to jwpl-users
hi sir
JWPL 0.7.0 version

On Feb 16, 2:50 pm, Oliver Ferschke <fersc...@ukp.informatik.tu-
darmstadt.de> wrote:
> Which JWPL Version?
>
> ________________________________________
> Von: jw...@googlegroups.com [jw...@googlegroups.com]&quot; im Auftrag von &quot;manoj chauhan [chauhan.mann...@gmail.com]

Oliver Ferschke

unread,
Feb 16, 2012, 6:50:44 AM2/16/12
to jw...@googlegroups.com
I think this was one of the problems that was fixed in the service releases ( 0.7.1. or 0.7.2.)
Try using the newest stable version 0.9.0
I'm sure this will fix the problem.

Note: There will be a new service release 0.9.1 soon that fixes another problem. It should, however, not affect you.

Regards,
Oliver

________________________________________
Von: jw...@googlegroups.com [jw...@googlegroups.com]&quot; im Auftrag von &quot;manoj chauhan [chauhan...@gmail.com]
Gesendet: Donnerstag, 16. Februar 2012 12:14
An: jwpl-users
Betreff: [jwpl-users] Re: problem when run ..

manoj chauhan

unread,
Feb 16, 2012, 8:02:30 AM2/16/12
to jwpl-users
after using JWPL 0.9.0 sir i have face a problem i got error. what i
do to resolve this problem.
log4j:WARN No appenders could be found for logger
(de.tudarmstadt.ukp.wikipedia.api.Wikipedia).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig
for more info.
Exception in thread "main" org.hibernate.NonUniqueResultException:
query did not return a unique result: 2
at
org.hibernate.internal.AbstractQueryImpl.uniqueElement(AbstractQueryImpl.java:
899)
at
org.hibernate.internal.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:
890)
at de.tudarmstadt.ukp.wikipedia.api.MetaData.<init>(MetaData.java:41)
at de.tudarmstadt.ukp.wikipedia.api.Wikipedia.<init>(Wikipedia.java:
79)
at HelloWorld.main(HelloWorld.java:41)

On Feb 16, 4:50 pm, Oliver Ferschke <fersc...@ukp.informatik.tu-
darmstadt.de> wrote:
> I think this was one of the problems that was fixed in the service releases ( 0.7.1.  or 0.7.2.)
> Try using the newest stable version 0.9.0
> I'm sure this will fix the problem.
>
> Note: There will be a new service release 0.9.1 soon that fixes another problem. It should, however, not affect you.
>
> Regards,
> Oliver
>
> ________________________________________

Oliver Ferschke

unread,
Feb 16, 2012, 8:09:40 AM2/16/12
to jw...@googlegroups.com
Ah, I see now.
This is a known problem.
The MetaData table in your database may only have ONE row.
Delete the other row from the table (they are probably identical). Then everything should work fine.

We never had this problem, but some of the JWPL experienced this issue before.
I believe it might have happened during the data import. Maybe you imported the MetaData.txt twice?

Anyway, get rid of the additional row in MetaData and you're good to go.

Regards,
Oliver
________________________________________
Von: jw...@googlegroups.com [jw...@googlegroups.com]&quot; im Auftrag von &quot;manoj chauhan [chauhan...@gmail.com]
Gesendet: Donnerstag, 16. Februar 2012 14:02

Oliver Ferschke

unread,
Feb 16, 2012, 8:11:37 AM2/16/12
to jw...@googlegroups.com
Btw.
You can ignore the log4j warning.
JWPL currently does not initialize the logger automatically. This should be done by the client software - not by the library. You can either provide a log4j configuration or ignore the warning.
________________________________________
Von: jw...@googlegroups.com [jw...@googlegroups.com]&quot; im Auftrag von &quot;manoj chauhan [chauhan...@gmail.com]
Gesendet: Donnerstag, 16. Februar 2012 14:02

manoj chauhan

unread,
Feb 17, 2012, 9:10:39 AM2/17/12
to jwpl-users
thank you sir now its working .

On Feb 16, 6:11 pm, Oliver Ferschke <fersc...@ukp.informatik.tu-
darmstadt.de> wrote:
> Btw.
> You can ignore the log4j warning.
> JWPL currently does not initialize the logger automatically. This should be done by the client software - not by the library. You can either provide a log4j configuration or ignore the warning.
> ________________________________________
> Von: jw...@googlegroups.com [jw...@googlegroups.com]&quot; im Auftrag von &quot;manoj chauhan [chauhan.mann...@gmail.com]
> Gesendet: Donnerstag, 16. Februar 2012 14:02
> An: jwpl-users
> Betreff: [jwpl-users] Re: problem when run ..
>
> after using JWPL 0.9.0 sir i have face a problem i got error. what i
> do to resolve this problem.
> log4j:WARN No appenders could be found for logger
> (de.tudarmstadt.ukp.wikipedia.api.Wikipedia).
> log4j:WARN Please initialize the log4j system properly.
> log4j:WARN Seehttp://logging.apache.org/log4j/1.2/faq.html#noconfig

Ines Abbes

unread,
Nov 8, 2017, 6:07:49 AM11/8/17
to jwpl-users
Thank you It is working for me.
Reply all
Reply to author
Forward
0 new messages