NIO Connector in Tomcat - java

I'm trying to enable NIO Connector in Tomcat 6.0 by configuring server.xml file, but I'm getting Firefox can't establish a connection to the server at localhost:8081. in the browser whenever I type localhost:8081.
This is how I've configured NIO connector in Tomcat 6.0. May I know what's the problem?
<Connector connectionTimeout="20000" port="8081" protocol="org.apache.
coyote.http11.Http11NioProtocol" redirectPort="8443"/>

I've tried your tag on my server.
Your Connector tag has one unnecessary space between apache. and coyote
Remove it or try with the one below.
<Connector connectionTimeout="20000" port="8081" protocol="org.apache.coyote.http11.Http11NioProtocol" redirectPort="8443"/>
It should start up.

Related

Why does localhost work but external URL doesn't in tomcat?

My tomcat server is configured as this:
<Connector port="8080" protocol="HTTP/1.1"
address="192.168.122.15"
connectionTimeout="20000"
redirectPort="8443" />
When I try to access it via http://localhost:8080/{endpoint}, the operation works
When I use the external URL that's supposedly mapped to it: http://projecta.cave-gaming.com:8080/{endpoint}, it returns a 404 timeout error.
How do I map my tomcat server to the forwarded port so I can access it from an external URL?
Have you bind the server to locahost?
You can configure this using the address attribute like described here
You can do this in the server.xml
<Connector port="8080" protocol="HTTP/1.1" ...
If you omit the address attribute you are listening to all available addresses.

Several ports required by Tomcat v7.0 Server at localhost are already in use

Tried changing the ports but error still persists.
We have used Windows 2008, 8.1, 7 with just java, tomcat, and eclipse installed to isolate the problem but no luck.
We don't know where to get the logs for more information regarding this error.
I am not a programmer just helping my colleague.
Link below is the netstat result as well as the server.xml file:
https://drive.google.com/file/d/0B8s89SzGxv2Xclp3bllKTzloZ0E/view?usp=sharing
Guys any idea on how we can troubleshoot and know the exact issue for this?
Based on the requirement you can change or add new port in tomcat.
edit server.xml file which is located at conf folder.
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true">
<SSLHostConfig>
<Certificate certificateKeystoreFile="conf/localhost-rsa.jks"
type="RSA" />
</SSLHostConfig>
</Connector>
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

Fronting Tomcat with Apache HTTP Server

Apache Tomcat server.xml:
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
This connector uses the NIO implementation that requires the JSSE
style configuration. When using the APR/native implementation, the
OpenSSL style configuration is required as described in the APR/native
documentation -->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" address="127.0.0.1" enableLookups="false" protocol="AJP/1.3" redirectPort="8443" />
Apache Http Server httpd.conf :
cd /path/to/apache/config
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
ProxyRequests Off
<Proxy *>
Order deny,allow
Deny from all
Allow from localhost
</Proxy>
ProxyPass / ajp://127.0.0.1:8009/ retry=0
ProxyPassReverse / ajp://127.0.0.1:8009/ retry=0
When i do http://[ip]/[app_name] i have this error:
Forbidden
You don't have permission to access /[app_name] on this server.
Why ?
Your configuration states
<Proxy *>
Order deny,allow
Deny from all
Allow from localhost
</Proxy>
Guess the meaning of Deny and Allow. Your configuration should work if you are coming from the same server and use localhost as your address. Careful if you use the IP address: Often localhost is no longer mapped to 127.0.0.1, but to ::1, its IPV6 equivalent.
Edit: Remove this block and try if it works then.
Note that Stackoverflow is for programming related questions, this is rather server administration, so it might be better on https://serverfault.com/ - I'm voting to transfer it over to that site. There people might be able to go further - e.g. give hints to not open up a reverse proxy for everybody everywhere on the internet.

How to deploy webservice on jboss 4.0.4 application server hosted on solaris 10 with a specific port?

