B4J Question [SOLVED][ABMaterial] Mini Template - should it run as-is?

Andris

Active Member
Licensed User
Longtime User
I followed the instructions exactly as described in the ABMaterial Mini template tutorial and although it says it's for absolute beginners, I can't make it run as-is . All the necessary libraries are where they should be. What I get in the log is:


... and when I go to http://localhost:51042/template, I get an HTTP 404 message.

Can someone tell me what I'm missing?
 

Andris

Active Member
Licensed User
Longtime User
java.net.BindException: Address already in use: bind

This is the important bit. It is a B4J error that says there is already one app running on that port 51042

So how would you proceed here? Just change the port to a different number and hope for the best?
B4X:
Sub AppStart (Args() As String)
    ' must be the first line in AppStart. DO NOT DELETE OR CHANGE!
    ' ------------------------------------------------------------
    ABM.SessionCacheControlV3 = "ABMCacheV3"
    ' ------------------------------------------------------------
   
    Dim DonatorKey As String = ""
    Server.Initialize("", DonatorKey, "template") ' Application = ' the handler that will be used in the url e.g. http://localhost:51042/template
    ' some parameters
    Server.Port = 51042
 
Upvote 0

alwaysbusy

Expert
Licensed User
Longtime User
and hope for the best?
Well, I don't know your computer of course and what ports you do use. The point is this not even an ABM problem, as you wouldn't be able to run any B4J jServer app (or any app in any language for that matter) running on port 51042 because it is already in use by something.

I would use a tool like TCPView (https://docs.microsoft.com/en-us/sysinternals/downloads/tcpview) and try to find out what is already running on this port. If it is something that you don't know, it may be some Trojan using that port.
 
Upvote 0

Andris

Active Member
Licensed User
Longtime User

Happy to report success. I had in fact used a tool and discovered that something else was occupying 51042. Restarting my laptop removed it and now Mini Template executes as it should. My theory is that in trying to get it to work, I had already an instance of it running, but incorrectly, and it remained even after restarting B4J. Would that make sense?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…