How to run Tomcat on Linux (which has glassfish on port 8080) - apache

I am trying to run to tomcat on linux where glassfish is already running on port 8080 ( you can check here - vhost2.cs.rit.edu:8080 . So i changed the tomcat port to 8181 by editing the server.xml file. NOw with the command startup.sh and i get the following output
Using CATALINA_BASE: /home/krs8785/apache-tomcat-7.0.54
Using CATALINA_HOME: /home/krs8785/apache-tomcat-7.0.54
Using CATALINA_TMPDIR: /home/krs8785/apache-tomcat-7.0.54/temp
Using JRE_HOME: /usr
Using CLASSPATH: /home/krs8785/apache-tomcat-7.0.54/bin/bootstrap.jar:/home/krs8785/apache-tomcat-7.0.54/bin/tomcat-juli.jar
Tomcat started.
I am assuming that tomcat is now working. Now when i test the server by - vhost3.cs.rit.edu:8181 I get
No data received on the browser.
What is the problem here and how do i solve it?

The problem may be unrelated to tomcat. I think your first step should be to exclude networking issues.
I have assumed you are accessing vhost3.cs.rit.edu:8181 from another machine. If that is the case, try to access localhost:8181 from vhost3.cs.rit.edu. If this is not possible in a conventional browser, perhaps because it is a headless server with X forwarding disabled then use a terminal based browser. Try typing the following in the terminal on vhost3.cs.rit.edu
lynx localhost:8181
If you are able to see a representation of a tomcat splash page then you can attribute it to networking issues. This could be firewall related (perhaps even an issue with iptables on linux).

Related

Testing OC4J's default configuration

I have installed Oracle Developer Suite 10g release 2(Complete), which leaded to installed standalone OC4J. Now I am trying to Testing OC4J's default configuration.
I started the OC4J instance through Start> Search for oc4j> clicked oc4j batch file. OC4J is initialized now.
According to the docs...
https://docs.oracle.com/cd/B14099_19/web.1012/b14361/config.htm#i1049203
I tried to test it by accessing http://localhost:8888/ from a Web browser.
Unfortunately, the result is...
localhost refused to connect.Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED
According to the docs, I also tried...
http://localhost:8888/servlet/HelloWorldServlet, which should return a "Hello World" page.
Unfortunately, same result was produced...
localhost refused to connect.Try:
Checking the connection
Checking the proxy and the firewall
ERR_CONNECTION_REFUSED
I also tried starting the server using...
java -jar oc4j.jar
from J2EE>Home directory, and tried both links mentioned above...
http://localhost:8888/
and
http://localhost:8888/servlet/HelloWorldServlet
And the result was...
404 Not Found
Resource / not found on this server
and
404 Not Found
Resource /servlet/HelloWorldServlet not found on this server
respectively.
P.S. I have a static IP address.
What could be the cause for that?

No response from running Tomcat: does not start, does nothing

I'm using Ansible to spin up a new Amazon EC2 install, and then I install Java and Tomcat (via the yum module). After placing the war for sample project from the Apache website in the webapps directory, I go and run the the command (below), nothing happens. It returns with response, no error. I've checked both the IP and port 8080 and Tomcat is not running.
[centos#sonar-test webapps]$ sudo systemctl start tomcat
[centos#sonar-test webapps]$ sudo systemctl start tomcat
[centos#sonar-test webapps]$
For reference, I was following this tutorial as well:
https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-7-on-centos-7-via-yum
From your comment on my question running curl in your ec2 instance
When I curl I get a large html document with various apache-esque things on it
It means Tomcat is installed and running.
If you don't access it, its because of your security group rules
In your ec2 console, select the Security Groups option. Edit the rules that is associated with your ec2 instance (the one running Tomcat) and permits inbound connections to port 8080 (so you can make request to your Tomcat server) and port 80 if you're running Apache (or nginx/another web server). If you're not sure about security, you can restrict the inbound traffic to come only from your IP so you can test but no-one else can make request.

Errror reading from remote server returned by /jenkins

I am using Jenkins and currently Jenkins is running fine in the background; however, when i am trying to access Jenkins using browser the homepage of Jenkins is not accessible. When I access it I get "Error reading from remote server ( 502 )". Has anyone encountered such an issue? What could be the workaround?
Try to remove proxy: export http_proxy="" && curl http://servername:portnumber/destinationpath/
or use https instead of http or vice-versa ( check which port is your jenkins running on )
Is it running on apache/nginx/whatever? Restart that. Restart Jenkins once more. Check the server configuration regarding those.
Did restart of iptables post which I have seen the issue to be resolved.
service iptables restart

How to run glassfish 4 on port 80 instead of 8080? root access is not an issue

Did some google on it and the solution was to redirect using iptables or mod in apache? Since my application uses websockets the above solution breaks my websocket connectivity and I again have to connect to my websockets using port 8080. Is there any way that I can run the glassfish itself on port 80 so that my websockets also run on port 80 making easier for users behind corporate firewall to access the app since corparates may block 8080.
I have root access as well.
To run GlassFish on port 80 you need to :
Connect to the administration interface (by default on port :4848)
In the left menu go to Configurations
Then select the appropriate configuration you need to change eg server-config
Then go to Network Config
Then go to Network Listeners
Select the appropriate listener, probably http-listener-1
Change the Port value to 80
Save and reboot your GlassFish server/instance/cluster according to your needs
Using the command line utility
asadmin set configs.config.server-config.network-config.network-listeners.network-listener.http-listener-1.port=80
you may need to replace server-config and/or http-listener-1
Go to glassfish4\glassfish\domains\domain1\config folder and here open domain.xml file
and find tag
<network-listeners>
<network-listener port="9999" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>
</network-listeners>
in port attribute of <network-listeners> you can specify your port address whichever you want.
Here's another approach.
You can go to the admin console under port 4848 (I am using Glassfish 4.1.2) and navigate to "Configuration" > "server-config" > "HTTP Service" > "Http Listeners" > "http-listener-1" in the left hand navigation.
Click on the "http-listener-1" link in the main content window.
Change the port to desired number and save.
Restart Glassfish and run your application.
in some cases you have to change port before glassfish is started (in my case port 8080 is already in use by another instance) so answer 4 worked for me.
Following are simple steps to change the port number of Glassfish server (GlassFish runs by default on port number 8080):
Go to the folder where Glassfish is installed.
Locate config folder which is as follows (Windows):
C:\Program Files\glassfish-3.0.1\glassfish\domains\domain1\config
Open domain.xml using any text editor.
Look for 8080 and change it to some other port number that doesn’t conflict with other port numbers (e.g. 8081).
Save domain.xml.
Additional step if necessary:
Now remove GlassFish from IDE and add it again so that IDE understands the new port number.
Restart GlassFish, if it was already running.
Soruce Link

Running tomcat on Mac

Hi im trying to run tomcat over the terminal in mac, so i type ./startup.sh to execute the script.The terminal then gives me the following:
Using CATALINA_BASE: /Users/kimmy/Documents/Apache/tomcats/apache-tomcat-7.0.35
Using CATALINA_HOME: /Users/kimmy/Documents/Apache/tomcats/apache-tomcat-7.0.35
Using CATALINA_TMPDIR: /Users/kimmy/Documents/Apache/tomcats/apache-tomcat-7.0.35/temp
Using JRE_HOME: /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
Using CLASSPATH: /Users/kimmy/Documents/Apache/tomcats/apache-tomcat-7.0.35/bin/bootstrap.jar:/Users/kimmy/Documents/Apache/tomcats/apache-tomcat-7.0.35/bin/tomcat-juli.jar
When i try to visit the local host to check if the tomcat server is running the browser says can not connect to server.
Does anyone know what the problem is?
Thanks
tomcat server by default runs on port no 9999 on mac.
To know the port no on which tomcat is running, check the terminal after server is on. check the line "server started on......"
using this port no you can request by following
http://localhost:9999
this will open server page.
Hope this helps.