I have hosted my spring application in tomcat 7 server .tomcat 7 server that is installed in our own server.our server ip address already map with domain.for now how to map a domain for my spring application. for now i am accessing url like
http:ipaddress:100/appname
If you run your application on port 80 then automatically using your domain you can access your application.
Eg. Your IP: 172.26.87.133
Domain: www.xyz.com
Port:80
Now you can access your application by www.xyz.com/index
Spring is domain agnostic in this case and all configuration are at the tomcat level. This should work out of the box by default, but as I see that you are using port 100, so I assume that someone already played with the configurations.
Note that if you are using Linux OS using port under 1023 maybe an issue look here.
By default tomcat assign the http connector to all IP addresses associated with the server. As your server ip address already map with domain I would expect it to just work. See How do you configure tomcat to bind to a single ip address (localhost) instead of all addresses?
If you are having an issue you should look at your tomcat server.xml file under $CATALINA_BASE/conf
Look for the connector element associated with your port (100) should look similar,if you are using catalina.properties look for bio.http.port.
<Connector acceptCount="100"
connectionTimeout="20000"
executor="tomcatThreadPool"
maxKeepAliveRequests="15"
port="${bio.http.port}"
**address="something-here"**
protocol="org.apache.coyote.http11.Http11Protocol"
redirectPort="${bio.https.port}"/>
If you find the optional address attribute you can comment it out and it should work (assuming you solved linux configurations issue, if exits).
If you what to be more specific (for example from security reason when you have more then one interface) you can specify the IP or domain name here.
See the tomcat documentation for the address attributre here.
Related
I have a small REST-api using port
{ip}:8081/{crud-operations-name}
and I have a website that points to this address but the problem is i still have to put port :
8081
all the time.
Actually I could just set my Java server to run on port :
80
, but that would lead to update all my clients(mobiles app) to listen on port 80 not on 8081 (Am i correct that all http request defaults to port 80?Correct me if im wrong). So I guess a better way is to rewrite the url when it comes to the Rest-Server of mine.
What I would want is like the behavior of htaccess hiding the port, Is it possible in urlrewrite using RestExpress?
You can add a port redirect to your Tomcat's server.xml file. You can invite your users to access the site without specifying a port number, meaning that everyone will hit the default port 8080. When anyone accesses using port 8080, the request will be redirected to 8081 which port presumably has some security settings associated with it.
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
URIEncoding="UTF-8"
enableLookups="false"
redirectPort="8081" />
I have freshly installed apache-tomcat-7.0.62 on server. It starts without any error but i am unable to access it using : -
http://IP:8080/
here IP is ip address of server.
I have also run following command : -
here is the screenshot
Thanks
Find the server.xml located under confs folder of the catalina(tomcat).
Find out Connector tag which each one indicates for one connector isntance.
If the connector comes with no address attribute(as default), so tomcat will listen for all addresses. If it has address attribute, so just remove it out, or either have another Connector to listen for the related ipv4 address.
<Connector ... address="ip_v4_addr"/>
Check tomcat spec for Connectors here.
Next make sure the port is open and allowed to be invoked by any firewall, also make sure the ip-address is valid(public and reachable), and ISP doesn't block it.
Default port for tomcat(HTTP) is 8080 and 8443 for HTTPS, maybe your ISP doesn't let you workout with non-std ports, or the firewall issue.
I'm following a textbook example and I need to run Apache and then open the file in my browser as http:localhost:0000/file
How do I know which number my local host is? The textbook says 9080 but I assume that's not universal.
In the eclipse view "Servers" double click in Tomcat -> tab Overview and check the http port.
By default the port used is 8080.
In the tab modules you can check the path
by default:
http:localhost:8080/projectName
In case you are using Apache Tomcat, the port where the server is listening is defined in the server.xml file (ApacheTomcatHome/conf/server.xml) in a line more or less like this one:
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" />
This line defines the listening port as 8080 but you can change it just modifying the port and restarting the server.
To access the file you will have to deploy a web application (.war) and place at the following location the file you want to see:
ApacheTomcatHome/webapps/applicationName/file
In case your example is talking about Apache Web server the default port where the server is installed is 80. If you place your file at var/www/ then it will be accessible at http://localhost:80/file.
If you want/need to change the port, it can be done at httpd.conf (or apache2.conf) file modifying the line where it states Listen 80.
I have tomcat installed on my local machine. I see it in server.xml where I have below entry
<Connector executor="tomcatThreadPool"
port="${http.port}"
protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="${https.port}"
acceptCount="100"
maxKeepAliveRequests="15"/>
where http.port value in catalina.properties is 8080 .
But every time I try to access my application it url http://localhost/myApp I get error
could not connect to localhost but it works fine http://localhost:8080/myApp. I am not getting why it expects
the port 8080 when it is already a default port? What should I do so that I do not have to mention port?
When you write http://localhost/myApp on the Address Bar of your Browser, the request always goes to Port 80, and not Port 8080. So the default is Port 80 here. For http://localhost/myApp to work you need to install something like Apache HTTP Server.
Then you can configure it with the help of a connector like mod_jk or mod_proxy to use http://localhost/myAppi, instead of http://localhost:8080/myApp. So that what ever request comes on Port 80 can be diverted to Port 8080 automatically.
Once you will download mod_jk, simply extract the file mod_jk.so to the modules folder of your Apache HTTP Server.
Hopefully the steps written here How to Configure Apache HTTP Server with Apache Tomcat, might help you in doing that.
On a Windows platform all you have to do is changing the port number in server.xml from 8080 to 80 and you are done.
The above is not true for Unix/Linux environments. Changing the port number might work on Windows but i think it might be slightly tricky on Unix/Solaris.
Under UNIX all ports <1024 are "privileged" ports. Only root may open a privileged port. It is still possible but keep in mind that it is not as simple as changing the port number when on Unix.
There are a number of workarounds for this.
http://raibledesigns.com/rd/entry/how_to_run_tomcat_on
http://mihail.stoynov.com/2011/04/04/howto-start-tomcat-on-port-80-without-root-privileges/
http://java-notes.com/
http://www.klawitter.de/tomcat80.html
I really need your help. I read that the wsdl for a jax-ws webservice will be generated on the fly for every request. By this, the addresses like the soap endpoint will be adjusted to the request url.
In my case it, no matter wheather internal or external request, the addresses are always refered to localhost:8080.
Does sb have a clue how can I handle this issue?
Thanks in advance
Maybe I haven't described my problem very well.
I have a ws created with jax-ws
Its deployed on a tomcat server 5.5.17
Access with local ip works fine http://192.168.1.20:8070/mywebservice?wsdl
Access with external ip doesn't work resp. the ws "engine" rewrites the url by using the local ip and not the external one
external.domain.de:8070/mywebservice?wsdl
For external.domain all urls in the wsdl are rewritten to the local ip
To the xsdschemaLocation and the soap:address location
Could the proxy server the problem? Request through the proxy makes the webservice think that it is an local access and not a external.
How can I prevent this behaviour on server side?Changes in web.xml or sun.jax (Changes on client side are regrettably not possible)
This is a classic problem when accessing web-services thru external proxies.
For this to work properly, you have to do the following
1) Add another HTTP connector in your Tomcat's server.xml. Say on port 8071, just copy the 8080 Connector Dfn. and set the port to 8071.
2) And in that Connector's defn. you have to add the external IP and Port as proxyHost and proxyPort.
i.e. your server.xml should contain one more Connector entry some thing like this
<Connector port="8071" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443"
proxyHost="external.domain.de" proxyPort="8070" />
And make sure that Connections to external.domain.de on port 8070, get forwarded to 192.168.1.20 and port 8071, instead of 8070.
I told you to setup a new connector, assuming you would want to access the WS internally as well as externally. That way the internal port connector on 8070, does not use proxyhost and change the hostname for internal requests, but any requests coming from external sources via external.domain.de on port 8071 , will get the external.domain.de as hostname and 8070 as port.
If your WS is going to be accessed only from external clients, then you don't really need 2 connectors, just add the proxyHost and proxyPort directives to the 8070 connector and you're done.
But be warned, that even internal requests, will now see the hostname as external.domain.de.
More info # https://tomcat.apache.org/tomcat-5.5-doc/config/http.html#Proxy_Support