thanks for asking. The problem has now been reduced to a persistent error that blocks communication between a basex xquery and a local Flask server. Error 500 is constantly displayed in the browser, while no error is displayed in the basex log. A curl query also works smoothly. The BaseX version 9.1 I've been using so far has never had any problems with it. I've reduced the basex environment to an absolute minimum, just one file that makes an http:send request. Here's the small xquery code:
xquery version "3.0";
module namespace test = "http://example.com/test";
import module namespace http = "http://expath.org/ns/http-client";
declare
%rest:path("test-flask")
%rest:GET
%output:method("xml")
function test:call-flask() {
let $url := "http://127.0.0.1:5003/search"
(: Create the JSON payload as a string :)
let $payload := serialize(
map {
"query": "Krieg",
"autor": "hvk",
"genre": "",
"top_k": "5"
},
map {"method": "json"}
)
(: Create the request element. It does NOT contain a body. :)
let $request :=
<http:request href="{$url}" method="post">
<http:body media-type="application/json"/>
</http:request>
(: Execute the request.
Argument 1: the request element.
Argument 2: is empty in this case, since the URL is in the request element.
Argument 3: the body/payload.
:)
let $response := http:send-request($request, (), $payload)
return
<result>
<status>{$response[2]/@status}</status>
<body>{try { fn:parse-xml($response[1]) } catch * { $response[1] }}</body>
</result>
};
As mentioned, BaseX v9.1 didn't cause any problems here. Here's an excerpt from the old code that produces the same problems in BaseX v12.0.
let $search-results :=
if ($query) then
let $url := "http://localhost:5003/search"
let $request :=
<http:request
href="{$url}"
method="post">
<http:body
media-type="application/json">
{
serialize(
map {
"query": $query,
"top_k": $top_k,
"author": $author,
"genre": $genre
},
map {"method": "json"}
)
}
</http:body>
</http:request>
let $response := http:send-request($request)
let $response-body := $response
return
(
if ($response-body) then
<div>{$response-body}</div>
else
<p>Search error: No answer found.</p>
)
else
()
Any information is helpful. Thank you in advance.
Günter
Am 04.08.2025 um 17:13 schrieb Christian Grün <cg@basex.org>:
Dear Günter,
You may need to supply us with some more information to make this better reproducible:
• Which distribution of BaseX do you use (ZIP, Windows installer, …)?
• Did you write the systemd service on your own? What does it do?
• Where did the instructions come from (Fügen Sie den Inhalt Ihrer web.xml bei)?
Thanks in advance,
Christian
Von: Günter Dunz-Wolff <guenter.dunzwolff@gmail.com>
Gesendet: Montag, 4. August 2025 11:44
An: basex-talk@mailman.uni-konstanz.de <basex-talk@mailman.uni-konstanz.de>
Betreff: [basex-talk] Migration einer alten RESTXQ-Anwendung nach BaseX 12.0 - ClassNotFoundException für Servlets
"Ich migriere eine bestehende Anwendung von einer alten BaseX-Version auf BaseX 12.0."
"Mein systemd-Dienst startet den Server, aber die Anwendung schlägt mit einem 503-Fehler fehl."
"Das Log zeigt java.lang.ClassNotFoundException für org.basex.http.rest.RestServlet und org.basex.http.restxq.RestXqServlet."
Fügen Sie den Inhalt Ihrer web.xml bei.
Frage: "Wie lauten die korrekten Klassennamen und die korrekte web.xml-Konfiguration, um REST und RESTXQ in BaseX 12.0 zu aktivieren?"