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.
Carlos Marcos Lagunar
Health Technical Consultant
Research & Innovation
Valladolid - Spain
es.atos.net