Sidharth Agarwal | 1 Oct 08:21 2010
Picon

Problem running eXist in eclipse

While embedding eXist into eclipse, i got this error:


log4j:WARN No appenders could be found for logger (org.exist.util.ConfigurationHelper).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xerces/util/XMLCatalogResolver
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.exist.util.Configuration.configureValidation(Configuration.java:1192)
at org.exist.util.Configuration.<init>(Configuration.java:344)
at org.exist.xmldb.DatabaseImpl.configure(DatabaseImpl.java:99)
at org.exist.xmldb.DatabaseImpl.getLocalCollection(DatabaseImpl.java:175)
at org.exist.xmldb.DatabaseImpl.getCollection(DatabaseImpl.java:155)
at org.exist.xmldb.DatabaseImpl.getCollection(DatabaseImpl.java:150)
at org.xmldb.api.DatabaseManager.getCollection(Unknown Source)
at org.xmldb.api.DatabaseManager.getCollection(Unknown Source)
at exist.ret2.main(ret2.java:18)
Caused by: java.lang.ClassNotFoundException: org.apache.xerces.util.XMLCatalogResolver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 21 more

what probably is missing?? Me writing this simple code:

public static void main(String args[]) throws Exception {
Class cl = Class.forName("org.exist.xmldb.DatabaseImpl");
Database database = (Database)cl.newInstance();
database.setProperty("create-database", "true");
DatabaseManager.registerDatabase(database);
       Collection col = DatabaseManager.getCollection("xmldb:exist:///db/shakespeare");
   col.setProperty(OutputKeys.INDENT, "no");    
   Resource res = (XMLResource)col.getResource("hamlet.xml");
       System.out.println(res.getContent());

Thanks
Sidharth

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Exist-open mailing list
Exist-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/exist-open
Stefan Majewski | 1 Oct 09:17 2010
Picon
Picon

Re: execute command on server from exist

On 30/09/10 19:53, Joseph Toman wrote:
> declare namespace runtime="java:java.lang.Runtime"; 
>
> runtime:exec(runtime:getRuntime(), "/usr/local/bin/convert myimage.gif myimage.jpg")
>   

That works. One would have to enable java binding in conf.xml, which,
obvioulsy causes some security issues. In any way one should prevent
that user-crafted XQueries are posted to the server.

cheers,
Stefan

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
Dannes Wessels | 1 Oct 09:59 2010

Re: Problem running eXist in eclipse

Hi,

On Fri, Oct 1, 2010 at 8:21 AM, Sidharth Agarwal <sagarw17 <at> asu.edu> wrote:
While embedding eXist into eclipse, i got this error:

log4j:WARN No appenders could be found for logger (org.exist.util.ConfigurationHelper).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xerces/util/XMLCatalogResolver
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)

what probably is missing?? Me writing this simple code:


hmmm please read the logging very carefully, the actual reason of failure is there, it is a 'basic classpath' issue. Solution: make you claspath complete. Please consult the Mailinglist archives how to solve this issue, or consult the exist-db documentation (hint: see 'war' file deployment)

thnx

Dannes


--
eXist-db Native XML Database - http://exist-db.org
Join us on linked-in: http://www.linkedin.com/groups?gid=35624
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Exist-open mailing list
Exist-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/exist-open
Sidharth Agarwal | 1 Oct 10:43 2010
Picon

Problem running eXist in eclipse

Ok i got rid of log4j errors, by adding few more jars to the classpath.


This is the new error i am getting.

File lock last access timestamp: Oct 1, 2010 C:\Users\sidharth\workspace\exist-db\data\dbx_dir.lck
Found a stale lockfile. Trying to remove it:  C:\Users\sidharth\workspace\exist-db\data\dbx_dir.lck
File lock last access timestamp: Oct 1, 2010 C:\Users\sidharth\workspace\exist-db\data\journal.lck
Found a stale lockfile. Trying to remove it:  C:\Users\sidharth\workspace\exist-db\data\journal.lck
Exception in thread "main" java.lang.NullPointerException
at exist.TestDB.main(TestDB.java:25)

or sometimes it shows:

