0
Under review

Unable to start Ubooquity.jar in Ubuntu 18.04 after trying to set up NGINX reverse proxy

[rab] 4 months ago updated 1 month ago 10

I have been using Ubooquity for several years, but recently I have been trying to set up NGINX for reverse proxy with TLS enabled via LetsEncrypt/Certbot on the horizon.

I was following along with some of the comments here and set up my ubooquity_reverse_proxy.conf file like this:

<code>server {
listen 2204;
listen 2205;


server_name ubooquity;

location /library {
proxy_pass http://my.subdomain.here:2204;
}

location /library/admin {
proxy_pass http://my.subdomain.here:2205;
}

}</code>

I kept getting error messages in NGINX saying that ports 2204 and 2205 were already being used and would fail to start.

I tried to kill the processes that may have been listening on those ports, but by the time I got NGINX to start, it would direct me to a 500 error page for /library/admin and a 404 for /library.

When I tried running the jar via the command line it would not start. Initially I got errors saying the DB was already being used. I checked but there were no other instances of Ubooquity running. So I backed up my database and deleted that version out of my /opt/ubooquity directory.

Now when I try to run Ubooquity.jar i get a different error:

<code>

20200317 22:36:24 [main] INFO com.ubooquity.Ubooquity - #############################
20200317 22:36:24 [main] INFO com.ubooquity.Ubooquity - # Starting Ubooquity #
20200317 22:36:24 [main] INFO com.ubooquity.Ubooquity - #############################
20200317 22:36:24 [main] INFO com.ubooquity.Ubooquity - Java version: 1.8.0_242
20200317 22:36:24 [main] INFO com.ubooquity.Ubooquity - Java vendor: Private Build
20200317 22:36:24 [main] INFO com.ubooquity.Ubooquity - java vm name: OpenJDK 64-Bit Server VM
20200317 22:36:24 [main] INFO com.ubooquity.Ubooquity - java runtime name: OpenJDK Runtime Environment
20200317 22:36:24 [main] INFO com.ubooquity.Ubooquity - Max heap size available: 7125 MB
20200317 22:36:24 [main] INFO com.ubooquity.Ubooquity - OS name: Linux
20200317 22:36:24 [main] INFO com.ubooquity.Ubooquity - OS version: 5.3.0-40-generic
20200317 22:36:24 [main] INFO com.ubooquity.Ubooquity - OS architecture: amd64
20200317 22:36:24 [main] INFO com.ubooquity.Ubooquity - Loading local version info
20200317 22:36:24 [main] INFO com.ubooquity.Ubooquity - Ubooquity 2.1.2 built on 2018-10-14 at 12:58
20200317 22:36:24 [main] INFO com.ubooquity.Ubooquity - Creating application folders
20200317 22:36:24 [main] INFO com.ubooquity.Ubooquity - Loading preferences
20200317 22:36:25 [main] INFO org.eclipse.jetty.util.log - Logging initialized @1536ms to org.eclipse.jetty.util.log.Slf4jLog
java.lang.NoClassDefFoundError: javafx/fxml/Initializable
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:757)
at com.ubooquity.e.a.d(SourceFile:597)
at com.ubooquity.e.a.loadClass(SourceFile:962)
at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
at com.ubooquity.a.(SourceFile:19)
at com.ubooquity.Ubooquity.main(SourceFile:246)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.ubooquity.e.a.a(SourceFile:823)
at com.ubooquity.Launcher.main(SourceFile:10)
Caused by: java.lang.ClassNotFoundException: Failure to load: javafx.fxml.Initializable
at com.ubooquity.e.a.loadClass(SourceFile:992)
at java.lang.ClassLoader.loadClass(ClassLoader.java:352)
... 13 more
20200317 22:36:25 [Thread-2] INFO com.ubooquity.b - Stopping internal server...
20200317 22:36:25 [Thread-2] INFO com.ubooquity.data.feeder.a - Aborting content scan...
20200317 22:36:25 [Thread-2] ERROR com.ubooquity.b - Error while stopping internal server
java.lang.NullPointerException: null
at com.ubooquity.d.e.a(SourceFile:99) ~[Ubooquity.jar:2.1.2]
at com.ubooquity.b.c(SourceFile:112) ~[Ubooquity.jar:2.1.2]
at com.ubooquity.Ubooquity.C(SourceFile:216) [Ubooquity.jar:2.1.2]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_242]
20200317 22:36:25 [Thread-2] INFO com.ubooquity.b - Internal server stopped
20200317 22:36:25 [Thread-2] INFO com.ubooquity.Ubooquity - Ubooquity has closed.</code>

