You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "R.Sriram" <sr...@gmail.com> on 2014/10/17 15:06:36 UTC

Apache Tomcat displays text/plain

Hello,

I am running my Java Servlet based application on 64bit Amazon Linux 
2014.03 v1.0.3 running Tomcat 7 Java 7.

The webpage is displaying code rather than content. The code shows my 
HTML has sent content type ="text/html". When I do function f12 click on 
Network and the domain, the left panel shows Content Type="text/plain". 
This is happening on all browsers that I tried with.

I have been running this application on my local machine with Window and 
Apache Tomcat 7.0.50 for a long time and haven't had this problem ever.

AWS asked me to include the attached config in .ebextensions. The 
problem got fixed for a few days, then it reverted back to display as 
"text/plain".

Then AWS asked me to include the following mime-mapping lines in my web.xml:

    <mime-mapping>
              <extension>htm</extension>
              <mime-type>text/html</mime-type>
    </mime-mapping>
         <mime-mapping>
              <extension>html</extension>
              <mime-type>text/html</mime-type>
         </mime-mapping>
         <mime-mapping>
             <extension>body</extension>
             <mime-type>text/html</mime-type>
         </mime-mapping>

this worked for a few days, then it reverted back to display as "text/plain"

Can someone have an explanation as to why this is happening and suggest 
a solution for this please.

Thanks.

Re: Apache Tomcat displays text/plain

Posted by "R.Sriram" <sr...@gmail.com>.
On 10/17/2014 10:42 PM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> R.Sriram,
>
> On 10/17/14 9:06 AM, R.Sriram wrote:
>> I am running my Java Servlet based application on 64bit Amazon
>> Linux 2014.03 v1.0.3 running Tomcat 7 Java 7.
>>
>> The webpage is displaying code rather than content. The code shows
>> my HTML has sent content type ="text/html". When I do function f12
>> click on Network and the domain, the left panel shows Content
>> Type="text/plain". This is happening on all browsers that I tried
>> with.
> When you say that the HTML has sent content type="text/html", what do
> you mean? In a <META> tag? Or in the server's response headers?
In the <META> tag. I can look up the server's response header, if that 
is going to give any clue as to why this is happening.
>
> Is there anything between Tomcat and the client, such as a proxy web
> server, etc.?
I do not think so. But I do not know. I am using Elastic Beanstalk. I 
can find out from AWS, if that information provides insight on why this 
is happening
>
>> I have been running this application on my local machine with
>> Window and Apache Tomcat 7.0.50 for a long time and haven't had
>> this problem ever.
>>
>> AWS asked me to include the attached config in .ebextensions. The
>> problem got fixed for a few days, then it reverted back to display
>> as "text/plain".
> Does .ebextensions still contain your modification?
Not right now. AWS support asked me take that off. I can put it back, 
but what I have realized the solution with .ebextension is short lived.
>
>> Then AWS asked me to include the following mime-mapping lines in my
>> web.xml:
>>
>> <mime-mapping> <extension>htm</extension>
>> <mime-type>text/html</mime-type> </mime-mapping>
> Are you using URLs ending in ".htm"?
No. The URL does not have an ending either .htm or .html.
>
>> <mime-mapping> <extension>html</extension>
>> <mime-type>text/html</mime-type> </mime-mapping> <mime-mapping>
>> <extension>body</extension> <mime-type>text/html</mime-type>
>> </mime-mapping>
> Note that all of these mime-mappings are included by default in
> Tomcat. There should have been no need to specify them.
Good to know this. Thanks.
>
>> this worked for a few days, then it reverted back to display as
>> "text/plain"
>>
>> Can someone have an explanation as to why this is happening and
>> suggest a solution for this please.
> I believe this is entirely related to your deployment within "AWS".
> Are you just running Tomcat on an EC2 instance? I've never had any of
> the problems you are describing. I've never even heard of a
> .ebextensions file. Are you using something like Elastic Beanstalk? If
> so, you're either going to have to be very lucky that someone areound
> here can help, or you'll need to go get support from Amazon.
I think you are right, this issue is related to AWS. Yes I am using 
Elastic Beanstalk. Keeping my fingers crossed someone here will be able 
to help. I have not gotten very far with AWS support team.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1
> Comment: GPGTools - http://gpgtools.org
>
> iQIcBAEBCAAGBQJUQU37AAoJEBzwKT+lPKRY4TwQALEgCE32pmh2scI/lM9wGKqM
> 0i1mXBelDUfgqYYxKpPocddNC9gvHjffMzHmT1eOiIsQIr+VRsYwfV0dTn98jyA3
> +rgX1UR/wQMw6qxWjraiM3f3QHRi9Ufror/xf1i1EkzrCMU7+Zki8vUjQMXbVg2s
> 6pE0ZccXWIcVm9kx+PPpGZmdya90QThxLmW+EIQ1Pv+iWmEJ2A+vLModbyQoBvK2
> Xlwim/vgMStaaw/aUp8x+8V5NqBkxarDSacuut71CcPrAAV62njroARftLYxY+nr
> m8amRwVQpBAO+sDfgY7Lbt18VBreTNsWReE88I5AdUvLJsYYoT0+Jxu0JGZehvMi
> +2fIOpK/vO6i9WiJLlA6J5LDfsywoEOt/LUZk8YPtjtqe5AaeDsMsIwlgAIjqaPx
> tnv4DqWssCtUXUBh5CzBQiNCar30S3FChfi21Cz0HjA5v2i9Ms3yJvqS2977Dlmj
> wcmPWQgn9zrzY+0iIBF+sASFGUOfSfPvUSIB6p810RCU/uj2VfChzZVe/jzCOTni
> VhfkqCbS26t3Lc+zyGrXWnLMFw00wd+ZBGMxYyvRVbGU8ViVmnh7JHWA3A13cV03
> Zp8GWNpiO1f9+QzMMZtIMXIdAM0KA0UwX4StzLqmXDagfg+hjhvICK/mmYfYSWHi
> ry6nHdw5vHXeRgvbcC5c
> =jc1f
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Apache Tomcat displays text/plain

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

