• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Accessing Database from Webservice (Tomcat)

DominikE

New Pleskian
Hello,

I have a problem accessing the database via webservice using tomcat.

I can access the database via ssh using
mysql -uadmin -p$(cat /etc/psa/.psa.shadow)

I dont like that because the cleartext password is not accepted.

The Service worked find bevore Plesk was installed.

Plesk changes the user root to admin and sets a password.

I can access via
mysql -uadmin -p"CONTENT OF .psa.shadow"

The content of .ps.shadow is the password i use in my webservice to connect.

Now my question is how to enable access over my webservice ?

i read about problems accessing database remotely, but it should be fixed within version 8.5
and be enabled by default (> Plesk version 8)

I get the following error:
HTTP 500 ERROR
type Exception report
description The server encountered an internal error that prevented it from fulfilling this request.
exception java.lang.NullPointerException
RESTest.status.V1_Status.returnStatus(V1_Status.java:43)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:606)
com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)
com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)


---------------------------------------------------------------------------------------------------------------------------
Guten Tag,

Ich habe eine kleine Frage...
Vorab hier die Problemstellung. Ich betreibe den Server mit Debian 7, Tomcat und Plesk.
Plesk hat den MySQL Benutzer root in admin umbenannt und ein Passwort festgesetzt.
Über SSH komme ich prima auf die Datenbank, genau wie über PHPMyadmin.
Tomcat benutze ich, weil ich einen Webservice bereitstellen möchte, der Zugriff auf die Datenbank hat.

Mit der Standard Konfiguration (Debian 6 und Confixx) funktioniert das. Es liegt also an der Plesk Installation.
Mich ärgert schon, dass ich beim Login auf den Server folgendes eingeben muss:
mysql -uadmin -p$(cat /etc/psa/.psa.shadow)
also das Passwort im Klartext nicht akzeptiert wird.

Hier scheint offenbar auch der Fehler mit dem Webservice zu liegen, dachte ich zumindest.
Der Login funktioniert aber auch mit dem Befehl
mysql -uadmin -p"INHALT DER .psa.shadow"

Diesen Inhalt gebe ich nun meinem Webservice als Passwort und erhalte immernoch einen Fehler.
HTTP 500 ERROR
type Exception report
description The server encountered an internal error that prevented it from fulfilling this request.
exception java.lang.NullPointerException

Wie gesagt: Es hat sich nichts weiter geändert, als PLESK.

Ist es möglich, dass PLESK verhindert, dass man Zugriff "von außen" auf die Datenbank hat ?
Muss ich das erst freischalten ?

In der Dokumentation von Plesk steht dazu folgendes:
"Ab Version 8 ist der Remote Zugriff auf MySQL per default erlaubt"

Ich habe die neuste Version...

Ich bitte um Hilfestellung, danke !

----------------------------------------------------------------------------------------------------------------
 
Back
Top