B4J Question VPS .jar error

yfleury

Active Member
Licensed User
Longtime User
Hi all!
After 3 long days to learn and setup a vps. is runing with a sigle web page: index.html
So I can do a static web or dynamic one in php mysql.

but I want to run a java web server with my .jar file.
I have java install on vps
I run my jar with
B4X:
/var/www/vhosts/mydomain.com# java -jar result.jar

But I have this error and I am stuck here. some help needed
B4X:
---------------> main
2023-04-09 01:44:36.663:INFO :cmvl.MLog:MLog-Init-Reporter: MLog clients using slf4j logging.
2023-04-09 01:44:37.141:INFO :cmvc.C3P0Registry:main: Initializing c3p0-0.9.5.2 [built 08-December-2015 22:06:04 -0800; debug? true; trace: 10]
2023-04-09 01:44:37.674:INFO :oejs.Server:main: jetty-11.0.9; built: 2022-03-30T17:44:47.085Z; git: 243a48a658a183130a8c8de353178d154ca04f04; jvm 11.0.18+10-post-Debian-1deb10u1
main._appstart (java line: 142)
java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:2100
        at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344)
        at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:304)
        at org.eclipse.jetty.server.Server.lambda$doStart$0(Server.java:401)
        at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
        at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
        at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
        at org.eclipse.jetty.server.Server.doStart(Server.java:397)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
        at anywheresoftware.b4j.object.ServerWrapper.Start(ServerWrapper.java:266)
        at b4j.example.main._appstart(main.java:142)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
        at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
        at b4j.example.main.main(main.java:28)
Caused by: java.net.BindException: Address already in use
        at java.base/sun.nio.ch.Net.bind0(Native Method)
        at java.base/sun.nio.ch.Net.bind(Net.java:459)
        at java.base/sun.nio.ch.Net.bind(Net.java:448)
        at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
        at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:339)
        ... 23 more

main.main (java line: 28)
java.lang.RuntimeException: java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:2100
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:140)
        at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
        at b4j.example.main.main(main.java:28)
Caused by: java.io.IOException: Failed to bind to 0.0.0.0/0.0.0.0:2100
        at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344)
        at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:304)
        at org.eclipse.jetty.server.Server.lambda$doStart$0(Server.java:401)
        at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
        at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
        at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
        at org.eclipse.jetty.server.Server.doStart(Server.java:397)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:93)
        at anywheresoftware.b4j.object.ServerWrapper.Start(ServerWrapper.java:266)
        at b4j.example.main._appstart(main.java:142)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
        ... 2 more
Caused by: java.net.BindException: Address already in use
        at java.base/sun.nio.ch.Net.bind0(Native Method)
        at java.base/sun.nio.ch.Net.bind(Net.java:459)
        at java.base/sun.nio.ch.Net.bind(Net.java:448)
        at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:227)
        at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:339)
        ... 23 more
 
Solution
I will try that.
From internet, how to access the java web server : mydomain.com:8000 ? Or is it possible to acces it to port 80?

yfleury

Active Member
Licensed User
Longtime User
I set Let's encrypt ssl and apache are port 443 on vps. I can download .pem file.
In my personal computer a make keystores file. But browser warm me because he can check validity. Next, I check for openssl.
 
Upvote 0

yfleury

Active Member
Licensed User
Longtime User
I will start another thread because we discute about 2 differents things.
To continu discusion about ssl, go to
 
Upvote 0
Top