File lock last access timestamp: Oct 1, 2010 C:\Users\sidharth\workspace\exist-db\data\dbx_dir.lck
Waiting a short time for the lock to be released... C:\Users\sidharth\workspace\exist-db\data\dbx_dir.lck
File lock last access timestamp: Oct 1, 2010 C:\Users\sidharth\workspace\exist-db\data\dbx_dir.lck
Waiting a short time for the lock to be released... C:\Users\sidharth\workspace\exist-db\data\dbx_dir.lck
Exception in thread "main" org.xmldb.api.base.XMLDBException: Can not access to local database instance
at org.exist.xmldb.DatabaseImpl.getLocalCollection(DatabaseImpl.java:183)
at org.exist.xmldb.DatabaseImpl.getCollection(DatabaseImpl.java:155)
at org.exist.xmldb.DatabaseImpl.getCollection(DatabaseImpl.java:150)
at org.xmldb.api.DatabaseManager.getCollection(Unknown Source)
at exist.TestDB.main(TestDB.java:22)
Caused by: org.exist.EXistException: database instance 'exist' is not available
at org.exist.storage.BrokerPool.getInstance(BrokerPool.java:291)
at org.exist.xmldb.DatabaseImpl.getLocalCollection(DatabaseImpl.java:181)
... 4 more
[B <at> 1dfc547org.exist.EXistException: database instance 'exist' is not available
at org.exist.storage.BrokerPool.getInstance(BrokerPool.java:291)
at org.exist.xmldb.DatabaseImpl.getLocalCollection(DatabaseImpl.java:181)
at org.exist.xmldb.DatabaseImpl.getCollection(DatabaseImpl.java:155)
at org.exist.xmldb.DatabaseImpl.getCollection(DatabaseImpl.java:150)
at org.xmldb.api.DatabaseManager.getCollection(Unknown Source)
at exist.TestDB.main(TestDB.java:22)

Code:
String driver = "org.exist.xmldb.DatabaseImpl";      
        // initialize database driver
        Class cl = Class.forName(driver);
        Database database = (Database) cl.newInstance();
        database.setProperty("create-database", "true");
        DatabaseManager.registerDatabase(database);

        // get the collection
        Collection col = DatabaseManager.getCollection("xmldb:exist:///db", "admin", "exist123");
        col.setProperty(OutputKeys.INDENT, "no");
        Resource res = (XMLResource)col.getResource("FAQ.xml");
        System.out.println(res.getContent());

I am passing no arguments, just running it simply.
I have FAQ.xml file in my root db folder, which i can access through cmd.

What i am doing wrong??
I badly need eXist to work on eclipse, so if pointer to documentation, or any short full working example, explaining how to run that, is possible than i will rom last many days.

Thanxs
Sidharth
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Exist-open mailing list
Exist-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/exist-open
Walpole, Robert | 1 Oct 11:17 2010
Picon

Re: execute command on server from exist

Another solution would be to write an extension function that wraps the
Apache Commons Exec library (http://commons.apache.org/exec/). This
would seem to be safer option, is generally considered to play nicer
than java.lang.Runtime and should not be too difficult to implement.

Cheers
Rob Walpole

> -----Original Message-----
> From: Stefan Majewski [mailto:stefan.majewski <at> univie.ac.at] 
> Sent: 01 October 2010 08:18
> To: Joseph Toman
> Cc: exist-open <at> lists.sourceforge.net ml; Wolfgang Meier
> Subject: Re: [Exist-open] execute command on server from exist
> 
> On 30/09/10 19:53, Joseph Toman wrote:
> > declare namespace runtime="java:java.lang.Runtime";
> >
> > runtime:exec(runtime:getRuntime(), "/usr/local/bin/convert 
> myimage.gif 
> > myimage.jpg")
> >   
> 
> That works. One would have to enable java binding in 
> conf.xml, which, obvioulsy causes some security issues. In 
> any way one should prevent that user-crafted XQueries are 
> posted to the server.
> 
> cheers,
> Stefan
> 
> --------------------------------------------------------------
> ----------------
> Start uncovering the many advantages of virtual appliances 
> and start using them to simplify application deployment and 
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> Exist-open mailing list
> Exist-open <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/exist-open
> 

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
Dannes Wessels | 1 Oct 12:43 2010

Re: Problem running eXist in eclipse

Hi

On Fri, Oct 1, 2010 at 10:43 AM, Sidharth Agarwal <sagarw17 <at> asu.edu> wrote:
Exception in thread "main" java.lang.NullPointerException
at exist.TestDB.main(TestDB.java:25)

so.... the problem is on line 25 (....), verify the code lin; deduct what object reference is the NULl reference.  We really cannot see what line th eline nr 25 is, sorry.

        Resource res = (XMLResource)col.getResource("FAQ.xml");

I am passing no arguments, just running it simply.
I have FAQ.xml file in my root db folder, which i can access through cmd.

sorry, it is unclear what you mean. What is your definition of 'root db folder' ? Note that in this line a file is retrieved from the database, not from the file system. getResource() should indeed return null, if this is your line 25.

regards

Dannes
 

--
eXist-db Native XML Database - http://exist-db.org
Join us on linked-in: http://www.linkedin.com/groups?gid=35624
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Exist-open mailing list
Exist-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/exist-open
Walpole, Robert | 1 Oct 15:16 2010
Picon

Re: execute command on server from exist

Perhaps I should add that, if this is considered useful, I would be
happy to put it together as I have done something similar for another
project.

Cheers
Rob Walpole

> -----Original Message-----
> From: Walpole, Robert [mailto:robert.walpole <at> metoffice.gov.uk] 
> Sent: 01 October 2010 10:17
> To: Stefan Majewski; Joseph Toman
> Cc: exist-open <at> lists.sourceforge.net; Wolfgang Meier
> Subject: Re: [Exist-open] execute command on server from exist
> 
> Another solution would be to write an extension function that 
> wraps the Apache Commons Exec library 
> (http://commons.apache.org/exec/). This would seem to be 
> safer option, is generally considered to play nicer than 
> java.lang.Runtime and should not be too difficult to implement.
> 
> Cheers
> Rob Walpole
> 
> > -----Original Message-----
> > From: Stefan Majewski [mailto:stefan.majewski <at> univie.ac.at]
> > Sent: 01 October 2010 08:18
> > To: Joseph Toman
> > Cc: exist-open <at> lists.sourceforge.net ml; Wolfgang Meier
> > Subject: Re: [Exist-open] execute command on server from exist
> > 
> > On 30/09/10 19:53, Joseph Toman wrote:
> > > declare namespace runtime="java:java.lang.Runtime";
> > >
> > > runtime:exec(runtime:getRuntime(), "/usr/local/bin/convert
> > myimage.gif
> > > myimage.jpg")
> > >   
> > 
> > That works. One would have to enable java binding in 
> conf.xml, which, 
> > obvioulsy causes some security issues. In any way one 
> should prevent 
> > that user-crafted XQueries are posted to the server.
> > 
> > cheers,
> > Stefan
> > 
> > --------------------------------------------------------------
> > ----------------
> > Start uncovering the many advantages of virtual appliances 
> and start 
> > using them to simplify application deployment and accelerate your 
> > shift to cloud computing.
> > http://p.sf.net/sfu/novell-sfdev2dev
> > _______________________________________________
> > Exist-open mailing list
> > Exist-open <at> lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/exist-open
> > 
> 
> --------------------------------------------------------------
> ----------------
> Start uncovering the many advantages of virtual appliances 
> and start using them to simplify application deployment and 
> accelerate your shift to cloud computing.
> http://p.sf.net/sfu/novell-sfdev2dev
> _______________________________________________
> Exist-open mailing list
> Exist-open <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/exist-open
> 

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
Casey Jordan | 1 Oct 17:14 2010

Automatic backup

Group,

When using the scheduler to do automatic backup, is the database put in read only mode? Or are any other operations stopped from happening?

Cheers,

Casey

--
--
Casey Jordan
Jorsek Software LLC.
"CaseyDJordan" on LinkedIn, Twitter & Facebook
Cell (585) 348 7399
Office (585) 239 6060
Jorsek.com


This message is intended only for the use of the Addressee(s) and may
contain information that is privileged, confidential, and/or exempt from
disclosure under applicable law.  If you are not the intended recipient,
please be advised that any disclosure  copying, distribution, or use of
the information contained herein is prohibited.  If you have received
this communication in error, please destroy all copies of the message,
whether in electronic or hard copy format, as well as attachments, and
immediately contact the sender by replying to this e-mail or by phone.
Thank you.

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Exist-open mailing list
Exist-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/exist-open
Jason Smith | 1 Oct 17:28 2010

Re: Automatic backup

If you are referring to the backup mechanism in "conf.xml" (commented out by default), yes that is a
blocking operation.  The database is locked while the backup happens.  

Jason Smith

________________________________________
From: Casey Jordan [casey.jordan <at> jorsek.com]
Sent: Friday, October 01, 2010 9:14 AM
To: exist-open <at> lists.sourceforge.net ml
Subject: [Exist-open] Automatic backup

Group,

When using the scheduler to do automatic backup, is the database put in read only mode? Or are any other
operations stopped from happening?

Cheers,

Casey

--
--
Casey Jordan
Jorsek Software LLC.
"CaseyDJordan" on LinkedIn, Twitter & Facebook
Cell (585) 348 7399
Office (585) 239 6060
Jorsek.com

This message is intended only for the use of the Addressee(s) and may
contain information that is privileged, confidential, and/or exempt from
disclosure under applicable law.  If you are not the intended recipient,
please be advised that any disclosure  copying, distribution, or use of
the information contained herein is prohibited.  If you have received
this communication in error, please destroy all copies of the message,
whether in electronic or hard copy format, as well as attachments, and
immediately contact the sender by replying to this e-mail or by phone.
Thank you.

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
Wolfgang Meier | 1 Oct 17:34 2010

Re: Automatic backup

> If you are referring to the backup mechanism in "conf.xml" (commented out by default), yes that is a
blocking operation.  The database is locked while the backup happens.

In SVN trunk as well as the eXist-1.4.x branch, only writing
transactions are blocked. Read-only operations are allowed, though
they will slow down as well.

Wolfgang

------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Exist-open mailing list
Exist-open <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/exist-open

Gmane