There can be many reasons. Listing all of them here would blow up my reply and would provide you may items to check.
Let’s try to first analyze the problem a bit more in detail:
what is the content of the log file /var/log/openhab/openhab.log assumed you installed OH3. In case you have OH2 it is located at /var/log/openhab2/openhab.log
Is my suspicion that you’re trying to hit localhost:8080 from a machine that isn’t your RPi4?
If that’s the case, change “localhost” to “openhabiandevice”, or the ip address for openhabiandevice.
Localhost is relative to the computer making the statement, it literally means “this device”.
If that’s no help, try working through where the blockage is. If you type netstat -ln into a command prompt on the RPi4, it will show you all listening ports on that machine. look for anything with :8080 on it.
0.0.0.0:8080 means all interfaces are listening,
127.0.0.1:8080 means just the local host
192.168.xxx.xxx:8080 means it is listening on that address (if you swap the xxxs for numbers)
So this will tell you if the web server service is running and listening for connections.
If it’s not, that will be why you can’t connect. If it is, then seriously you should be able to hit it.