I have set up an application in Openshift. This application has a 
Tomcat 7 (JBoss EWS 2.0) cartridge. I deploy Web applications to it by 
sending the WAR with an SFTP client. This is a very simple configuration that 
would be straightforward to set up in Openshift.

Inside a servlet, I start a BaseX 
server so that the servlets in this application can use it as clients.I start 
it by calling the following instructions, which work as expected:
String folder = System.getenv("OPENSHIFT_DATA_DIR"); if (folder == null) folder 
= System.getProperty("user.home"); System.setProperty("org.basex.path", folder);
if (false == BaseXServer.ping(host, 15000)) {
server = new BaseXServer("-p15000", "-e15001", "-n" + 
System.getenv("OPENSHIFT_JBOSSEWS_IP"));
}
(Notice that the environment variable "OPENSHIFT_DATA_DIR" indicates the data 
directory of the Openshift application, where BaseX should store databases. 
With this property set, the database path, the repository path and the 
configuration files are all automatically placed relative to this path. I ping 
the server to see if it is already running; if not, I start it. Notice that I 
start the server in port 15000 (event handling port 15001), because these ports 
are available in Openshift. Also, the server is bound to the IP indicated by 
the environment variable OPENSHIFT_JBOSSEWS_IP, which is the internal IP in my 
application.)

The problem is that I can't close this server. When I call server.stop(), a 
"Connection refused" error occurs. I thought this could be a bug, but this may 
also be specific to 
Openshift, because I don't get this error when I execute this simple 
example in my home computer. Here is the stacktrace:


Mar 05, 2014 8:19:33 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [NewServlet] in context with path 
[/basextest] threw exception
java.net.ConnectException: Connection refused at 
java.net.PlainSocketImpl.socketConnect(Native Method) at 
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at 
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
 at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) 
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at 
java.net.Socket.connect(Socket.java:579) at 
java.net.Socket.connect(Socket.java:528) at 
java.net.Socket.<init>(Socket.java:425) at 
java.net.Socket.<init>(Socket.java:208) at 
org.basex.BaseXServer.stop(BaseXServer.java:333) at 
org.basex.BaseXServer.<init>(BaseXServer.java:93) at 
org.basex.BaseXServer.<init>(BaseXServer.java:65) at 
x.NewServlet.processRequest(NewServlet.java:112) at 
x.NewServlet.doGet(NewServlet.java:128) at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at 
javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at
 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
 at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
 at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
 at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
 at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
 at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) 
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) 
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) 
at 
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1008)
 at
 
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
 at 
org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
 at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
Thank you in advance.
_______________________________________________
BaseX-Talk mailing list
[email protected]
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk

Reply via email to