R.Sriram,

On 10/17/14 9:06 AM, R.Sriram wrote:
> I am running my Java Servlet based application on 64bit Amazon
> Linux 2014.03 v1.0.3 running Tomcat 7 Java 7.
> 
> The webpage is displaying code rather than content. The code shows
> my HTML has sent content type ="text/html". When I do function f12
> click on Network and the domain, the left panel shows Content
> Type="text/plain". This is happening on all browsers that I tried
> with.

When you say that the HTML has sent content type="text/html", what do
you mean? In a <META> tag? Or in the server's response headers?

Is there anything between Tomcat and the client, such as a proxy web
server, etc.?

> I have been running this application on my local machine with
> Window and Apache Tomcat 7.0.50 for a long time and haven't had
> this problem ever.
> 
> AWS asked me to include the attached config in .ebextensions. The 
> problem got fixed for a few days, then it reverted back to display
> as "text/plain".

Does .ebextensions still contain your modification?

> Then AWS asked me to include the following mime-mapping lines in my
> web.xml:
> 
> <mime-mapping> <extension>htm</extension> 
> <mime-type>text/html</mime-type> </mime-mapping>

Are you using URLs ending in ".htm"?

> <mime-mapping> <extension>html</extension> 
> <mime-type>text/html</mime-type> </mime-mapping> <mime-mapping> 
> <extension>body</extension> <mime-type>text/html</mime-type> 
> </mime-mapping>

Note that all of these mime-mappings are included by default in
Tomcat. There should have been no need to specify them.

> this worked for a few days, then it reverted back to display as
> "text/plain"
> 
> Can someone have an explanation as to why this is happening and
> suggest a solution for this please.

I believe this is entirely related to your deployment within "AWS".
Are you just running Tomcat on an EC2 instance? I've never had any of
the problems you are describing. I've never even heard of a
.ebextensions file. Are you using something like Elastic Beanstalk? If
so, you're either going to have to be very lucky that someone areound
here can help, or you'll need to go get support from Amazon.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJUQU37AAoJEBzwKT+lPKRY4TwQALEgCE32pmh2scI/lM9wGKqM
0i1mXBelDUfgqYYxKpPocddNC9gvHjffMzHmT1eOiIsQIr+VRsYwfV0dTn98jyA3
+rgX1UR/wQMw6qxWjraiM3f3QHRi9Ufror/xf1i1EkzrCMU7+Zki8vUjQMXbVg2s
6pE0ZccXWIcVm9kx+PPpGZmdya90QThxLmW+EIQ1Pv+iWmEJ2A+vLModbyQoBvK2
Xlwim/vgMStaaw/aUp8x+8V5NqBkxarDSacuut71CcPrAAV62njroARftLYxY+nr
m8amRwVQpBAO+sDfgY7Lbt18VBreTNsWReE88I5AdUvLJsYYoT0+Jxu0JGZehvMi
+2fIOpK/vO6i9WiJLlA6J5LDfsywoEOt/LUZk8YPtjtqe5AaeDsMsIwlgAIjqaPx
tnv4DqWssCtUXUBh5CzBQiNCar30S3FChfi21Cz0HjA5v2i9Ms3yJvqS2977Dlmj
wcmPWQgn9zrzY+0iIBF+sASFGUOfSfPvUSIB6p810RCU/uj2VfChzZVe/jzCOTni
VhfkqCbS26t3Lc+zyGrXWnLMFw00wd+ZBGMxYyvRVbGU8ViVmnh7JHWA3A13cV03
Zp8GWNpiO1f9+QzMMZtIMXIdAM0KA0UwX4StzLqmXDagfg+hjhvICK/mmYfYSWHi
ry6nHdw5vHXeRgvbcC5c
=jc1f
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org