Re: Accessing a Tomcat webapp from a PHP webapp

2010-02-18 Thread Krish




Sent from my iPhone

On Feb 18, 2010, at 6:32 PM, Christopher Schultz > wrote:



access?


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



Re: Accessing a Tomcat webapp from a PHP webapp

2010-02-18 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

zé,

On 2/18/2010 4:51 PM, zé wrote:
>> Interesting. What is the URL you are trying to access?
> I tryed access a directory containing images. Each image is accessed
> correctly, but the whole directory don't, generating the HTTP 404 status.

If you got /403/, then it's most likely that the DefaultServlet (which
serves anything that hasn't been mapped to another servlet, such as
static files and directories and such) hasn't been configured to serve
directory indexes. You can do this by copying the configuration for
"DefaultServlet" from TOMCAT_HOME/conf/web.xml into your webapp's
WEB-INF/web.xml file -- the one from your webapp will override Tomcat's
defaults -- and modifying that configuration so that directory indexes
are enabled. conf/web.xml is well-documented so you should be able to
see what settings to change.

>> Can you give us more details? 
> I was using a AJAX request (using JQuery) to load the servlet content into
> the page generated by the PHP script. 
> I've moved the PHP script to an other machine (better configured) and now
> the HTTP status is 200, but the response is blank... 
> So, I've tested to use a IFRAME HTML tag instead the AJAX request and it
> works... o_O 

Hmm... well, it appears that someone already did that configuration for
you, then. :)

>> Also, if you can enable the AccessLogValve and post the log
> file generated by that.
> I've never used the AccessLogValve, can you help me? :)

The documentation is shown as an example of using "valves" in Tomcat:
http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html

Just put the  element inside your  in
META-INF/context.xml for your webapp.

>> Finally, please post your webapp's
> entire web.xml file and all  entries from conf/server.xml so we
> can see what mappings are being used.
> There isn't nothing special in these files - both are with only standard
> configuration. (bad behaviour, I know). It's because still in a developing
> enviorment...

No, actually leaving conf/server.xml in it's default configuration is
one of the best things you /can/ do: it means that you haven't broken
any of your s or webapp deployments :)

> -  elements into server.xml --
>   unpackWARs="true" autoDeploy="true"
> xmlValidation="false" xmlNamespaceAware="false">
> 
> 
> 
> 
> 
> 
>   
> ---

You can see above an example of how to use the AccessLogValve, though
this will log accesses to the entire Host, not just your web application.

Glad you got everything working.

Good luck!
- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkt9zicACgkQ9CaO5/Lv0PAOGgCgwT9TkBtw8qfF3d1jqiihO+c0
EJ8AniEbX4zyi3bcII2oMT5/RvMIoNmg
=7/c7
-END PGP SIGNATURE-

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



Re: Accessing a Tomcat webapp from a PHP webapp

2010-02-18 Thread

Hi Chris!

>Interesting. What is the URL you are trying to access?
I tryed access a directory containing images. Each image is accessed
correctly, but the whole directory don't, generating the HTTP 404 status.

>Can you give us more details? 
I was using a AJAX request (using JQuery) to load the servlet content into
the page generated by the PHP script. 
I've moved the PHP script to an other machine (better configured) and now
the HTTP status is 200, but the response is blank... 
So, I've tested to use a IFRAME HTML tag instead the AJAX request and it
works... o_O 

>Also, if you can enable the AccessLogValve and post the log
file generated by that.
I've never used the AccessLogValve, can you help me? :)

>Where do you have Tomcat installed? Where is
your webapp application installed?
Tomcat is installed into my localhost and the PHP script is on an Apache
running into another host.

>Finally, please post your webapp's
entire web.xml file and all  entries from conf/server.xml so we
can see what mappings are being used.
There isn't nothing special in these files - both are with only standard
configuration. (bad behaviour, I know). It's because still in a developing
enviorment... But here we go:

--- web.xml ---

http://java.sun.com/xml/ns/javaee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";>

services
servlets.services


services
/services



30



index.jsp



GoogleMapsKey


   
ABQI5aeP66Pg4Yeg-ea2DVew2BSnFOuoISv6yQSBPQUmIaOLMwwm4hRyOR-W7GAD7BADGeiXMiGWHkluHg








DebugMode
true


-

-  elements into server.xml --
 







  
---

Thanks for your help!
José



Christopher Schultz-2 wrote:
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> zé,
> 
> On 2/17/2010 12:02 PM, zé wrote:
>> I don't use any kind of authentication
> 
> Ok.
> 
>> I believe that the directory indexes are disabled due the HTTP 404
>> error returned when is tried listing.
> 
> Interesting. What is the URL you are trying to access?
> 
>> It's just a servlet being accessed by a PHP script. The servers aren't in
>> the same machine instead of I told before, sorry. May be this the cause?
>> May
>> the Tomcat refusing a connection requested by a script generated by
>> another
>> web server, due a security constraint?
> 
> It's possible, but it wouldn't be this way by default: you'd have to
> configure your server in a strange way to accomplish that... I'd think
> you'd remember having done that :)
> 
> Can you give us more details? The URL(s) you are trying to access would
> be helpful. Also, if you can enable the AccessLogValve and post the log
> file generated by that. Where do you have Tomcat installed? Where is
> your webapp application installed? Finally, please post your webapp's
> entire web.xml file and all  entries from conf/server.xml so we
> can see what mappings are being used.
> 
> - -chris
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAkt8WoQACgkQ9CaO5/Lv0PAMrQCgk3xsI3yKzqpEspBJI0sejX2I
> +l8Anj1RFhSbEe0nJMpS2F8MgXSXexdR
> =MkK2
> -END PGP SIGNATURE-
> 
> -------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Accessing-a-Tomcat-webapp-from-a-PHP-webapp-tp27622126p27646269.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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



