Category Archives: tomcat

Apache and Tomcat conflict in VPS

First time am hosting my site in VPS server. Facing below problems. Can anyone please guide me on this.

VPS server defaultly installed apache for webmail.domainname.com . I have installed tomcat server in vps and deployed war file in it.

Both apache and tomcat is listening on same port ( 80 & 443 )

So unable to access my domain name with Https.

I have added the below connector in server.xml

<Connector port="443" maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" disableUploadTimeout="true" acceptCount="100" scheme="https" secure="true" SSLEnabled="true" clientAuth="false" sslProtocol="TLS" keyAlias="server" keystoreFile="test.jks" keystorePass="changeit" />

when running python script in tomcat getting string

After Configure Tomcat to run Python CGI scripts in windows and Run the script in localhost8080 I am getting String for Example.

#!C:\Python27\python.exe
print "Content-type: text/html"
print
print "<html><head>"
print ""
print "</head><body>"
print "Hello "
print "</body></html>"

When I am trying to Run The above script I should get output Hello instead I am getting total Program.

For Configure Tomcat to run Python CGI scripts I have followed the following URL http://lekshmideepu.blogspot.in/2013/03/configure-tomcat-7-to-run-python-cgi.html

Tomcat server taking long time to send the response back

I've written a server in Apache Tomcat that I'm using for performance analysis & benchmarking. Profiling the server is part of the equation to ensure there is no unnecessary time consumption on the server.

Mechanism:

A client sends a payload of 20KB to the server. The HttpServlet notifies me about the request using doPost(). I'm using the request.getInputStream() to read all the data.

According to the HttpServlet documentation:

Called by the server (via the service method) to allow a servlet to handle a POST request. The HTTP POST method allows the client to send data of unlimited length to the Web server a single time

My current understanding is, this inputStream reads data from a local inputStream where the network stack has buffered all the data coming from the client in a request. Sometimes reading data from this inputStream takes merely a few miliseconds but other times it can take over 10 seconds. Now I'm skeptical that the inputStream is probably reading the data from the network stream rather then a local buffered stream which means the HTTP servlet is acting like TCP sockets in which the data is streamed to the destination.

protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        Long startTime = Calendar.getInstance().getTimeInMillis();
        String clientRequestPayload = IOUtils.toString(request.getInputStream(), "UTF-8");
       Long endTime = Calendar.getInstance().getTimeInMillis();

      //send the response back
}

So my question is:

Does the inputStream provided by HTTPServlet read data from a network input stream or a local disk input stream?

Tomcat server taking long time to send the response back

I've written a server in Apache Tomcat that I'm using for performance analysis & benchmarking. Profiling the server is part of the equation to ensure there is no unnecessary time consumption on the server.

Mechanism:

A client sends a payload of 20KB to the server. The HttpServlet notifies me about the request using doPost(). I'm using the request.getInputStream() to read all the data.

According to the HttpServlet documentation:

Called by the server (via the service method) to allow a servlet to handle a POST request. The HTTP POST method allows the client to send data of unlimited length to the Web server a single time

My current understanding is, this inputStream reads data from a local inputStream where the network stack has buffered all the data coming from the client in a request. Sometimes reading data from this inputStream takes merely a few miliseconds but other times it can take over 10 seconds. Now I'm skeptical that the inputStream is probably reading the data from the network stream rather then a local buffered stream which means the HTTP servlet is acting like TCP sockets in which the data is streamed to the destination.

protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        Long startTime = Calendar.getInstance().getTimeInMillis();
        String clientRequestPayload = IOUtils.toString(request.getInputStream(), "UTF-8");
       Long endTime = Calendar.getInstance().getTimeInMillis();

      //send the response back
}

So my question is:

Does the inputStream provided by HTTPServlet read data from a network input stream or a local disk input stream?

Tomcat server taking long time to send the response back

I've written a server in Apache Tomcat that I'm using for performance analysis & benchmarking. Profiling the server is part of the equation to ensure there is no unnecessary time consumption on the server.

Mechanism:

A client sends a payload of 20KB to the server. The HttpServlet notifies me about the request using doPost(). I'm using the request.getInputStream() to read all the data.

According to the HttpServlet documentation:

Called by the server (via the service method) to allow a servlet to handle a POST request. The HTTP POST method allows the client to send data of unlimited length to the Web server a single time

My current understanding is, this inputStream reads data from a local inputStream where the network stack has buffered all the data coming from the client in a request. Sometimes reading data from this inputStream takes merely a few miliseconds but other times it can take over 10 seconds. Now I'm skeptical that the inputStream is probably reading the data from the network stream rather then a local buffered stream which means the HTTP servlet is acting like TCP sockets in which the data is streamed to the destination.

protected void doPost(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        Long startTime = Calendar.getInstance().getTimeInMillis();
        String clientRequestPayload = IOUtils.toString(request.getInputStream(), "UTF-8");
       Long endTime = Calendar.getInstance().getTimeInMillis();

      //send the response back
}

So my question is:

Does the inputStream provided by HTTPServlet read data from a network input stream or a local disk input stream?

Accessing different server with same domain name

I have a Linux Server (Ser1) on which an application is running on Apache and tomcat using proxy. This server has a registered domain name abc.web.com. Because of traffic, company has taken another Linux Server (Ser2) (with no domain name).

What I want is, whenever there is a hit on abc.web.com it should access the same server. But when there is a hit on abc.web.com/panda the request should be redirect to another server (Ser2)

Re-paraphrasing:

Ser1  abc.web.com        IP: 10.201.x.x  
Ser2  No domain name     IP: 10.201.y.z 

Note: Ser2 should be accessed by url abc.web.com/panda

Accessing different servers with same domain name

I have a Linux Server (Ser1) on which an application is running on Apache and tomcat using proxy. This server has a registered domain name abc.web.com. Because of traffic, company has taken another Linux Server (Ser2) (with no domain name).

What I want is, whenever there is a hit on abc.web.com it should access the same server. But when there is a hit on abc.web.com/panda the request should be redirect to another server (Ser2)

Re-paraphrasing:

Ser1  abc.web.com        IP: 10.201.x.x  
Ser2  No domain name     IP: 10.201.y.z 

Note: Ser2 should be accessed by url abc.web.com/panda

401 unauthorized due to .htaccess credentials not supplied

Is there a way to pass both basic authorization and bearer authorization in postman to access the rest api calls. I have defined the directory protection using .htaccess and .htpassword. For getting a token I can pass basic auth to get a token in postman. But to use that token in other rest calls I need to pass the token using bearer in Authorization when I submit a call it says 401 unauthorized. It is due to the directory protection credentials are no supplied. I need to know either we could bypass or is there a way we could both pass basic and bearer authorization or something to in .htaccess file.

How to pass URL parameter values in Apache Tomcat?

I'm little new to the apache tomcat. Please find the detail given below.

I have following parameters and its values.

  1. client_id : c66728
  2. store_id : s126

Then I need to pass those values in the URL like this : URL : http://server_ip:8080/client_id/c66728/store_id/s126/

My Question : How I can pass those variables like the URL above, If I try now, it shows the following error.

enter image description here

Any help would be greatly appreciated to resolve this issue.

Thanks.

How to pass URL parameter values in Apache Tomcat?

I'm little new to the apache tomcat. Please find the detail given below.

I have following parameters and its values.

  1. client_id : c66728
  2. store_id : s126

Then I need to pass those values in the URL like this : URL : http://server_ip:8080/client_id/c66728/store_id/s126/

My Question : How I can pass those variables like the URL above, If I try now, it shows the following error.

enter image description here

Any help would be greatly appreciated to resolve this issue.

Thanks.