I checked and I'm running Java 8 so I can't figure out what it could be.

Any help would be greatly appreciated.

i don't know how to format for codeblocks in this forum, i tried using the html <code> </code> tags, but that didn't work. please ignore those if you see them above and think they are causing issues.

Under review

Try launching it with the --headless command line option.

--headless
Use it if you don’t want the Ubooquity interface to be displayed, or to avoid compatibility issues on devices with no graphical environment (e.g. NAS).

That launched Ubooquity, but now when I try to access via web gui I get 500 errors again:

I tried backing everything up in a separate folder and just starting with a fresh Ubooquity.jar from the website. Getting a different error now:

20200318 14:45:40 [main] INFO com.ubooquity.Ubooquity - Running with the following parameters - headless: true, libraryport: 2204, adminport: 2205, remoteadmin: true, host: null, debug: false, execdir: /opt/ubooquity
20200318 14:45:40 [main] INFO com.ubooquity.Ubooquity - #############################
20200318 14:45:40 [main] INFO com.ubooquity.Ubooquity - # Starting Ubooquity #
20200318 14:45:40 [main] INFO com.ubooquity.Ubooquity - #############################
20200318 14:45:40 [main] INFO com.ubooquity.Ubooquity - Java version: 1.8.0_242
20200318 14:45:40 [main] INFO com.ubooquity.Ubooquity - Java vendor: Private Build
20200318 14:45:40 [main] INFO com.ubooquity.Ubooquity - java vm name: OpenJDK 64-Bit Server VM
20200318 14:45:40 [main] INFO com.ubooquity.Ubooquity - java runtime name: OpenJDK Runtime Environment
20200318 14:45:40 [main] INFO com.ubooquity.Ubooquity - Max heap size available: 7125 MB
20200318 14:45:40 [main] INFO com.ubooquity.Ubooquity - OS name: Linux
20200318 14:45:40 [main] INFO com.ubooquity.Ubooquity - OS version: 5.3.0-40-generic
20200318 14:45:40 [main] INFO com.ubooquity.Ubooquity - OS architecture: amd64
20200318 14:45:40 [main] INFO com.ubooquity.Ubooquity - Loading local version info
20200318 14:45:40 [main] INFO com.ubooquity.Ubooquity - Ubooquity 2.1.2 built on 2018-10-14 at 12:58
20200318 14:45:40 [main] INFO com.ubooquity.Ubooquity - Creating application folders
20200318 14:45:40 [main] INFO com.ubooquity.Ubooquity - Loading preferences
20200318 14:45:40 [main] INFO com.ubooquity.Ubooquity - Saving preferences
20200318 14:45:41 [main] INFO org.eclipse.jetty.util.log - Logging initialized @1765ms to org.eclipse.jetty.util.log.Slf4jLog
20200318 14:45:41 [main] INFO com.ubooquity.b - Starting internal server...
20200318 14:45:41 [main] INFO com.ubooquity.b - Reverse proxy prefix is not activated
20200318 14:45:41 [Scanner thread] INFO com.ubooquity.data.feeder.a - Scanning books directories
20200318 14:45:41 [Scanner thread] INFO com.ubooquity.data.feeder.a - Finished scanning books directories, populating folders content cache
20200318 14:45:41 [Scanner thread] INFO com.ubooquity.data.feeder.a - Books folder content cache populated
20200318 14:45:41 [Scanner thread] INFO com.ubooquity.data.feeder.a - Scanning comics directories
20200318 14:45:41 [Scanner thread] INFO com.ubooquity.data.feeder.a - Finished scanning comics directories, populating folders content cache
20200318 14:45:41 [Scanner thread] INFO com.ubooquity.data.feeder.a - Comics folder content cache populated
20200318 14:45:41 [Scanner thread] INFO com.ubooquity.data.feeder.a - Comics statistics: [total: 0, added or updated: 0, removed: 0]
20200318 14:45:41 [Scanner thread] INFO com.ubooquity.data.feeder.a - Books statistics: [total: 0, added or updated: 0, removed: 0]
20200318 14:45:41 [main] INFO org.eclipse.jetty.server.Server - jetty-9.4.0.v20161208
20200318 14:45:41 [main] INFO o.e.j.server.handler.ContextHandler - Started o.e.j.s.h.ContextHandler@536f2a7e{/,null,AVAILABLE,@admin}
20200318 14:45:41 [main] INFO o.e.j.server.handler.ContextHandler - Started o.e.j.s.h.ContextHandler@72bc6553{/,null,AVAILABLE,@library}
20200318 14:45:41 [main] ERROR com.ubooquity.Ubooquity - Exiting application because of exception
org.eclipse.jetty.util.MultiException: Multiple exceptions
at org.eclipse.jetty.server.Server.doStart(Server.java:416) ~[jetty-server-9.4.0.v20161208.jar.6831686875779823992.tmp:9.4.0.v20161208]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) ~[jetty-util-9.4.0.v20161208.jar.8141124450067202531.tmp:9.4.0.v20161208]
at com.ubooquity.d.e.a(SourceFile:90) ~[Ubooquity.jar:2.1.2]
at com.ubooquity.b.a(SourceFile:95) ~[Ubooquity.jar:2.1.2]
at com.ubooquity.Ubooquity.main(SourceFile:222) ~[Ubooquity.jar:2.1.2]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_242]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_242]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_242]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_242]
at com.ubooquity.e.a.a(SourceFile:823) [Ubooquity.jar:2.1.2]
at com.ubooquity.Launcher.main(SourceFile:10) [Ubooquity.jar:2.1.2]
Suppressed: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_242]
at sun.nio.ch.Net.bind(Net.java:433) ~[na:1.8.0_242]
at sun.nio.ch.Net.bind(Net.java:425) ~[na:1.8.0_242]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:220) ~[na:1.8.0_242]
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85) ~[na:1.8.0_242]
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:298) ~[jetty-server-9.4.0.v20161208.jar.6831686875779823992.tmp:9.4.0.v20161208]
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80) ~[jetty-server-9.4.0.v20161208.jar.6831686875779823992.tmp:9.4.0.v20161208]
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:236) ~[jetty-server-9.4.0.v20161208.jar.6831686875779823992.tmp:9.4.0.v20161208]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) ~[jetty-util-9.4.0.v20161208.jar.8141124450067202531.tmp:9.4.0.v20161208]
at org.eclipse.jetty.server.Server.doStart(Server.java:431) ~[jetty-server-9.4.0.v20161208.jar.6831686875779823992.tmp:9.4.0.v20161208]
... 10 common frames omitted
Caused by: java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_242]
at sun.nio.ch.Net.bind(Net.java:433) ~[na:1.8.0_242]
at sun.nio.ch.Net.bind(Net.java:425) ~[na:1.8.0_242]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:220) ~[na:1.8.0_242]
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85) ~[na:1.8.0_242]
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:298) ~[jetty-server-9.4.0.v20161208.jar.6831686875779823992.tmp:9.4.0.v20161208]
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80) ~[jetty-server-9.4.0.v20161208.jar.6831686875779823992.tmp:9.4.0.v20161208]
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:236) ~[jetty-server-9.4.0.v20161208.jar.6831686875779823992.tmp:9.4.0.v20161208]
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68) ~[jetty-util-9.4.0.v20161208.jar.8141124450067202531.tmp:9.4.0.v20161208]
at org.eclipse.jetty.server.Server.doStart(Server.java:431) ~[jetty-server-9.4.0.v20161208.jar.6831686875779823992.tmp:9.4.0.v20161208]
... 10 common frames omitted

Subsequent restarts give me the "database already in use" errors.

Caused by: java.net.BindException: Address already in use

You have to uUse different ports and paths when running several Ubooquity instances at the same time.

+1

I think Ubooquity was not exiting cleanly. After I stopped the process or it crashed itself, the ports were still showing as being in use. I was able to kill the java processes tying up the ports in question and now I can load run the program again.

how did you go about fixing this?? I've been getting that same error (the second one) for over a week. port 2202 and 2203 don't seem occupied or being used in my case

in Ubuntu I just killed the java process and then ran my start command again

sudo pkill -9 java

sudo nohup java - jar Ubooquity.jar

i was only running a single instance. Whenever I had to restart my box or if Ubooquity crashed I would get the"already in use" error message even though no instance of Ubooquity was running.


I found that if I get that error and I kill the entire java process I can get it to start cleanly again.

I'm only running a single instance of Ubooquity on ports 2204 and 2025.