Hi,I'm trying Tomcat for the first time .I've installed Tomcat (apache-tomcat-6.0.13, zip-version). It runs ok.Then I've installed MySQL and there I've created my database.Then I've writed a java servlet for querying the data.Well, this is what happens.1) In localhost, it's all ok: the servlet runs, reads data from tablesand displays them in a browser window.2) From another host (of my LAN), nothing: a 404 error appears.My question:what can I modify to allow remote access to tomcat web-server?Note: I call my servlet using these URL:http://localhost:8080/database_access/listadb (in a local contest)http://192.168.1.55:8080/database_access/listadb (in a remote contest)Can you help me?Thanks! Luigi
|
|
0
|
|
|
|
Reply
|
eliliano (1)
|
5/30/2007 4:22:18 PM |
|
On May 30, 6:22 pm, elili...@libero.it wrote:> Hi,>> I'm trying Tomcat for the first time .>> I've installed Tomcat (apache-tomcat-6.0.13, zip-version). It runs ok.> Then I've installed MySQL and there I've created my database.> Then I've writed a java servlet for querying the data.>> Well, this is what happens.>> 1) In localhost, it's all ok: the servlet runs, reads data from tables> and displays them in a browser window.>> 2) From another host (of my LAN), nothing: a 404 error appears.>> My question:>> what can I modify to allow remote access to tomcat web-server?>> Note: I call my servlet using these URL:>> http://localhost:8080/database_access/listadb(in a local contest)>> http://192.168.1.55:8080/database_access/listadb(in a remote contest)>> Can you help me?>> Thanks! LuigiI don't know how it is with Tomcat, but i know that Apache have somestring in configuration that "says" that server can just be enteredwriting 127.0.0.1 || localhost.You can use this site: http://www.coreservlets.com/Apache-Tomcat-Tutorial/hope that helps :)
|
|
0
|
|
|
|
Reply
|
mikwiat
|
5/30/2007 7:51:38 PM
|
|
eliliano@libero.it wrote:>Hi,>>I'm trying Tomcat for the first time .>>I've installed Tomcat (apache-tomcat-6.0.13, zip-version). It runs ok.>Then I've installed MySQL and there I've created my database.>Then I've writed a java servlet for querying the data.>>Well, this is what happens.>>1) In localhost, it's all ok: the servlet runs, reads data from tables>and displays them in a browser window.>>2) From another host (of my LAN), nothing: a 404 error appears.>>My question:>>what can I modify to allow remote access to tomcat web-server?>>Note: I call my servlet using these URL:>>http://localhost:8080/database_access/listadb (in a local contest)>>http://192.168.1.55:8080/database_access/listadb (in a remote contest)I suspect that you have not granted access to your MySql database fromyour network. Otherwise, look in the Tomcat and MySQL logs to find theerror and, if that does not help, post the logs here.
|
|
0
|
|
|
|
Reply
|
David
|
5/31/2007 3:54:20 AM
|
|
David Segall <david@address.invalid> wrote:>eliliano@libero.it wrote:>>>Hi,>>>>I'm trying Tomcat for the first time .>>>>I've installed Tomcat (apache-tomcat-6.0.13, zip-version). It runs ok.>>Then I've installed MySQL and there I've created my database.>>Then I've writed a java servlet for querying the data.>>>>Well, this is what happens.>>>>1) In localhost, it's all ok: the servlet runs, reads data from tables>>and displays them in a browser window.>>>>2) From another host (of my LAN), nothing: a 404 error appears.>>>>My question:>>>>what can I modify to allow remote access to tomcat web-server?>>>>Note: I call my servlet using these URL:>>>>http://localhost:8080/database_access/listadb (in a local contest)>>>>http://192.168.1.55:8080/database_access/listadb (in a remote contest)>I suspect that you have not granted access to your MySql database from>your network. Oops! That was a dumb suggestion; you are not accessing the databasefrom the network.>Otherwise, look in the Tomcat and MySQL logs to find the>error and, if that does not help, post the logs here.
|
|
0
|
|
|
|
Reply
|
David
|
5/31/2007 3:58:39 AM
|
|
> I don't know how it is with Tomcat, but i know that Apache have some> string in configuration that "says" that server can just be entered> writing 127.0.0.1 || localhost.Yes, I know that... In fact I didn't have any problems with Apache.I'm having problems with Tomcat....> You can use this site:http://www.coreservlets.com/Apache-Tomcat-Tutorial/> hope that helps :)Thanks, I'll read that.... (A quickly reading didn't give to me anyuseful notice, so far: in all of the document it seems that is justmentioned "localhost", not another IP).Luigi
|
|
0
|
|
|
|
Reply
|
eliliano
|
5/31/2007 4:18:14 PM
|
|
> Oops! That was a dumb suggestion; you are not accessing the database> from the network.That is my target! :-)So far, if I type http://192.168.1.55/folder_name/servlet_nameon a different host of my LAN, I get: ERROR 404 (page not found). Thatis: web server not found, in fact, in a local environment, that pageappears (and the servlet itself runs).Luigi
|
|
0
|
|
|
|
Reply
|
eliliano
|
5/31/2007 4:26:04 PM
|
|
eliliano@libero.it wrote:
>
>> Oops! That was a dumb suggestion; you are not accessing the database
>> from the network.
>
>That is my target! :-)
Not exactly. The problem of MySQL permissions only occurs if you send
a request from a different host directly to the MySQL server which is
listening on 192.168.1.55:3306. You are using a servlet on the same
host as the MySQL server to access your database even if the request
comes from a remote machine.
>So far, if I type http://192.168.1.55/folder_name/servlet_name
>on a different host of my LAN, I get: ERROR 404 (page not found). That
>is: web server not found, in fact, in a local environment, that page
>appears (and the servlet itself runs).
My other suggestion of checking the Tomcat and MySQL logs was more
sensible. I find it easier to delete the logs and start again rather
than wading through the old data. I assume http://localhost:8080/ and
http://192.168.1.55:8080/ from the remote machine both give you the
default Tomcat home page.
|
|
0
|
|
|
|
Reply
|
David
|
6/1/2007 7:11:35 AM
|
|
> I assume http://localhost:8080/ and http://192.168.1.55:8080/ from the remote machine both give you the> default Tomcat home page.That is my problem!http://localhost:8080/ (in a local contest) gives me the Tomcat homepage, whilehttp://192.168.1.55:8080/ (in a remote contest) doesn't :-(I think I would change some of the server.xml settings, but I read theTomcat's documentation and it seems "never ending!". Is it so hard foreverybody to understand those documentation pages?By the way, I tried another way to solve my problem.First of all, I installed "Easy PHP" (a free sw that contains anApache web server, also);Then I activated it;And than I installed Tomcat (Windows auto-installing version);Well, this time I noted that server.xml was very different thanbefore.And (yes!) it works!Remote access to Tomcat home page is ok;Running of my servlet is ok;Accessing to the MySQL (remote) database is ok.What is happening? Why is it working, now, while before didn't?I can't post the two server.xml files, since they are so large...Now, I'm almost sure my problem is a setting problem.Must I read all of the documentation pages to understand how to allowremote access?Are there anybody that can tell me how I can do?Thanks, Luigi
|
|
0
|
|
|
|
Reply
|
eliliano
|
6/1/2007 2:16:02 PM
|
|
On Fri, 01 Jun 2007 07:16:02 -0700, eliliano@libero.it wrote:> http://localhost:8080/ (in a local contest) gives me the Tomcat home> page, while>> http://192.168.1.55:8080/ (in a remote contest) doesn't :-(I can't tell you how to configure Tomcat, but if you've told it tolisten at "localhost port 8080" then only connections from thelocalhost will succeed. Similarly, if you've told it to listen at"192.168.1.55 port 8080" then only connections arriving on thatspecific network interface will succeed.For both to work, you need to tell it to listen at "port 8080" withoutspecifying an address, hostname, or network interface.(This assumes that the host itself has properly configured networkinterfaces.)/gordon--
|
|
0
|
|
|
|
Reply
|
Gordon
|
6/1/2007 2:29:34 PM
|
|
David Segall wrote:>> I assume http://localhost:8080/ and http://192.168.1.55:8080/ from the remote machine both give you the>> default Tomcat home page.eliliano@libero.it wrote:> That is my problem!> > http://localhost:8080/ (in a local contest) gives me the Tomcat home> page, while> > http://192.168.1.55:8080/ (in a remote contest) doesn't :-(I am repeatedly thrown by your use of the word "contest":<http://en.wiktionary.org/wiki/contest>> 1. (uncountable) controversy; debate> no contest> > 2. (uncountable) struggle for superiority; combat> 3. (countable) a competition> The child entered the spelling contest.Perhaps you mean "context"?> I think I would change some of the server.xml settings, but I read the> Tomcat's documentation and it seems "never ending!". Is it so hard for> everybody to understand those documentation pages?If this profession were easy, anyone could do it. Programming is not for the lazy.> By the way, I tried another way to solve my problem.> > First of all, I installed "Easy PHP" (a free sw that contains an> Apache web server, also);> Then I activated it;> And than I installed Tomcat (Windows auto-installing version);> > Well, this time I noted that server.xml was very different than> before.> > And (yes!) it works!> > Remote access to Tomcat home page is ok;> Running of my servlet is ok;> Accessing to the MySQL (remote) database is ok.> > What is happening? Why is it working, now, while before didn't?> I can't post the two server.xml files, since they are so large...On the one hand you ask for answers, on the other you withhold the information that would let someone help.Much of the server.xml that comes with Tomcat is comments; you can delete all that safely.It is a useful exercise to pare down the server.xml, item by item until it stops working, Then you learn what makes it work and what doesn't.It is also useful to read the documentation associated with Tomcat. Study it.There are also many other configuration files that are relevant. For example, Apache Web Server uses httpd.conf to set up how it responds to, say, different IP addresses in the target URL.It is useful to read the documentation associated with Apache Web Server. Study it.> Now, I'm almost sure my problem is a setting problem.> > Must I read all of the documentation pages to understand how to allow> remote access?Yes.> Are there anybody that can tell me how I can do?Yes. I could, for example, and did, here.-- Lew
|
|
0
|
|
|
|
Reply
|
Lew
|
6/1/2007 2:34:26 PM
|
|
>> I am repeatedly thrown by your use of the word "contest":> <http://en.wiktionary.org/wiki/contest>>> ...>> Perhaps you mean "context"?>Yes, I meant that. I'm sorry, I can't write English very well, so Imade a mistake.> If this profession were easy, anyone could do it. Programming is not for the> lazy.>That's right. But I configured Apache (httpd.conf) in a while, withoutreading any manual. It was easy, and the instructions are written in avery intuitive fashion.That's not true for Tomcat. I've already downloaded and read more thantwenty documentation pages, and I made all of the changes I think theycan be useful to the server.xml file: nothing... it doesn't stillwork.>> On the one hand you ask for answers, on the other you withhold the information> that would let someone help.I tried that alternative way just few minutes before my last post.> It is also useful to read the documentation associated with Tomcat. Study it.Now, I think this: I could compare the two server.xml files (the onothat works and the one that doesn't) to try to understend, morequickly, what are the options that open Tomcat access to remotehostes.I hope I can succeed.Luigi
|
|
0
|
|
|
|
Reply
|
eliliano
|
6/2/2007 2:04:05 PM
|
|
eliliano@libero.it wrote:
> That's right. But I configured Apache (httpd.conf) in a while, without
> reading any manual. It was easy, and the instructions are written in a
> very intuitive fashion.
> That's not true for Tomcat. I've already downloaded and read more than
> twenty documentation pages, and I made all of the changes I think they
> can be useful to the server.xml file: nothing... it doesn't still
> work.
Tomcat can be tricky, but the minimal setup doesn't really need to be. I
actually found Web Server's configuration harder to learn than Tomcat's, but
learning styles vary.
Here's the Tomcat (6.0, but it's the same for 5.5) server.xml that I use. You
may want to use the default ports (8005, 8080, 8009, 8443) rather than the
changes I made. Not everything I use is required to make Tomcat work. YMMV.
-----
<Server port="9005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.core.AprLifecycleListener"
SSLEngine="on" />
<Listener className="org.apache.catalina.core.JasperListener" />
<Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
<Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<GlobalNamingResources>
<Resource name="UserDatabase" auth="Container"
type="org.apache.catalina.UserDatabase"
description="User database that can be updated and saved"
factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
pathname="conf/tomcat-users.xml"
/>
</GlobalNamingResources>
<Service name="Catalina">
<Connector port="9080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="9443"
/>
<Connector port="9009" protocol="AJP/1.3" redirectPort="9443" />
<Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase" />
<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
</Host>
</Engine>
</Service>
</Server>
|
|
0
|
|
|
|
Reply
|
Lew
|
6/2/2007 2:44:35 PM
|
|
On 2007-06-02, eliliano@libero.it <eliliano@libero.it> wrote:> That's right. But I configured Apache (httpd.conf) in a while, without> reading any manual. It was easy, and the instructions are written in a> very intuitive fashion.> That's not true for Tomcat. I've already downloaded and read more than> twenty documentation pages, and I made all of the changes I think they> can be useful to the server.xml file: nothing... it doesn't still> work.Tomcat's config files are not terribly intuitive. I like Jetty's a lotbetter.
|
|
0
|
|
|
|
Reply
|
Steve
|
6/2/2007 10:37:29 PM
|
|
|
12 Replies
662 Views
(page loaded in 0.133 seconds)
|