I am totally new to JBOSS 4.0.4 app server and Solaris 10.
I have developed my webservice WAR file with Eclipse and need to deploy it on my remote jboss web server (version 4.0.4) hosted on Solaris (version 10) and need to assign port 8088 to it.
I mean my clients need to access my web service with: http://test.com:8088/myWebService?wsdl
How can I achieve this?
What configurations should I do in order to make it possible?
One of my friend told me that JBOSS version 4.0.4 hosts every http request with just one port number, i.e all JSPs and webservices would have same port number which is defined in /export/home/app/jboss/server/default/deploy/jbossweb-tomcat55.sar/server.xml
on my development server the server.xml looks like following:
<Server>
<Service name="jboss.web"
className="org.jboss.web.tomcat.tc5.StandardService">
<!-- A HTTP/1.1 Connector on port 8080 -->
<Connector port="8090" address="${jboss.bind.address}"
maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
emptySessionPath="true"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"/>
<!-- Add this option to the connector to avoid problems with
.NET clients that don't implement HTTP/1.1 correctly
restrictedUserAgents="^.*MS Web Services Client Protocol 1.1.4322.*$"
-->
<!-- A AJP 1.3 Connector on port 8009 -->
<Connector port="8009" address="${jboss.bind.address}"
emptySessionPath="true" enableLookups="false" redirectPort="8443"
protocol="AJP/1.3"/>
<Engine name="jboss.web" defaultHost="localhost">
<Realm className="org.jboss.web.tomcat.security.JBossSecurityMgrRealm"
certificatePrincipal="org.jboss.security.auth.certs.SubjectDNMapping"
allRolesMode="authOnly"
/>
</Host>
</Engine>
Is it right?
thanks
I find the answer i guess: Actually jboss 4.0.4 is using tomcat as it's webserver and it contains server.xml which is configurable to be listen to different ports as described in this article:
http://www.mulesoft.com/tcat/tomcat-connectors
Actually I should have defined different connector and engine element in server.xml and it is done.
As I said, I modified my server.xml as following:
<Server>
<!-- Use a custom version of StandardService that allows the
connectors to be started independent of the normal lifecycle
start to allow web apps to be deployed before starting the
connectors.
-->
<Service name="jboss.web"
className="org.jboss.web.tomcat.tc5.StandardService">
<!-- A HTTP/1.1 Connector on port 8080 -->
<Connector port="8090" address="${jboss.bind.address}"
maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
emptySessionPath="true"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"/>
<!-- Add this option to the connector to avoid problems with
.NET clients that don't implement HTTP/1.1 correctly
restrictedUserAgents="^.*MS Web Services Client Protocol 1.1.4322.*$"
-->
<!-- A AJP 1.3 Connector on port 8009 -->
<Connector port="8009" address="${jboss.bind.address}"
emptySessionPath="true" enableLookups="false" redirectPort="8443"
protocol="AJP/1.3"/>
<!-- SSL/TLS Connector configuration using the admin devl guide keystore
<Connector port="8443" address="${jboss.bind.address}"
maxThreads="100" strategy="ms" maxHttpHeaderSize="8192"
emptySessionPath="true"
scheme="https" secure="true" clientAuth="false"
keystoreFile="${jboss.server.home.dir}/conf/chap8.keystore"
keystorePass="rmi+ssl" sslProtocol = "TLS" />
-->
<Engine name="jboss.web" defaultHost="localhost">
<Realm className="org.jboss.web.tomcat.security.JBossSecurityMgrRealm"
certificatePrincipal="org.jboss.security.auth.certs.SubjectDNMapping"
allRolesMode="authOnly"
/>
<Host name="localhost"
autoDeploy="false" deployOnStartup="false" deployXML="false">
</Host>
</Engine>
</Service>
<Service name="jboss.webservice"
className="org.jboss.web.tomcat.tc5.StandardService">
<!-- A HTTP/1.1 Connector on port 8080 -->
<Connector port="8099" address="${jboss.bind.address}"
maxThreads="250" strategy="ms" maxHttpHeaderSize="8192"
emptySessionPath="true"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true"/>
<Engine name="jboss.webservice" defaultHost="localhost">
<Realm className="org.jboss.web.tomcat.security.JBossSecurityMgrRealm"
certificatePrincipal="org.jboss.security.auth.certs.SubjectDNMapping"
allRolesMode="authOnly"
/>
<Host name="localhost"
autoDeploy="false" deployOnStartup="false" deployXML="false">
<Context path="/"></Context>
</Host>
</Engine>
</Service>
</Server>
As you can see, I have added a new Service tag and named it "jboss.webservice". I think the rest of the xml code is declarative and no other explanation is needed to understand.
Anyway dont forget to kill jboss process in SOLARIS and Run it again.
I tried these commands and after jboss was up again i was able to telnet to that port. :)
#ps -ef | grep 0.0.0
//here I get the process id of jboss, assume i get 1234
#kill -9 1234
//here I kill it
#cd /export/home/app/jboss/bin
//here i go to my jboss bin directory to run it
#nohup ./run.sh &
//here jboss is run
//now telnet
# telnet myIpadd 8099
that's it.
hope it helps.

Tomcat server in eclipse does not support TSL/SSL

I am trying to get self signed certificate for my website. I created a certificate using "Keytool" and then made following changes in conf/server.xml
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1"
redirectPort="8443" />
<Connector SSLEnabled="true" clientAuth="false"
keystoreFile="c:\tomcat\keystore\.keystore" keystorePass="changeit"
maxThreads="150" port="8443" protocol="HTTP/1.1" scheme="https"
secure="true" sslProtocol="TLS" />
When i run the tomcat server externally and type the URL https://"localhost":8443 (No quotes around localhost) it works but when i run the tomcat server in Eclipse i get 404 error.
Can anyone please help me with this. Thanks in advance.
I referred to the below sites for help.
http://technology-for-human.blogspot.com/2011/08/ssl-in-tomcat-under-eclipse-part-1-self.html
Eclipse WTP: How do I enable SSL on Tomcat?
According to https://tomcat.apache.org/tomcat-7.0-doc/config/http.html
the sslProtocol property should be one of the followings: SSLv2, SSLv3, TLSv1, TLSv1.1, TLSv1.2, all.
Try putting "TLSv1+TLSv1.1+TLSv1.2".
Be sure there's no exceptions regarding the keystore's path or password.
And last but not least, remove the redirectPort property from others Connectors.

Categories