Re: Accessing a Tomcat webapp from a PHP webapp

2010-02-17 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

zé,

On 2/17/2010 12:02 PM, zé wrote:
> I don't use any kind of authentication

Ok.

> I believe that the directory indexes are disabled due the HTTP 404
> error returned when is tried listing.

Interesting. What is the URL you are trying to access?

> It's just a servlet being accessed by a PHP script. The servers aren't in
> the same machine instead of I told before, sorry. May be this the cause? May
> the Tomcat refusing a connection requested by a script generated by another
> web server, due a security constraint?

It's possible, but it wouldn't be this way by default: you'd have to
configure your server in a strange way to accomplish that... I'd think
you'd remember having done that :)

Can you give us more details? The URL(s) you are trying to access would
be helpful. Also, if you can enable the AccessLogValve and post the log
file generated by that. Where do you have Tomcat installed? Where is
your webapp application installed? Finally, please post your webapp's
entire web.xml file and all  entries from conf/server.xml so we
can see what mappings are being used.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkt8WoQACgkQ9CaO5/Lv0PAMrQCgk3xsI3yKzqpEspBJI0sejX2I
+l8Anj1RFhSbEe0nJMpS2F8MgXSXexdR
=MkK2
-END PGP SIGNATURE-

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



Re: Accessing a Tomcat webapp from a PHP webapp

2010-02-17 Thread

Hi Chris!

Thanks for response! 
I don't use any kind of authentication and, I believe that the directory
indexes are disabled due the HTTP 404 error returned when is tried listing.
It's just a servlet being accessed by a PHP script. The servers aren't in
the same machine instead of I told before, sorry. May be this the cause? May
the Tomcat refusing a connection requested by a script generated by another
web server, due a security constraint?

Thanks.


Christopher Schultz-2 wrote:
> 
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
> 
> zé,
> 
> On 2/17/2010 6:06 AM, zé wrote:
>> I'm trying to access a Java web application, hosted on a Tomcat 6.0.20,
>> from
>> a PHP application hosted on a Apache, located at the same machine. The
>> PHP
>> app must request a Java app with few parameters and, the Java app must
>> respond with some data encoded in a JSON response. Perhaps I got a HTTP
>> 403
>> error. How to fix this?
> 
> HTTP 403 is "Forbidden" which suggests a resource that is not available
> to the current user. Are you using any kind of authentication? Are you
> trying to access a directory (instead of a file) and do you have
> directory indexes disabled?
> 
> There are other reasons to get this error but these are the most common
> I can think of.
> 
> - -chris
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAkt8Ba4ACgkQ9CaO5/Lv0PBNRACgockj7LFsG9A/3CiobkxDchcs
> r+sAoIZcnWvLW8h8XCFkRWcDdiwblL4u
> =aXPj
> -END PGP SIGNATURE-
> 
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/Accessing-a-Tomcat-webapp-from-a-PHP-webapp-tp27622126p27626939.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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



Re: Accessing a Tomcat webapp from a PHP webapp

2010-02-17 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

zé,

On 2/17/2010 6:06 AM, zé wrote:
> I'm trying to access a Java web application, hosted on a Tomcat 6.0.20, from
> a PHP application hosted on a Apache, located at the same machine. The PHP
> app must request a Java app with few parameters and, the Java app must
> respond with some data encoded in a JSON response. Perhaps I got a HTTP 403
> error. How to fix this?

HTTP 403 is "Forbidden" which suggests a resource that is not available
to the current user. Are you using any kind of authentication? Are you
trying to access a directory (instead of a file) and do you have
directory indexes disabled?

There are other reasons to get this error but these are the most common
I can think of.

- -chris
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkt8Ba4ACgkQ9CaO5/Lv0PBNRACgockj7LFsG9A/3CiobkxDchcs
r+sAoIZcnWvLW8h8XCFkRWcDdiwblL4u
=aXPj
-END PGP SIGNATURE-

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



Accessing a Tomcat webapp from a PHP webapp

2010-02-17 Thread

Hi!

I'm trying to access a Java web application, hosted on a Tomcat 6.0.20, from
a PHP application hosted on a Apache, located at the same machine. The PHP
app must request a Java app with few parameters and, the Java app must
respond with some data encoded in a JSON response. Perhaps I got a HTTP 403
error. How to fix this?

Thanks.
José
-- 
View this message in context: 
http://old.nabble.com/Accessing-a-Tomcat-webapp-from-a-PHP-webapp-tp27622126p27622126.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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