Dynamic Webservices project -- can only connect over localhost - java

I'm running a RESTful webservice created in Eclipse Java EE using TomCat 7.0. I test it using a web browser. It will connect over the localhost, but not with the remote IP. It used to work with an IP, and then I moved my project to a Git repository so I could upload it to Github. Now it's not working for an IP. Not really sure what's up.
Any ideas? Firewalls are off too.
Bonus: I also have the small red x error icon on my project. I can't find any errors and it compiles fine and works fine as long as it's localhost. How the heck do I get rid of the x icon?
Edit: Works with a local IP. I was testing this on a college network earlier. Now I'm on a home network. Any comments?

Hope the following article helps :
www.sitepoint.com/accessing-localhost-from-anywhere
Incase you also have trouble accessing via localhost refer to all the answers for this post:
stackoverflow.com/questions/2280064/tomcat-started-in-eclipse-but-unable-to-connect-to-http-localhost8085
The question is missing many details like logs.. url and configuration for tomcat to give you a specific answer

Related

Issue remotely debugging java cloud application with vscode

I figured i'll post the question on stackoverflow as well. https://github.com/Microsoft/vscode-java-debug/issues/450
I'm having issue remotely debugging an azure function that is deployed to azure. I'm following the following instruction https://github.com/Microsoft/vscode-docs/blob/master/docs/java/java-azurefunctions.md.
I'm using https://www.npmjs.com/package/cloud-debug-tools which successfully connects, but I get an exception when i try to remotely connect to the debug port via vscode.
Thanks,
Derek
Looks like this question is already getting traction on GitHub: https://github.com/Azure/azure-functions-host/issues/2986. I suggest following up there since the product team is already investigating.

Deploying webservice on remote machine

This might sound a very basic question for the N/W gurus so please try to help me here.
I have developed a simple Webservice in Java and deployed it on a local machine using Eclipse/Ant. The path looks like this -
http://localhost:8284/myws?wsdl
Now, I have provided a static IP for the local machine say XX.XX.XXX.XX and I can ping it from any remote machine over internet.
In my Java program, I have provided endpoint name as -
"http://localhost:8284/myws" and it works fine on local machine and opens the wsdl just fine in a browser.
Now, I want to deploy this webservice in a way that, I can access it remotely using my static IP i.e XX.XX.XXX.XX
Problem 1:
When I try to assign the endpoint as
"http://XX.XX.XXX.XX:8284/myws" my Java program gives error saying
Server Runtime Error: java.net.BindException: Cannot assign requested address: bind
Problem 2:
If I deploy it as "http://localhost:8284/myws", I am not able to access it over internet using URL like http://XX.XX.XXX.XX:8284/myws?wsdl.
Things I have did so far - -
a. Turned off the firewall
b. Created 2 rules inbound/outbound with port 8284 allowed.
My question is, will I need a router to do a port-forwarding thing? Or will I need an IIS to deploy it?
I really want to ignore both of them. If there is any simple way to do that please let me know. Am I missing something? I am able to ping the IP and can also connect through RDC.
Info -
Machine is on Windows 7.
Any help will be greatly appreciated.
Thanks.
I got it solved. I used http://0.0.0.0:8284/cal while binding and not localhost:8284/cal
Works like a gem now! Hope it helps someone.
Regards,
Bhushan.

How to debug Java Server working for localhost but not public IP

Noob question but I'm not sure where to look:
I'm running a Java Web App on a remote linux machine (Jersey RESTful API is the goal). The server successfully runs and can handle requests locally to localhost:8080/foobar but I cannot make requests to the various urls from anywhere else (For example, my laptop through a browser).
This is a simple problem I've have many times but have no idea what terms to search on google or where to look for help debugging the problem, so any leads or advice would be greatly appreciated.
Further details:
Project is code added to a Maven2 generated archetype of a Jersey Service
This is most likely caused by firewalling on the server or in front of the internal network your server is running on. Talk to your network administrators about opening a hole for port 8080, or consider using a reverse proxy on port 80 (if open) to forward requests to port 8080. See http://en.wikipedia.org/wiki/Reverse_proxy if you are not familiar with the idea of a reverse proxy or load balancers.
Change the localhost entry in your "/etc/hosts" file, with the network configs, and if server is tomcat, edit the $CATALINA_HOME/conf/server.xml to add IP the relevant <Connector> element.
Make sure you have better idea handling /etc/hosts

GWT Remote Debugging

I'm trying to do a remote debug session for my GWT app.
I added an entry in the GWT plugin running on a Firefox instance in the remote machine:
Host Name | Code Server
[IP address] [127.0.0.1]
However, I'm am still not able to access the GWT app even though I can ping the IP address with the specific port: 8888
Any ideas?
If I understood you right you're trying to connect your client to the remote server and debug client? I'm always debugging using Eclipse IDE. So:
you run debug mode in your Eclipse.
put in your browser url like
http://remotedomain.com:8888/?gwt.codesvr=127.0.0.1:9997 where
gwt.codesvr is your local(!) machine.
Now, you are able to talk to the remote server, but your client-side code is from inside your machine. You can use all power of the Eclipse to debug.
Hope this will help you.

Java Applet: JDBC-mysql work in eclipse but not in the browser

I have a weird problem. My java applet work fine in my IDE (Eclipse), no errors whatsoever. It still "work" when I run the applet in my browser, but it can't connect to my remote mysql database. Is there any reason as to why it wont connect to a remote mysql-database in the browser, while it will in Eclipse? Where are the error logs placed? Are there any good applet debugging tools?
connect = DriverManager.getConnection("jdbc:mysql://178.0.0.0:3306/database","username", >"password" );
Is your applet unsigned? There are security restrictions around applets that prevent them from connecting to servers other than the ones they were downloaded from.
http://download.oracle.com/javase/tutorial/deployment/applet/security.html
I'm guessing it a permissions problem in MySQL. It needs to know the machine from which you connect in addition to credentials.

Categories

Resources