Hi Andreas,

 

I’ve solved the other issue with the NoClassDefFoundError (some fresh installation of the BAseX76.WAR with the Tomcat stopped apparently fixed that), but what you comment is interesting though:

 

I still think that I cannot get the information returned by the query using your method, since cQuery.execute returns a String meaning the handler of a stream (something like org.apache.tomcat.util.log.SystemLogHandler@77e1ecbf).

 

So what I did was to create my own OutputStream and pass it to the Client Session. After that I converted the Stream into a String and, bingo!, there was the output of my Query.

 

Best regards and thank you very much,

 

           C.

 

From: Andreas Weiler [mailto:andreas.weiler@uni-konstanz.de]
Sent: jueves, 18 de abril de 2013 13:43
To: Carlos MARCOS LAGUNAR
Cc: basex-talk@mailman.uni-konstanz.de
Subject: Re: [basex-talk] java.lang.NoClassDefFoundError while deploying on Tomcat server

 

Hi,

 

i dont know about the other problem but u can do the following:

 

log.debug("[BaseX] executing query:"+query);

             ClientSession cSes = new ClientSession(serverNameBaseX, Integer.valueOf(portBaseX), userpass);

             cSes.setOutputStream(System.out);

             ClientQuery cQuery = cSes.query(query);

             String res = cQuery.execute();

             String info = cQuery.info();             ß This res only stores the execution time and not the result of the query, so it is useless (for me :-) )

             cQuery.close();

 

-- Andreas

 

Am 18.04.2013 um 13:37 schrieb Carlos MARCOS LAGUNAR:



Hi,

 

I’ve downloaded last BaseX version from the download page and what I’ve done it is just put the BaseX76.war into webapps deployment directory of Tomcat.

 

As far as I know, it has deployed correctly, since I can make REST requests successfully like http://MiServer/BaseX76/rest?command=show+users.

 

The problem comes when I try to access it from my Java Application, where I’ve tried with two methods: JavaClient and XQJ. With JavaClient it works, but with XQJ the response is always the same (log from [TOMCAT_DEPLOYMENT_DIRECTORY]/BaseX76/data/.logs):

 

13:32:40.053    172.24.41.93:59521      admin  ERROR   Improper use? Potential bug? Your feedback is welcome: Contact: basex-talk@mailman.uni-konstanz.de Version: BaseX 7.6 Java: Oracle Corporation, 1.7.0 OS: Linux, i386 Stack Trace: java.lang.NoClassDefFoundError: org/basex/index/value/DiskValues org.basex.data.DiskData.<init>(DiskData.java:88) org.basex.core.cmd.Open.open(Open.java:70) org.basex.core.cmd.Open.run(Open.java:36) org.basex.core.Command.run(Command.java:342) org.basex.core.Command.exec(Command.java:321) org.basex.core.Command.execute(Command.java:78) org.basex.server.ClientListener.run(ClientListener.java:145)      453.12 ms

 

The block of Java code where the Exception is thrown is the following (for the case of XQJ):

 

       log.debug("[BaseX] executing query:"+query);

       XQDataSource xqs = new BaseXXQDataSource();

 

       xqs.setProperty("databaseName", dbName);

       xqs.setProperty("serverName", serverNameBaseX);

       xqs.setProperty("port", portBaseX);

       xqs.setProperty("user", usuario);

       xqs.setProperty("password", clave);

 

       xqs.setLogWriter(new PrintWriter(System.out, true));

            

       XQConnection xqc = xqs.getConnection();        ß Here is where the Exception is thrown

       XQExpression xqe = xqc.createExpression();

 

       XQSequence xq = xqe.executeQuery(query);

 

       StringBuilder res = new StringBuilder();

       while (xq.next()) {

              res.append(xq.getItemAsString(null));

       }

       log.debug("[BaseX] result:"+res);

          

       xqc.close();

 

It seems that it is not finding the jars inside the WAR where DiskData class is located, but I’ve entered into the Tomcat directory where the WAR has been deployed (/BaseX76/WEB-INF/lib) and all of them are there:

 

-rw-rw---- 1  2558399 2013-02-05 18:22 basex-7.6.jar

-rw-rw---- 1   295821 2013-01-30 11:42 basex-xqj-1.2.3.jar

-rw-rw---- 1    58160 2013-01-30 11:42 commons-codec-1.4.jar

-rw-rw---- 1    59590 2013-01-30 11:42 commons-fileupload-1.2.2.jar

-rw-rw---- 1   109043 2013-01-30 11:42 commons-io-1.4.jar

-rw-rw---- 1   153115 2013-01-30 11:42 jdom-1.1.jar

