You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by nabruphonic <st...@gmx.de> on 2008/06/25 17:08:07 UTC
Tomcat: JNDI and Google Webtoolkit
Hi!
I've got a problem with my project. Here a short summary about what it is:
I wrote a web application that periodically reads out a database and shows
these information in a visual way (on a google map or a chart...).
The gwt-project and the mysql-database are on two different virtual machines
on the same computer (one is a windows vm, the other is a ubuntu vm).
Now I want to bind the gwt-project into tomcat. Therefore I set up
everything on client and server site and the communication between both
works.
My problem is the communication between the server-code and the
mysql-database. JNDI is the best way to do something like that, but I am not
very deep incorporated in this sector (tomcat). I followed some how-tos, but
I can't get my communication work.
I hope you can help me!
Here are the tools I am using:
- Apache Tomcat 5.5
- Google Webtoolkit 1.4 + GWT-Ext (auf Windows XP)
- MySQL 4.1 (auf Ubuntu)
I attempted the following things:
- copy mysql-connector-java-5.1.6-bin.jar into <TOMCAT>/server/lib
- added to <TOMCAT>/conf/context.xml the following:
Code:
<Resource name="jdbc/eco_test" auth="Container"
type="javax.sql.DataSource" removeAbandoned="true"
removeAbandonedTimeout="30" maxActive="100" maxIdle="30"
maxWait="10000" username="test2"
password="test" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://192.168.7.136/eco_test" />
- added to <TOMCAT>/webapps/<MYPROJECT>/WEB-INF/web.xml the following:
Code:
<web-app>
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/eco_test</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
[...]
</web-app>
I think I need to add somewhere a connector? Like this:
Code:
<Connector port="80" maxHttpHeaderSize="8192" maxProcessors="150"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="150"
connectionTimeout="20000" disableUploadTimeout="true" />
I hope you can help me, I thought I made everythink right, but I can't get
the communication work.
Thanks a lot!
--
View this message in context: http://www.nabble.com/Tomcat%3A-JNDI-and-Google-Webtoolkit-tp18114801p18114801.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat: JNDI and Google Webtoolkit
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Chuck,
Caldarale, Charles R wrote:
| Is it valid to use the 5.1 JDBC driver with the 4.1 server?
Yeah. The driver and server negotiate the capabilities at connection
time. Connector/J is pretty good about that -- it's mix-and-match ;)
|> url="jdbc:mysql://192.168.7.136/eco_test"
|
| Is the IP address correct? Do you need to specify a port number?
The default port for MySQL will be used if not provided: 3306.
nabruphonic, are you using standard port numbers?
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkhjwpwACgkQ9CaO5/Lv0PC+mwCeOoPl1WeNzwN0L71TtzXsgmFw
jiMAniTeNFR90A7n+TzZlthIyHALS9PA
=kgS5
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Tomcat: JNDI and Google Webtoolkit
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: nabruphonic [mailto:stylophonic@gmx.de]
> Subject: RE: Tomcat: JNDI and Google Webtoolkit
>
> I moved the driver to the common-directory. Unfortunately it
> still does not work.
I doubt that whatever error message you're getting says "does not work"; you need to be specific. Look in the Tomcat logs to see if there's anything pertinent.
>From your original message:
> - MySQL 4.1 (auf Ubuntu)
> - copy mysql-connector-java-5.1.6-bin.jar into <TOMCAT>/server/lib
Is it valid to use the 5.1 JDBC driver with the 4.1 server?
> url="jdbc:mysql://192.168.7.136/eco_test"
Is the IP address correct? Do you need to specify a port number?
> I think I need to add somewhere a connector?
The default Tomcat config includes a <Connector> for port 8080; if you're going to use port 80, just change the default, don't add another one. Also, if you're switching to the standard HTTP/HTTPS ports, change the redirectPort to 443.
You certainly don't want the maxProcessors attribute for a 5.5 Tomcat - that went away some time ago. Use the Tomcat doc appropriate for your level.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Tomcat: JNDI and Google Webtoolkit
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Caldarale, Charles R
> Subject: RE: Tomcat: JNDI and Google Webtoolkit
>
> Is it valid to use the 5.1 JDBC driver with the 4.1 server?
Scratch that question - I see from the Connector/J doc that 5.1.6 does work with a 4.1 server.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat: JNDI and Google Webtoolkit
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
nabruphonic,
nabruphonic wrote:
| I moved the driver to the common-directory. Unfortunately it still
does not
| work. In my Java-Code, do I have to write only the following code to
connect
| with the connection pool?
| Code:
|
| InitialContext ctx = new InitialContext();
| DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/eco_test");
|
| cn = ds.getConnection();
Can you tell us what error you actually get? So far, you have just said
that it "doesn't work".
Also, you probably want the <Resource> to be in an app-specific
context.xml (that is, <WEBAPP>/META-INF/context.xml) instead of the
global context.xml in $CATALINA_HOME/conf/context.xml.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkhjmNwACgkQ9CaO5/Lv0PArGQCfYZ6t1FS+CknxlVxZxxvLeeYt
IgwAoIUK5XejJHR/um+K5pioa4b0WbC1
=7e9p
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Tomcat: JNDI and Google Webtoolkit
Posted by nabruphonic <st...@gmx.de>.
Hi,
I moved the driver to the common-directory. Unfortunately it still does not
work. In my Java-Code, do I have to write only the following code to connect
with the connection pool?
Code:
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/eco_test");
cn = ds.getConnection();
Caldarale, Charles R wrote:
>
> What happens if you put the mysql jar into common/lib as the documentation
> says to?
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html#MySQL%20DBCP%20Example
>
> Make sure you remove the jar from server/lib - you don't want it in two
> places.
>
> - Chuck
>
>
--
View this message in context: http://www.nabble.com/Tomcat%3A-JNDI-and-Google-Webtoolkit-tp18114801p18128251.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Tomcat: JNDI and Google Webtoolkit
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: nabruphonic [mailto:stylophonic@gmx.de]
> Subject: Tomcat: JNDI and Google Webtoolkit
>
> - copy mysql-connector-java-5.1.6-bin.jar into <TOMCAT>/server/lib
What happens if you put the mysql jar into common/lib as the documentation says to?
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html#MySQL%20DBCP%20Example
Make sure you remove the jar from server/lib - you don't want it in two places.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org