Re: tomcat data source - mysql

2004-10-01 Thread Michael Eastwood
Hi Eric,
You also need a ResourceLink element in your Context.  If you
rely on tomcat to create your contexts dynamically, AFAIK you'll
never pick up your datasource.  So put a file named whatever
context you want your stuff under in  
$CATALINA_HOME/conf/Catalina/localhost/
if you're using the standard locations, and put something like this
in it:

Context
cookies=false
crossContext=false
docBase=news
path=/news
reloadable=true
debug=0
ResourceLink
global=Intranet
name=jdbc/intranet
type=javax.sql.DataSource
/ResourceLink
/Context
This is a 'news' context that references a datasource called  
'intranet', defined in the server.xml file.

Good luck,
Michael
On 01/10/2004, at 4:09 PM, Eric Wulff wrote:
Hi, I am not able to access a mysql server from a simple jsp example.
I have googled the errors, checked mysql and tomcat docs and mailing
list archives without success.  Finding a tremendous amount of info
but nothing so far worked to solve my problem.  I created a data
resource in my server.xml.  I have defined a resource reference in my
web.xml.  I have tried shutting down my firewall.  I'm sure others
have had similar problems and I'm hoping one of you can share your
wisdom or point me in the right direction?
many thx
Eric
More, hopefully enlightening, details below.
fedoa core 2
tomcat 5
j2sdk 1.4.2
mysql 3.23.58 for linux redhat
-when mysql server is started I access it by simply typing 'mysql' at
the command line
following is web.xml, JNDI db res entry from the server.xml, and 3
error listings
-web.xml...
?xml version=1.0 encoding=ISO-8859-1?
!DOCTYPE web-app
PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN
http://java.sun.com/dtd/web-app_2_3.dtd;
web-app
servlet
servlet-nameDatabase Rates/servlet-name
servlet-classDatabaseRates/servlet-class
/servlet
servlet
servlet-nameDataSource Rates/servlet-name
servlet-classDataSourceRates/servlet-class
/servlet
servlet
servlet-nameRates/servlet-name
jsp-file/rates.jsp/jsp-file
/servlet
servlet-mapping
servlet-nameDatabase Rates/servlet-name
url-pattern/database/url-pattern
/servlet-mapping
servlet-mapping
servlet-nameDataSource Rates/servlet-name
url-pattern/datasource/url-pattern
/servlet-mapping
servlet-mapping
servlet-nameRates/servlet-name
url-pattern/rates/url-pattern
/servlet-mapping
resource-ref
  res-ref-namejdbc/conversion/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
/resource-ref
/web-app
-server.xml JNDI db resource entry...
I have set a password for root to match the example but that didn't  
work.

  Context path=/database docBase=database debug=0  
reloadable=true
ResourceParams name=jdbc/conversion
  parameter
nameusername/name
valueroot/value
  /parameter
  parameter
namepassword/name
valuesecret/value
  /parameter
  parameter
namedriverClassName/name
!-- valueorg.gjt.mm.mysql.Driver/value tried both --
valuecom.mysql.jdbc.Driver/value
  /parameter
  parameter
nameurl/name
valuejdbc:mysql://localhost/test/value
  /parameter
/ResourceParams
  /Context

java.sql.SQLException: Data source rejected establishment of
connection, message from server: Host 'localhost.localdomain' is not
allowed to connect to this MySQL server SQL state: 08004
Error code: 1130
3 similar errors based on different db access strategies...
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver
of class '' for connect URL 'null' SQL state: null
Error code: 0
-error when using a datasource object...
org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver
of class '' for connect URL 'null'
-stack trace when using a DAO via a .jsp...
org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSourc 
e.java:780)
org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.j 
ava:540)
	converters.ConversionDAO.init(ConversionDAO.java:23)
	org.apache.jsp.rates_jsp._jspService(rates_jsp.java:46)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.j 
ava:324)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java: 
292)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

-I can create the test db table manually but can't via the java
program provided in the tutorial.  This is the error I get when
attempting to run that...
java -classpath
.:/usr/local/jakarta-tomcat-5.0.28/common/lib/mysql-connector-java 
-3.0.15-ga-bin.jar
CreateDB
Loaded driver: 

redirect to insecure

2004-08-27 Thread Michael Eastwood
Hi,
One part of a site I've done has automatic SSL redirection using the
transport-guarantee element in web.xml to ensure SSL communication
with the sensitive parts of site.
The other parts of the site I'd like not to be encrypted.  If I go to
the secure part, however, then back to a non-secure part,
the https:// remains (as I'm using relative URLs).  Is it possible to 
configure
these non secure sections to redirect to no encryption (so that a
request to https://.../nonsecureservlet/ is redirected to
http://.../nonsecureservlet/) without doing a protocol check all of my
servlets or making all of my links absolute?  I've tried

security-constraint
web-resource-collection
web-resource-nameAutomatic SLL
Unforwarding/web-resource-name
url-pattern/*/url-pattern
/web-resource-collection
user-data-constraint
transport-guaranteeNONE/transport-guarantee
/user-data-constraint
/security-constraint
to no effect.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


CGI not executing

2004-05-02 Thread Michael Eastwood
Hi,

I'm having trouble executing a Perl CGI under Tomcat 5.0.19 standalone.

I've set up the global web.xml as per instructions in the CGI how-to, 
and renamed the appropriate jar file.  I've put my perl CGI scripts 
into the default /WEB-INF/cgi directory, and made sure they're 
executable.  I can run the scripts in that directory with ./script

When I go to /cgi-bin/script, however, my browser starts a download 
that blocks indefinitely.  My CPU goes up by around 10%, so something 
is happening, but no perl process appears in my process list and 
nothing ever arrives at the browser.

Any ideas?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: CGI not executing

2004-05-02 Thread Michael Eastwood
never mind, I solved my own problem.  I took the servlet config out of 
the global web.xml and stuck it into my ROOT web.xml and now it works.  
I noted that Tomcat was producing a cgi-bin mapping for all of my 
webapps, not just the root one as I'd intended.  Now that I recall that 
the global web.xml is defined for all webapps, it's clear, but it's 
placement there is, I think, a little weird, considering the behaviour 
produced is not of the conventional form (ie all cgi scripts under 
/cgi-bin instead of webapp1/cgi-bin, webapp2/cgi-bin, etc).

On 03/05/2004, at 12:10 PM, Michael Eastwood wrote:

Hi,

I'm having trouble executing a Perl CGI under Tomcat 5.0.19 standalone.

I've set up the global web.xml as per instructions in the CGI how-to, 
and renamed the appropriate jar file.  I've put my perl CGI scripts 
into the default /WEB-INF/cgi directory, and made sure they're 
executable.  I can run the scripts in that directory with ./script

When I go to /cgi-bin/script, however, my browser starts a download 
that blocks indefinitely.  My CPU goes up by around 10%, so something 
is happening, but no perl process appears in my process list and 
nothing ever arrives at the browser.

Any ideas?

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]