-rw-rw---- 1   794991 2013-01-31 15:34 jts-1.13.jar

-rw-rw---- 1   410933 2013-01-30 11:42 milton-api-1.7.2.jar

-rw-rw---- 1   119180 2013-01-30 11:42 mime-util-2.1.3.jar

-rw-rw---- 1    23445 2013-01-30 11:42 slf4j-api-1.5.8.jar

-rw-rw---- 1     5284 2013-01-30 11:42 slf4j-nop-1.5.8.jar

-rw-rw---- 1     9260 2013-01-30 11:42 xmldb-api-1.0.jar

-rw-rw---- 1     7188 2013-01-30 11:45 xmlpull-1.1.3.1.jar

-rw-rw---- 1    24956 2013-01-30 11:45 xpp3_min-1.1.4c.jar

-rw-rw---- 1     4578 2013-01-30 11:42 xqj2-0.1.0.jar

-rw-rw---- 1    16221 2013-01-30 11:42 xqj-api-1.0.jar

-rw-rw---- 1   481672 2013-01-30 11:42 xstream-1.4.2.jar

 

Any ideas?. Other projects deployed into that server worked without any problem. I know that I could use JavaClient method for accessing but then the problem is that I cannot recover the result of the query execution, while with XQJ I can:

 

JavaClient:

             log.debug("[BaseX] executing query:"+query);

             ClientSession cSes = new ClientSession(serverNameBaseX, Integer.valueOf(portBaseX), user, pass);

             cSes.setOutputStream(System.out);

             ClientQuery cQuery = cSes.query(query);

             cQuery.execute();

             String res = cQuery.info();             ß This res only stores the execution time and not the result of the query, so it is useless (for me :-) )

             cQuery.close();

 

XQJ:

              XQSequence xq = xqe.executeQuery(query);       ß Instead, this do stores the result of the query (exactly what I want)

 

Thank you and best regards,

 

                C.

 

 

<image001.png>

Carlos Marcos Lagunar

Health Technical Consultant

Research & Innovation

carlos.marcos@atosresearch.eu

Valladolid - Spain

www.atosresearch.eu

es.atos.net

<image002.png>

 

 

------------------------------------------------------------------
This e-mail and the documents attached are confidential and intended 
solely for the addressee; it may also be privileged. If you receive 
this e-mail in error, please notify the sender immediately and destroy it. 
As its integrity cannot be secured on the Internet, the Atos 
group liability cannot be triggered for the message content. Although 
the sender endeavours to maintain a computer virus-free network, 
the sender does not warrant that this transmission is virus-free and 
will not be liable for any damages resulting from any virus transmitted. 

Este mensaje y los ficheros adjuntos pueden contener informacion confidencial 
destinada solamente a la(s) persona(s) mencionadas anteriormente 
pueden estar protegidos por secreto profesional. 
Si usted recibe este correo electronico por error, gracias por informar 
inmediatamente al remitente y destruir el mensaje. 
Al no estar asegurada la integridad de este mensaje sobre la red, Atos 
no se hace responsable por su contenido. Su contenido no constituye ningun 
compromiso para el grupo Atos, salvo ratificacion escrita por ambas partes. 
Aunque se esfuerza al maximo por mantener su red libre de virus, el emisor 
no puede garantizar nada al respecto y no sera responsable de cualesquiera 
danos que puedan resultar de una transmision de virus. 
------------------------------------------------------------------ _______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

 

 
------------------------------------------------------------------
This e-mail and the documents attached are confidential and intended
solely for the addressee; it may also be privileged. If you receive
this e-mail in error, please notify the sender immediately and destroy it.
As its integrity cannot be secured on the Internet, the Atos
group liability cannot be triggered for the message content. Although
the sender endeavours to maintain a computer virus-free network,
the sender does not warrant that this transmission is virus-free and
will not be liable for any damages resulting from any virus transmitted.

Este mensaje y los ficheros adjuntos pueden contener informacion confidencial
destinada solamente a la(s) persona(s) mencionadas anteriormente
pueden estar protegidos por secreto profesional.
Si usted recibe este correo electronico por error, gracias por informar
inmediatamente al remitente y destruir el mensaje.
Al no estar asegurada la integridad de este mensaje sobre la red, Atos
no se hace responsable por su contenido. Su contenido no constituye ningun
compromiso para el grupo Atos, salvo ratificacion escrita por ambas partes.
Aunque se esfuerza al maximo por mantener su red libre de virus, el emisor
no puede garantizar nada al respecto y no sera responsable de cualesquiera
danos que puedan resultar de una transmision de virus.
------------------------------------------------------------------