B4J Question [Web App] Only works through localhost...why?

ziovec

Member
Licensed User
Hello there.
I'm trying learn how to publish a simple web app.
I managed to write something that is actually working doing all the tests and debugs locally.

Today I tried to put everything on IIS.
Jar file is running in the background, everything seems to be in the right place/folder.
I can reach the webpage, but none of the code is working :(
If I try to visit the webpage through localhost, everything works as intended.

What am I missing?
I'll attach the whole project, nothing secret in there.

N.B: code needs a .mdb file in a certain directory, for privacy reasons i can't share the db :p
 

Attachments

  • HelpZioVec.zip
    4.9 KB · Views: 140

OliverA

Expert
Licensed User
Longtime User
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
If that could make you feel better, I tried in the past to create a trial web app, I opened the ports in firewall, I was able to see the webapp in my pc from my mobile phone connected in the same wifi but I wasn't able to see it with port forwarding from my router and an "outside" visit. Until now I was not able to find out what's wrong. I have an IIS installed too.

Edit - please note that the webapp jar is by itself a server and it shouldn't be placed in an IIS folder for working. It just opens and accepts connections.
 
Upvote 0

ziovec

Member
Licensed User
What web-page and from where? Local computer? Internet?
A web page hosted on a server.
The server itself should be a virtual machine, I'm not sure about it.

If that could make you feel better, I tried in the past to create a trial web app, I opened the ports in firewall, I was able to see the webapp in my pc from my mobile phone connected in the same wifi but I wasn't able to see it with port forwarding from my router and an "outside" visit. Until now I was not able to find out what's wrong. I have an IIS installed too.

Edit - please note that the webapp jar is by itself a server and it shouldn't be placed in an IIS folder for working. It just opens and accepts connections.
Seems we have the same exact problem!

I placed the html file in a proper folder in inetpub/wwwroot, along with b4j_ws.js and the css, and I can reach it with a given URL.
Jar is also there without a particular reason...guess I can move it elsewhere.

URL is working, but the ws server seems to get no request.

Reaching the exact same spot through localhost:XXXX works fine :rolleyes:
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
I placed the html file in a proper folder in inetpub/wwwroot, along with b4j_ws.js and the css, and I can reach it with a given URL.
Jar is also there without a particular reason...guess I can move it elsewhere
That's the problem. This is not how jServer works. The www folder should be located wherever you place the .jar file produced by B4J. Again, jServer has nothing to do with IIS and does not need/rely on IIS.
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
I think jar should be running in order for the application to work. The js is just an intermediate between the jar and the front end.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
You are right @OliverA. I obviously confused you. I was replying to @ziovec
 
Upvote 0

ziovec

Member
Licensed User
I think jar should be running in order for the application to work. The js is just an intermediate between the jar and the front end.
Sure thing.


That's the problem. This is not how jServer works. The www folder should be located wherever you place the .jar file produced by B4J. Again, jServer has nothing to do with IIS and does not need/rely on IIS.
Sorry, I don't get how the placement of the folder affects the funcionality.

I mean, www folder is in the same folder as the .jar file.

C:\inetpub\wwwroot\URLofmywebsite.com\
Inside here there are www and the jar file. Is that wrong?
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
C:\inetpub\wwwroot\URLofmywebsite.com\
Inside here there are www and the jar file. Is that wrong?
Yes. That's the location for IIS hosted sites. Your B4J application is not an IIS site. Place your .jar and the associated www folder somewhere else. You will also need to enable port forward on your router from some YYYY port on your external side of the router to the XXXX port of your localhost:XXXX address.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
You will also need to enable port forward on your router from some YYYY port on your external side of the router to the XXXX port of your localhost:XXXX address.
Actually, that depends on your network setup...
 
Upvote 0

hatzisn

Expert
Licensed User
Longtime User
Easy steps uncle vec. 1) Place the jar and the folder named www where ever you want 2) Run jar 3) Enjoy 4) To be able to see your web app from outside you will have to open the incoming connection in your jar's port in the firewall and also do some port forwarding from the router to your pc in this port (your pc has to have a fixed local IP in your LAN)

Does vec come from vecchio?
 
Upvote 0

ziovec

Member
Licensed User
Yes. That's the location for IIS hosted sites. Your B4J application is not an IIS site. Place your .jar and the associated www folder somewhere else. You will also need to enable port forward on your router from some YYYY port on your external side of the router to the XXXX port of your localhost:XXXX address.
Thanks a lot, now it works! :D

Does vec come from vecchio?
Yes and No :p
It comes from "Vecchio" (my actual surname) and "Vecna", a fictional divinity from Dungeons&Dragons ^^
I'd rather being called Vec because my surname means "Old" :confused:
 
Upvote 0
Top