tomcat 7 change localhost to ip address/hostname - java

I have deployed tomcat 7 on unix server. Application is working properly in its internal text mode browser which is elinks.
My server ip is 190.0.0.1 and hostname is test123. In elink i entered the URL http://localhost:9999/Test, then the application is working properly.
But whenever i tried to access the application hitting URL http://190.0.0.1:9999/Test, than it is not working. I checked the logs there is no error message in it.
May be some configuration issue i have to change but dont know which?

Please issue hostname -i in your unix box to get the ip address of your machine. Example:
[ssivan#wsapp403p.prod.ch4 conf]$ hostname -i
10.236.55.42
Then you can try with that ip address. Example:
http://10.236.55.42:9999/Test

Related

how run two servlets in the same local host?

I was implemented two different servlets in two different web projects in netbeans using tomcat server. When try to run html file for one servlet in one project it running, but when trying to run another servlet in second project the following message appear in browser. This site cannot be reashed in localhost 8080 and localhost refused to connect.
I try to solve it by following steps in cmd:
1-ipconfig /release
2-ipconfig /all
3-ipconfig /flushdns
4-ipconfig /renew
5-netsh int ip set dns
6-netsh winsock reset
and try close proxy and windows firwall but the problem is still.
You are trying to serve requests with 2 programs in the same port, which can't be done. What would you expect it would happen if you went to localhost:8080? Both of them would be serving requests in that port, so the OS doesn't allow it.
You can go to tomcat>conf folder in one of the projects, and edit the server.xml file.
There should be a line saying Connector port. Replace "8080" for other port, for example "8081" and start tomcat.

tomcat start but can't listen from another pc

I am running tomcat in linux pc whose ip address is 192.168.1.31 and port number is 8084 . I have tested it via the following url :
http://192.168.1.31:8084/
The welcome message is come as depicted int he following picture :
But when I enter the above address from another pc (windwos 10 ) , I am getting this error :
This site can’t be reached
192.168.1.31 took too long to respond.
Search Google for 201 8084
ERR_CONNECTION_TIMED_OUT
I have firewall off . I cant understand where is the error . Please help me .
IP address which starts with192.168. by default is for local network, so if your windows machine isn't in this network it actually can't reach your tomcat. Check ipconfig on your windows machine and try to find address which starts from 192.168. to find it out.
Also you can change your tomcat bind address in the config file tomcat/conf/server.xml and bind tomcat to public IP address.
Another solution is to configure your iptables to forward traffic from some port of your public IP to the port 8084 on your local network.

Connect JVisualVM to a Remote Wildfly Instance?

I'm trying to connect JVisualVM, running on my local machine, to a remote machine which is running a WildFly server (version 8.1.0, to be specific.)
I didn't configure the WildFly server myself, and I don't know who did, but I do know that I can log in as an administrative user from my local machine by pointing my browser at:
https://[ip address of the remote machine]:9443/console
Note that it's https, not ordinary http, and that the port for that has been set to 9443 (I think the default is 8080 or 9990 or something... IDK, I saw a lot of port numbers online. I have been explicitly told that http was disabled for this WildFly server).
I can SSH into the remote machine. I can navigate to the bin directory for WildFly and run jboss-client.sh. I have to connect on port 9999 (I think the default is 9990 for that?)
I copied the jboss-client.jar (under bin/client) to my local machine and ran JVisualVM from the command line like this:
.\jvisualvm.exe -cp:a C:\[path to]\jboss-client.jar
It launches fine. File > Add Remote Host: Then I entered the IP. OK. I right clicked on it under Remote in the tree and picked Add JMX Connection. I entered
service:jmx:http-remoting-jmx://[ip]:9999
I checked off that I wanted to use the security credentials and entered the username and password. Checked off to save the security credentials. Left "Do not require SSL Connection" unchecked. Hit OK. It immediately spat out the message
Cannot connect to admin#service:jmx:http-remoting-jmx://[ip]:9999 using service:jmx:http-remoting-jmx://[ip]:9999
I also tried the port 9443, 9990, and 8080 instead. None of those worked. I tried https instead of http in the protocol name. That also didn't work.
What am I missing? How is it that I can access the console, and connect with jboss-client.sh, but I can't use JVisualVM? Is there some log I can use somewhere to see what's wrong? Maybe someone can point out a configuration I've missed somewhere?
Not sure if it's important or not, but my local machine is running Windows 10 with JDK8 installed. The WildFly server is using Java 6 on CentOS 6.3.
You need to add the jboss-client.jar (or jboss-cli-client.jar) to the class path for JVisualVM. The library can be found in the bin/client directory of the WildFly install.
I used the following command to add the library to the class path.
jvisualvm --cp:a ~/servers/wildfly-10.0.0.Final/bin/client/jboss-client.jar
Then I used service:jmx:remote+http://[ip]:[port] and was able to connect.
I don't know if someone else is also (still) having the same issue (Wildfly10 on a remote machine where management console is available at 9443 with HTTPS). The following worked for me.
For ssh connections:
Starting jvisualvm with jboss-client.jar
jvisualvm --cp:a #JBOSS_HOME/bin/client/jboss-client.jar
Using the following connection string:
service:jmx:remote+https://remote-server:9443
NOTE: I used here remote+https
Provide username and password
Hope this helps.
you missed run jstatd command in remote host ,
this little program is RMI server that possible connection from client to remote host though you using jmx connection it used jmxrmi protocol for that connection .
so first in remote host create file name as security.policy with this contain :
grant codebase "file:${java.home}/../lib/tools.jar" {
permission java.security.AllPermission;
};
off course you must in file section for linux put explicit path and then of creation this file put it in bin directory of jdk.home
then you should run this command on remote host
$JAVA_HOME/bin/jstatd -J-Djava.security.policy=path of /security.policy -J-Djava.rmi.server.hostname=remote ip address -J-Djava.net.preferIPv4Stack=true
then you could connect to server off course with correct settings.
Include jboss-cli-client.jar and jboss-client.jar under \lib\visualvm\platform\lib and restart jvisualvm to pickup new jars.

WSDL Client Unable to Resolve Domain Name

Recently i am working with DNS RR.I have DNS Server with domain Name configured with two Ip where apache httpd services are running...
DNS Server :xx.xx.xx.58,Domain Name:xxx.xxx.sam.com,httpdNode1 :xx.xx.xx.21,htttpdNode2 :xx.xx.xx.22.
From client machine xx.xx.xx.27 ping to xxx.xxx.sam.com working fine ,nslookup xxx.xxx.sam.com also giving valid results and wget to https:\xxx.xxx.sam.com:80\service?wsdl also working and returning success.
but in my java wsdl client when i try to access https:\xxx.xxx.sam.com:80\service?wsdl its not able to resolve and saying unknown host.what is missed here?
As of now DNS Server is window based but all nodes having Redhat Linux OS

Unable to Bind IP to Tomcat on Windows 7

When i access my tomcat from browser by localhost:8080 it works.
but when i try to access it through an IP does not work (for ex 192.168.1.250:8080).
it works fine on windows XP but not on Windows 7.
I search for it a lot but not getting proper solution, please help me out of this.
Thanks in Advance.
Connecting to 192.168.1.250 must go through your router first.
You may need to open up port 8080 on your router, which you can find in the firewall/security settings.
In server.xml (or wherever your Tomcat server configuration is) set address attribute for Connector to 192.168.1.250 (listens only on that address) or 0.0.0.0 (listens on all addresses, anyone with a connection to your machine can access the server).
Source: Can't access Tomcat using IP address

Categories

Resources