Re: Problem using realm to connect to a database
Peter Ivarsson wrote: I get this error. Catalina.start: LifecycleException: Exception opening database connection: java.sql.SQLException: twz1.jdbc.mysql.jdbcMysqlDriver LifecycleException: Exception opening database connection: java.sql.SQLException: twz1.jdbc.mysql.jdbcMysqlDriver Useing driver com.mysql.jdbc.Driver version 3.09 MySQL version 3.23.38 Tomcat version 4.1.24 I have put the folowing rows into the server.xml: Context path=/esadmin reloadable=true docBase=C:\Program Files\Apache Group\Tomcat 4.1\webapps\esadmin Realm className=org.apache.catalina.realm.JDBCRealm debug=99 driverName=com.mysql.jdbc.Driver connectionName=XXX connectionPassword= connectionURL=jdbc:mysql://localhost:3306/estid2 userTable=admins userNameCol=user_name userCredCol=user_pass userRoleTable=user_roles roleNameCol=role_name / /Context Are you sure of your configuration? There used to be 2 jdbc drivers for MySQL, the twzl driver, and Mark Matthews mm driver. twzl stopped being maintained (IIRC), and the mm driver became the 'official' driver. Do you have both drivers visible to the classloader? If so, it looks as though it's choosing the wrong one. Delete (or move out of harms way) the twzl driver, and see if things improve. HTH Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat and mac os 10.2.8 update
Giuliano Gavazzi wrote: was /usr/local a symbilic link? If so the installation might have replaced it with a directory. so you should copy the new content to the target and reinstate the symbilic link. BTW Using JAVA_HOME: /usr sounds wrong to me. No, that's right for Mac OS X Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat, MySQL JNDI: java.sql.SQLException: Cannot load JDBC driver class 'null'
Ilja wrote: Ok, first some configuration information: Tomcat 5.09 MySQL Driver 3.08 stable OS: Mac OSX 10.2.6 J2SE 1.4.2 My config is not the same (TC 4.1.24, OSX 10.2.6, MySQL 3.07), and my parameters are different: ResourceParams name=jdbc/EuratomDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value100/value /parameter parameter namemaxIdle/name value3/value /parameter parameter namemaxWait/name value100/value /parameter parameter nameusername/name valuexxx/value /parameter parameter namepassword/name valuexxx/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:mysql://localhost/euratom?autoReconnect=true/value /parameter /ResourceParams This works for me! The main diffs are (i) I specify the factory, and (ii), the driverClassName is com.mysql.jdbc.Driver However, the exception seems to suggest that the correct factory is being used by default. Your driverClassName is the old name, and might not be in the jar file any more. HTH Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Q] Extending a Realm
Riaan Oberholzer wrote: Is it possible to extend the standard Realms, or do you have to re-do it from scratch by implementing the interface again? I want everything the Datasource Realm provides, except when the authentication succeeds, I want to update the user db table to indicate the date/time this occurred. Can it be done? You want to record the data time of last login, right? I wouldn't modify/subclass the Realm at all - instead, I would write an HTTPSessionListener class, and do it in the sessionCreated() method. Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNDI: JDBC calss 'null'
Try this: namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value The factory class you're using is not for JDBC DataSources. HTH Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Context config - was Re: Pb with webapp admin
Jacob Kjome wrote: Put any Context specific stuff in a context configuration file. See admin.xml and manager.xml in webapps for an example. You must be using the manager app to upload a .war file since the server.xml is getting reloaded. So, name your context configuration file context.xml and put it in the META-INF directory of your .war file. Now do the upload and your context information should be there. Currently, given an application called, say drs, I provide a file called drs.xml that sits in webapps. This contains the Context/Context part of server.xml. Does the META-INF/context.xml file do exactly the same thing? If so, which is preferred, if not, any pointers to where I can find out about it? I cant find anything in the docs about this. (I run tc 4.1.14) Thanks, Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat: j_security_check: Form Authentication
Muhammad Bilal wrote: I want to have a synchronization between the authentication stuff. Like, I have a web site, and every user has some role, and every user can access some protected resource based on his role. Now I want to use JDBC realm for this purpose with Form auth. so that user logs into the site only once and use it according to his access rights, instead he requests for a protected resource and then he goes to login page. You see, its quite logical that user should have a leverage to go to login page first or to access a protected resource. If things work for him in latter case why not in former? I believe there must be some thing to do it, after all tomcat's default admin site is doing the same thing. It doesn't! The link to the admin app is /admin/index.jsp - this is a protected resource, so the user is redirected to the login page /admin/login.jsp. Once authenticated, he then sees the page he originally requested. The problem is that if you enter /admin/login.jsp directly, you get an error when you submit the form. So, the general problem is that it is not possible to bookmark the login page, unless there is a subtle work-around that I haven't come across. However, if a user bookmarks a protected resource (or is given a url to a protected resource), he will be asked to login the first time he accesses that page in a session. Thereafter, he can navigate directly to any page which matches (one of) his assigned role(s). HTH Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat manager app
Erik Weibust wrote: Well, I have no problem using the admin tool. Could there be anything else causing this? The manager app uses BASIC authentication, rather than FORM (per the admin app) - what happens if you close Netscape re-start it? FYI Netscape 7 does not show this behaviour (on Mac OS X). Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: connecting Tomcat to apache
Werner van Mook wrote: Hi All, Consider me stupid. I have a Powerbook with Mac OSX 10.2.6 It runs apache out of the box. Now I want to connect tomcat with it. Could somebody point out to me the right way of doing this? I can't consider you stupid - I run Apache + Tomcat on my Powerbook! However, you will have to do some work: assuming you want to use mod_jk, then you'll need to install compile Apache2, then you can pick up a binary for mod_jk.so from jakarta.apache.org. For more details, go to John Turner's Howto site (www.johnturner.com ?) and 'pretend' you're running Linux. I can't remember the exact options I gave to 'configure' when I built Apache2, except that I had to use the 'pre-fork' option. HTH Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: IOException: failed to communicate with MySQL
Mindaugas Genutis wrote: a couple of days ago a post went by talking about MySQL default timeout being set to 8 hrs for connections... betting this might be your problem... Thanks for pointing this out. I've read the thread Tomcat problems every morning. However, no solution was suggested in that thread. One can assume the solution implicitly: increase default MySQL timeout from 8 hours to say 48 hours. However, if my application stays idle for 48 hours during holidays, it will disconnect after that. Does anyone else have a suggestion on how to improve on this? Yes, add ?autoReconnect=true to the connection url. Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DB Connection
Munteanu Gabriel wrote: Guys, this is very interesting discussion. I have read all the posts. I still have another problem. What about VERY large Result Sets? I have a portal with 1 000 000 records[books related]. When the user searches for romance, there are more than 200 000 records returned. I can't use CachedResultSet [I would have to hold all this in memory, in an object registerd in the HTTPSession] also I can't use the ArrayList. I am also using a DB pool system and I want to return the connection. Is there a solution? [better said an optimal solution]. If the ResultSet doesn't hold all the records in memory[RAM], (setFetchSize(int) - sets how many rows to be brought into memory), where is the rest? A concrete case: select name from books - returns 850 000 records. statement-setFecthSize(25); the rest of 849975 records are left in the database?, on the hard-disk? or the database is making all this resultset internally, and itself uses RAM and some swap? Does anyone knows all this internal action, how it is going on? Comments, URLs appreciated. Info: I use Postgresql if it counts. In the case that I will have to not return the connection to the pool, and, because ResultSet doesn't hold in memory all the records I would save it int the HTTPSession, HOW AM I going to know when to release it and return the connection to the pool? In this case, I would query the database initially, asking ONLY for the unique id of each row (or the master row if there's a join involved). I would then cache the entire result set, and then fetch the complete records subsequently, by doing something like: SELECT whatever FROM mytable WHERE oid IN (oid1, oid2, oid3, ...); Of course, you'd have to handle the case where a cached oid is deleted between the initial query, and the later one. If the unique id (oid in my example above) is an integer, you can cache the entire database in 4Mb. HTH Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TOMCAT + MYSQL need help
Anthony Roque Adriano wrote: Sorry, i meant JDBC, all my configuration is default except for the polling i've added at server.xml and set debug level to 9. anyway here a sniff of the log file when i place the connector/j under my APPLICATION/WEB-INF/lib directory or at $CATALINA_HOME/common/lib or at CATALINA_HOME/shared/lib java.util.zip.ZipException: invalid END header (bad central directory offset) at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.init(ZipFile.java:112) at java.util.jar.JarFile.init(JarFile.java:117) at java.util.jar.JarFile.init(JarFile.java:55) at org.apache.catalina.loader.StandardClassLoader.addRepositoryInternal(Standar dClassLoader.java:1082) at org.apache.catalina.loader.StandardClassLoader.init(StandardClassLoader.ja va:221) at org.apache.catalina.startup.ClassLoaderFactory.createClassLoader(ClassLoader Factory.java:204) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:155) Bootstrap: Class loader creation threw exception snip... Well, from here it looks like you have a corrupt jar file. You could see whether the jar command can read it (jar tvf your_jar_file.jar) - my guess is that it can't. If so, get a new copy. HTH, Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: TOMCAT + MYSQL need help
Anthony Roque Adriano wrote: Hi, I've been searching the mailist but can't seem to find a problem similar to what i'm encountering. First here's a background of my setup MySQL server = mysql-server-3.23.54a-3 TomCat = jakarta-tomcat-4.1.18 ODBC = Connector/J 3.0.6-stable Base OS = RedHat Linux 7.3 JSDK = j2sdk1.4.1_02 $JAVA_HOME = /path/to/j2sdk1.4.1_02 $CATALINA_HOME = /path/to/jakarta-tomcat-4.1.18 Im making a program which will need to get the data from MySQL, All TOMCAT documents i've read all said to put my ODBC Connector (mysql-connector-java-3.0.6-stable-bin.jar) under $CATALINA_HOME/common/lib, but if I put the file there, TOMCAT is not starting, don't even have anything on the logfile. I also tried putting the connector/j on my application lib ($CATALINA_HOME/webapps/MYAPPLIC/WEB-INF/lib), Tomcat runs but my application is not. I also tried playing with $CLASSPATH to no avail. Anyone experienced this ? or am i just missing something ? ODBC? Are you sure you mean ODBC, and not JDBC? How do you connect to the db? Via JNDI, or programmatically in the servlet? What DEBUG level do you have set in server.xml elsewhere? Are you sure the logs are empty? You need to post LOTS more information before we can help you! Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MySql connection pool difficulties
Tom O'Neil wrote: After scouring the mailing list and a few forums, I'm still at a dead end attempting to get MySql connection pooling working with Tomcat. I'm running the following on Windows 2000: Tomcat 4.1.18 MySql 4.0.10 JDK 1.4.1 I've tried using both the MySql 3.0.5 and 2.0.14 drivers. I've placed these in [tomcat root]\common\lib (only one at a time - never both simultaenously). I know my code and web.xml are pretty solid, because I'm porting a funtional app from WebSphere 5.0. snip And the error I'm getting is: Cannot create JDBC driver of class 'com.mysql.jdbc.Driver' for connect URL 'jdbc:mysql//localhost:3306/dsdemo?autoReconnect=true' It seems that a fair amount of other folk have encountered this same problem, but I have to stumble across a solutions. Any help would be appreciated. Your config looks OK - I compared it to mine (which works!), and could see nothing out of the ordinary. But, is your error message complete? A problem I had to begin with was that since Java can only create 'proper' sockets (ie not UNIX_SOCKETs), mysql was actually receiving a connection request from my.domain.name, and NOT from localhost. Since I only had mysql authorisation set up for localhost, the connection was refused. The correction was obvious once I spotted it! However, this was on a Unix Box (Mac OS X, actually), so under Windows, things may be different. HTH ! Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: automatically redirect http to https in tomcat
[EMAIL PROTECTED] wrote: Is it possible to automatically redirect any http request to https in an Apache + Tomcat environment? For example, If I enter http://my.domain.com/mycontext http://my.domain.com/mycontext , I would be automatically redirected to https://my.domain.com/mycontext? Yes, I do it! What needs to be remembered is that since you are doing the SSL bit in Apache, you don't use the 'transport guarantee' thang in Tomcat (which is how Tomcat 'knows' it has to switch to HTTPS). SO, on my site, I have an unprotected home page .../drs/home with a link to the protected home page .../drs/private/home. Along the way, Tomcat authenticates the user via my login form .../drs/login. The login form (and every subsequent page of course) needs to be SSL-encrypted. So, here's how I do this in httpd.conf... VirtualHost macx.ei.jrc.it ServerName macx.ei.jrc.it hostname:/drs # Redirect Tomcat's http:.../login request to https:.../login # Redirect /drs/login https://macx.ei.jrc.it/drs/login Redirect /drs/private/home https://macx.ei.jrc.it/drs/private/home # Static files Alias /drs /usr/local/tomcat/webapps/drs Directory /usr/local/tomcat/webapps/drs Options Indexes FollowSymLinks DirectoryIndex web/index.html /Directory # Deny direct access to WEB-INF and META-INF # Location /drs/WEB-INF/* AllowOverride None deny from all /Location Location /drs/META-INF/* AllowOverride None deny from all /Location JkMount /drs/home ajp13 JkMount /drs/auth_error ajp13 JkMount /drs/login_error ajp13 /VirtualHost VirtualHost macx.ei.jrc.it:443 # General setup for the virtual host DocumentRoot /usr/local/apache2/htdocs ServerName macx.ei.jrc.it:443 ServerAdmin [EMAIL PROTECTED] ErrorLog logs/error_log TransferLog logs/access_log SSLEngine on SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL SSLCertificateFile /usr/local/apache2/conf/ssl.crt/macx.crt SSLCertificateKeyFile /usr/local/apache2/conf/ssl.crt/macx-private.key Files ~ /drs/login SSLOptions +StdEnvVars /Files Directory /drs/private SSLOptions +StdEnvVars /Directory SetEnvIf User-Agent .*MSIE.* \ nokeepalive ssl-unclean-shutdown \ downgrade-1.0 force-response-1.0 CustomLog logs/ssl_request_log \ %t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \%r\ %b macx.ei.jrc.it/drs # Static files Alias /drs /usr/local/tomcat/webapps/drs Directory /usr/local/tomcat/webapps/drs Options Indexes FollowSymLinks DirectoryIndex /web/index.html /Directory # Deny direct access to WEB-INF and META-INF # Location /drs/WEB-INF/* AllowOverride None deny from all /Location Location /drs/META-INF/* AllowOverride None deny from all /Location JkMount /drs/j_security_check ajp13 JkMount /drs/private/* ajp13 JkMount /drs/auth_error ajp13 JkMount /drs/login ajp13 /VirtualHost HTH Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Little system X Great architecture
Jose Euclides da Silva Junior - DATAPREVRJ wrote: Hi, i need to code a system in which there is no many business rules, but i need data persistence in a database. Even if this system will have an enterprise users scope, should i use EJB technology? What about only servlets/jsp? Regards, Euclides. The application I am currently developing seems similar to yours: I have persistant data in a relational database, with a Web-based client tier. I have abstracted the SQL-specific stuff into separate classes (this means I can easily switch between MySQL [development] Oracle [production]. Business-level logic (including transactions) is in a next layer of code, while the servlets do the presentation-level work only. I don't use JSPs, as I found that using an HTML template engine (Velocity) provides a cleaner separation of the HTML generation. I did consider EJBs initially, but rapidly came to the conclusion that my app was *way* too small - the overheads are so great that you need a substantial application before you reach break even. HTH Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat - SSL Question .. Certificate problem
Mufaddal wrote: Hi, I have followed the instructions at: http://jakarta.apache.org/tomcat/tomcat-4.0-doc/ssl-howto.html to enable SSL. Problem: when i try to access the jsp page using : https://locahost:8443/login.jsp ... a dialogue pops up saying: Unable to establish a secure connection to 'localhost'. There is a problem with the security ceritificate from that site. (The identity of certificate issuer is unknown). The information you view and send will be readable to others while in transit, and it may not go to the intended party. Continue loading this page ? Stop Continue When i hit continue i can still access my jsp pae and everything works fine. The only problem is that SSL is not being used since the connection could not be established as warned by the dialogue box that popped up. The certificate i had generate was using keytool just like its explained on the howto webpage. I am using internet explorer 5.2 on Mac OS X. Can anybody please shed some light on where i am going wrong. ? Your problem is that you're using IE ! IE (on Macs, at least) will not accept a certificate unless it has been signed by an already-known certificate authority (eg Verisign). The quick solution is to switch to Netscape 7, which allows you to decide whether to accept the certificate or not. BTW Safari is as brain-dead as IE in this respect. HTH Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT]JSP defense - can you point me in the right direction
Denise Mangano wrote: Wow. Thank you all so much for responding to this question. Its getting quite frustrating hearing them saying CGI CGI CGI... especially since they are looking for a 'quick' solution and haven't done any research to the advantages/disadvantages of using one technology over the other. This project is to design a system that will one day (hopefully) be implemented in one of the largest hospitals in the area. This is definitely not child's play - it will not only be important for this project to be maintainable, but also to be expandable to meet the growing needs of the client. Personally, when I think CGI, I think of some rinky dink site that people put up to sell the useless items collecting dust at home. Forgive me if I am offending anyone, I am sure that CGI does have its good qualities... PHP was suggested but the ones who were adamant about CGI tossed that out the window... I would rather have to struggle through learning PHP then to use CGI! I would only add two things to all the good words already said: 1) If the site is to be 'secure', then you will have to worry about things like user identification and authorisation, and maintaining sessions - this comes 'virtually free' with servlets, and, in my experience, is a major hassle with CGI. 2) Try looking at HTML template processors, such as Jakarta's 'Velocity' project as an alternative to JSPs - I have found Velocity + Servlet a much 'cleaner' solution to my problems than JSPs (of course, YMMV!). HTH Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat, tyrex and mysql, and autocommit
emiliano albiani wrote: This is what I did with no success: mysql ise set autocommit=0; but tyrex still have the same problem. What am I missing? Sorry, Emiliano, I don't use Tyrex, so I don't know how you'd do this :-( Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Ant redeploy, Apache (mod_webapp) Tomcat 4.1
Morgan Pyne wrote: Hi all, Is anybody on this list using Ant to redeploy war files to an Apache(mod_webapp)-Tomcat setup? I have several servlets already deployed, configured, and working correctly on the following setup: Apache (1.3.26), mod_webapp (machine 1) Tomcat 4.1.12 (machine 2) The redeployment seems to work correctly, but unfortunately when I access the URL I am often returned a blank page (no errors) instead of seeing my servlet. Restarting apache cures the problem. It is occasionally possible (randomly?) to access the new servlet without a restart, but mostly not. The symptoms seem to imply to me that only new WARP connections created since the redeployment are able to access the servlet, whereas connections that had been existing prior to it get confused and can't see the newly redeployed servlet. Has anybody else noticed this behaviour? Is it a bug in mod_webapp ? This is what I would expect to happen; AFAIK, mod_webapp, mod_jk etc. all create socket connections to Tomcat. In order to re-deploy your web app, Tomcat stops and restarts the context, which closes one end of the socket. Therefore Apache has to be restarted in order to reconnect to Tomcat properly. Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat, tyrex and mysql
emiliano albiani wrote: HI, I'm trying configuring tyrex in my tomcat installation to use MySql xa driver. I did it as described in tomcat documentation: http://jakarta.apache.org/tomcat/to...les-howto.html, http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html, but something is going wrong. snip Error trace: 2003-01-31 12:04:24,631 ERROR [Thread-3](ConnectionPool.java:1046) - Error attempting to destory connection XAConnection: unused by connection pool iseDatasource java.sql.SQLException: Can't call commit when autocommit=true at com.mysql.jdbc.Connection.commit(Unknown Source) at com.mysql.jdbc.xa.XAConnectionImpl.close(Unknown Source) at tyrex.resource.jdbc.ConnectionPool.discard(ConnectionPool.java:1042) at tyrex.resource.jdbc.ConnectionPool.release(ConnectionPool.java:852) at tyrex.resource.jdbc.ConnectionPool.connectionErrorOccurred(ConnectionPool.java:636) at com.mysql.jdbc.xa.XAConnectionImpl.getConnection(Unknown Source) at tyrex.resource.jdbc.ConnectionPool.getConnection(ConnectionPool.java:427) at tyrex.resource.jdbc.ConnectionPool.getConnection(ConnectionPool.java:398) By default MySQL is in autocommit mode - you should turn it off to enable transactions. Martin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: servlet with Tomcat
Steve R Burrus wrote: Hi Ralph, whoever the hell you are, or supposed to be! Why do you damned people always have such a holier-than-thou attitude towards people like myself who want nothing more or less than to have our questions answered!!! I'm quite sorry if I didn't seem to ask the questions just the way in which you wanted me to ask them!! You know what they say Different strokes for different folks!!! I wish that you could believe me when I say that I have tried to ask the quesions in the most civilized and dignified way possible, and I FEEL QUITE SORRY FOR YOU AND OTHERS if you cannot find it in yer heart to forgive me one more time! Hi Steve, I haven't replied to your messages in the past, as I am not a Windows user, and not in a position to help you with your NT-specific problems, which you seem now to have resolved. I'm writing now because you seem to be having difficulty *communicating* with this list (based on the reactions to your posts). Email is a difficult medium to convey anything other than information - even 'smilies', and other artifacts only partially help. Peppering your postings with expletives is likely to offend, even if that was not your intention, as I'm sure it wasn't. However, you recently asked what the servlet servlet-mapping elements meant: Here's an example from my web.xml file. The servlet class indicates the fully qualified class of the servlet, while the servlet name simply indicates a short (but unique) name that acts as an alias within the web.xml file. Hence... servlet servlet-namelogout/servlet-name servlet-classcom.terma.martin.drs.servlet.Logout/servlet-class /servlet The servlet mapping element allows you to map a url to a particular servlet, referred to by its alias (ie, the servlet-name). Hence... servlet-mapping servlet-namelogout/servlet-name url-pattern/private/logout/url-pattern /servlet-mapping So, given a host www.myserver.com a context of myapp, the url www.myserver.com/myapp/private/logout will be directed to the servlet whose name is logout, which is com.terma.martin.drs.servlet.Logout. HTH, Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: JDBC Connection pooling
Nathan McMinn wrote: When trying to get a connection pool set up, tomcat spits this exception back out. Nowhere in the code do I reference this class. Can anyone point me to a good HOWTO on connection pooling in tomcat 4.0.6? TyrexDataSourceFactory: Cannot create DataSource, Exception java.lang.ClassNotFoundException: org.hsql.jdbcDriver I had the same experience: it seemed as though Tyrex had the hypersonic db hard-coded, so that any attempt to specifiy a different jdbc driver was simply ignored. The solution was to move to TC 4.1.x, which uses the jakarta-commons DBCP stuff in place of Tyrex, and which works fine. HTH, Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: DTD for server.xml??
Craig R. McClanahan wrote: On Wed, 8 Jan 2003, Turner, John wrote: Date: Wed, 8 Jan 2003 11:31:16 -0500 From: Turner, John [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: '[EMAIL PROTECTED]' [EMAIL PROTECTED] Subject: DTD for server.xml?? Hello - I notice that the top of web.xml has: ?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; yet the top of server.xml has nothing. I'm very new to XML, so forgive me if this is a lame or FA question, but is there a DTD for server.xml? If so, why isn't it specified in server.xml, and what is the URL? Is server.xml real, official XML or just convenience XML? There is no DTD for server.xml because there cannot be. The problem is that server.xml is extensible -- for example, the set of attributes recognized by a Valve or Context element depends on the implementation class of the internal component that corresponds to it. The startup process uses Java reflection to match them up to property setters on the corresponding beans. There is no way to express this kind of thing in a DTD. Your server.xml is (and must be) well formed XML. It just cannot be validated. There may be other good reasons, but this isn't one of them :-) Here is an extract from my server.xml... Logger className=org.apache.catalina.logger.FileLogger prefix=catalina_log. suffix=.txt timestamp=true / This could be equally well expressed as Logger className=org.apache.catalina.logger.FileLogger property property-nameprefix/property-name property-valuecatalina_log./property-value /property property property-namesuffix/property-name property-value.txt/property-value /property property property-nametimestamp/property-name property-valuetrue/property-value /property /Logger or, more concisely as Logger className=org.apache.catalina.logger.FileLogger property name=prefix value=catalina_log./ property name=suffix value=.txt/ property name=timestamp value=true/ /Logger In both cases, the abstraction of property names allows a DTD to be defined that is inherently extensible, and thus would allow an XML parser to validate server.xml even if extended by an admin. Or am I missing something? Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: JK2 and SSL
Chris McCabe wrote: This new release made no difference in the behavior of the JK2 connector with an https connection, so my question remains: Does anyone know the secret formula to get a JK2 connector to work with both the http and https connection of the Apache2 web server? I get a 404 Not Found error when I hit the https part of the server. Is this just a bug or do I need to configure it in some special way? The VirtualHost element takes an optional port number - since SSL happens (usually) on port 443, you need a VirtualHost www.mysite.com:443 section in hhtpd.conf did you specifiy this? HTH Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: CATALINA_BASE Error ContextConfig.tldScanJar
Elisabeth Julg wrote: Hi, Bonjour, - Root Cause - java.io.IOException: Le chemin d'accès spécifié est introuvable at java.io.WinNTFileSystem.createFileExclusively(Native Method) at java.io.File.checkAndCreate(File.java:1313) at java.io.File.createTempFile(File.java:1401) at java.io.File.createTempFile(File.java:1438) at sun.net.www.protocol.jar.URLJarFile$1.run(URLJarFile.java:169) at java.security.AccessController.doPrivileged(Native Method) at sun.net.www.protocol.jar.URLJarFile.retrieve(URLJarFile.java:164) at sun.net.www.protocol.jar.URLJarFile.getJarFile(URLJarFile.java:42) at sun.net.www.protocol.jar.JarFileFactory.get(JarFileFactory.java:78) This looks like a file permissions problem - but I don't know much about NT, so I can't be much more help, I'm afraid! A quand une liste en français ? Mais à quoi ça servirait? Etant donné que le nombre de membres francophones de cette liste est petit, et probablement, ne comprend pas les développeurs de Tomcat, une liste en français risquerait d'être inutile. De surcroît: même si Craig, par exemple, parlerait courrament français, l'interêt de cette liste est que la grande majorité des problèmes rencontrés s'appliquent à tout le monde, et non seulement les français! Ceci dit, un grand nombre de messages proviennent de personnes dont la langue maternelle n'est pas celle de Shakespeare, et il est parfois difficile de comprendre ce qu'ils écrivent - même pour un Anglais, comme moi! Si jamais tu penses qu'un message t'interesse, mais tu ne le comprends pas, n'hésites pas à me contacter, et j'essayerai de t'éclairer. Amicalement, Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: [classloading] How to use URLClassLoader within a servlet
Ola Berg wrote: I have this problem with using my own (URLClassLoader) class loader in a servlet of mine. The thing is that I am writing a web front end to domain name services (automatic registration of .org, .com. .biz, .info etc domains). Depending on the top level domain, I need to use different versions (jars) of the same API, since the protocol differs. So I need to dynamically load my classes at runtime. Just putting the jars in lib won't work since there are different implementations of the same classes in them. I have to decide in runtime. Using the URLClassLoader in a standalone app works perfectly, when using it in a servlet it just hangs. I suspect the problem lies within the different lookup order used in servlets (as dscribed in the classloader-HOWTO). I can't figure out how to do it. Has anyone experience in the field? I have an analogous case, in which I have a single API for database access, with choice of database (Oracle, MySQL,...) made at run-time. The problem was simply solved using the 'Abstract Factory' pattern. This means that I have two packages (db.MySql, db.Oracle), which both include an implementation of a DBFactory. I then use ClassForName() to load the appropriate implementation, and then call factory methods to instantiate the appropriate classes. Hence, you don't need to bother with custom classloaders, and your design is much 'cleaner' as a result. HTH, Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: query
faisal shabbir wrote: Hi, I have just implemented ssl on tomcat4.0 by using jsse. Now on running my application i found that ssl is working on all of the pages. Problem is that i want ssl to work on the pages that contains sensitive information. How can i turn ON and OFF ssl on jsp pages. You really don't want to do this! Apart from securing the 'visible' data passing between the client and the server, SSL also secures the session id. Once a hacker has got the session id, he can masquerade as the client. Probably not what you want :-) HTH, Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: tomcat setup
Mark Walker wrote: I have 4.1.12 installed on a Wallstreet G3 Powerbook and it is running great! There's a document in Apple's Developer Forum (http://developer.apple.com/internet/java/tomcat1.html) that covers installing Tomcat on the Mac. It refers to 4.0.1 but should work fine for you. Actually, it sounds like you may be past that part already. The one hurdle I had in the whole process (not in the article) was caused by StuffIt! when it unzipped the download. The filename for the class SetCharacterEncodingFilter.class is too long for StuffIt! so it drops the ss off the end. Now the JVM doesn't find it and you get an error page instead. I believe the file is in two directories (I'm not near the Mac right now). Look in $CATALINA_HOME/webapps/examples/WEB-INF/classes/filters and $CATALINA_HOME/server/webapps/admin/WEB-INF/classes/filters. Just fix the file extension and you should be good to go. The manager and admin applications should only require the following element in your tomcat-users.xml file: user username=your_user_id password=your_password roles=admin,manager/ You should get GNU tar - Stuffit, and Mac OS X tar have a path-length limitation which results in name truncation. Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: App Initialization question
[EMAIL PROTECTED] wrote: Hi, I need to store an object in the application context and this object has to be instatiated when the application is deployed. I am thinking about a solution but I would like confirmation that it is a good practice to do : - declare a servlet that would have a load-on-startup element in web.xml - implement the creation of my object in this servlet - store the generated object in the application context The point is that this servlet would be used only for that purpose (initialization) and I guess there may have some more standard way to do so. Can someone confirm that this is the way to do or point me to a better solution ? Generally, using a servlet with a load-on-startup element is NOT the best way to go about it - the servlet spec allows servlet containers to instantiate and trash servlets at any time. Hence, your servlet might be instantiated several times, and your initialisation code executed several times. The preferred method is to define a class that implements the ContextListener interface, and to perform initialisation code in the contextInitialised() method. Cleanup can be done in the contextDestroyed() method. I use this to load a bunch of application properties from an external file into a singleton class, MyAppProperties. The servlets then just do MyAppProperties.getInstance() to get the instance of the class. It works great! HTH, Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: session startup
[EMAIL PROTECTED] wrote: OK, Perhaps then a session is not what is required here. I wish to make available upon startup of the server, some simple string values. They must be accessible to all clients, auto initialised when the service starts up. This is something similar to a posting I made a while ago reagrding libraries. I want to load into memory these values when the server starts, that will be accessible to all clients. Thanks Paul. You need to implement a ContextListener class. Here's a snippet of what I have: 1) Java: package com.terma.martin.drs.util; import java.io.*; import java.util.*; import javax.servlet.*; public class ApplicationInitializer implements ServletContextListener { public void contextInitialized(ServletContextEvent sce) { ServletContext ctx = sce.getServletContext(); String propsFileName = ctx.getInitParameter(props-file); ... etc. 2) web.xml: web-app context-param param-nameprops-file/param-name param-value/WEB-INF/app.properties/param-value /context-param listener listener-classcom.terma.martin.drs.util.ApplicationInitializer/listener-class /listener HTH Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: MacOS
Felipe Schnack wrote: Anyone have experience with Tomcat on MacOS X servers? Or with java in general? I would like to know if these machines are good options for serving jsp or I should stick with PCs... I'm running Apache + mod_jk + Tomcat 4.1.12 + OpenSSL + MySQL on Mac OS 10.2 and it all runs just fine! Check the archives - someone posted recently regarding probs with Mac OS X *Server* - IIRC, WebObjects is pre-installed, and generates some conflicts with Tomcat. Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: GIF images don't show up on first request, but show up fine after on 4.1.12
Turner, John wrote: Hello - We have an app running on 4.1.12. In stand-alone mode, this URL works perfectly: http://some.server.com:8080/myApp http://some.server.com:8080 also works perfectly (myApp is the default app) With Apache (2.0.43), using JK, the GIF images on the page show as broken links the first time accessing this URL: http://some.server.com/ Refreshing the page, the GIF images show up fine, and on every page after that. The only time the images do not show up is when the request runs through Apache, and it is the first request of the session. All other content on the initial page (text, etc.) shows up just fine. Only the GIF image links are broken, and only on the first request. The Apache error logs say the image files don't exist, but then they are found on the very next request. I've searched the archives, but haven't found any posts that seem related. Any ideas what might be wrong? I assume that you have JK configured such that Apache *should* be serving your static content, right? If so, then surely, this is an Apache config problem, rather than a tomcat problem? I'm no Apache expert, but if you post the relevant bits of httpd.conf, I'll take a look at it (It's the least I can do, having successfully set -up Apache+jk+tc4.1.12 thanks to your HOWTO pages!) Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Startup classes in Tomcat.
Justin Ruthenbeck wrote: Write a servlet that calls each of the startup classes you need to run and set it up in your web.xml. Maximum portability, minimum work. justin At 06:23 PM 11/19/2002, you wrote: Hi All, I am using tomcat 4.1. I am a newbie to tomcat. We are off-loading most of our stuff from weblogic to tomcat. In weblogic we have some startup classes that are needed for the JSPs. How do we configure the same startup classes in tomcat? These are not servlets so cannot use web.xml. Any ideas? Better would be to write a class that implements ServletContexTListener, and do your initialisation stuff in the contextInitialised() method. HTH Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Programmatic login
Juergen Weber wrote: Hello, we have a portal. Now the marketing people want that on the portal page be a form with user and password field. After submitting the user should be logged in. First this looked like a very easy to do feature. We use container managed security to protect some pages. So submitting the above mentioned form should simply authenticate the user with the container. As simple as that seems, I cannot find any way to do this via the servlet API. Two posts by Craig R. McClanahan (http://archives.apache.org/eyebrowse/ReadMsg?[EMAIL PROTECTED]msgId=297658 and http://archives.apache.org/eyebrowse/ReadMsg?[EMAIL PROTECTED]msgId=297211) suggest, that this is in fact not possible. If that is indeed the case, this is a big deficiency of the servlet specification. Or is there another solution? I haven't tried this, but the following might work, and is probably portable... You need to have two portal home pages, one with the login form on, /portal/login, and one without, /portal/home. Make /portal/home the default page. Put a security constraint on /portal/home so that users who aren't logged in are automatically forwarded to /portal/login. If they log in, they are authenticated, and go to /portal/home. I don't know what happens if there are other links in /portal/login, but as long as they don't go to other protected pages, it ought to work. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: MBeans exception and mod_jk
First off, some encouragement I have Mac OS X 10.1.5, Apache 2.0.43, mod_jk.so (the latest), and Tomcat 4.1.12, and it works for me! There may be differences with OS X 10.2, plus I installed Tomcat in /usr/local so my workers.properties file looks like this: # BEGIN workers.properties # # Setup for apache system # # (optional) make this equal to CATALINA_HOME workers.tomcat_home=/usr/local/tomcat # # (optional) make this equal to JAVA_HOME workers.java_home=/usr # ps=/ worker.list=ajp13 # Definition for Ajp13 worker # worker.ajp13.port=8009 # change this line to match apache ServerName and Host name in server.xml worker.ajp13.host=localhost worker.ajp13.type=ajp13 # # END workers.properties I didn't notice any problem with your server.xml file, but anyway, here's the beginning of mine... Server port=8005 shutdown=SHUTDOWN debug=0 Service name=Tomcat-with JK Connector className=org.apache.ajp.tomcat4.Ajp13Connector port=8009 minProcessors=5 maxProcessors=75 acceptCount=10 debug=0 / I don't use the auto-generation feature, as I am using SSL on some/most of the pages, so I have the following in httpd.conf for the non-SSL part... VirtualHost localhost ServerName localhost localhost:/drs # Redirect Tomcat's http:.../login request to https:.../login # Redirect /drs/login https://localhost/drs/login Redirect /drs/private/home https://localhost/drs/private/home # Static files Alias /drs /usr/local/tomcat/webapps/drs Directory /usr/local/tomcat/webapps/drs Options Indexes FollowSymLinks DirectoryIndex web/index.html /Directory # Deny direct access to WEB-INF and META-INF # Location /drs/WEB-INF/* AllowOverride None deny from all /Location Location /drs/META-INF/* AllowOverride None deny from all /Location JkMount /drs/home ajp13 JkMount /drs/auth_error ajp13 JkMount /drs/login_error ajp13 /VirtualHost I should add that I was unable to build mod_jk.so successfully (it built without error, but didn't work - probably my incompetance!), so I'm using the pre-built one from the jakarta site. I hope this helps! Please feel free to ask for more info. Martin -- To unsubscribe, e-mail: mailto:tomcat-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org
Re: mod_jk - Apache 2.0.43 - Tomcat 4.1.12 config issues on Solaris 8
Turner, John wrote: snip On that note, there is no need to build the Java side of the connectors when building. All you need is the Apache side, and this can be done with ./configurethere is no need to run ant or anything else to get a connector binary, as the JAR binaries of the connectors are already included in the Tomcat package. Actually, this was one of the things I had to change when setting it up (on Mac OS X) - I had to rebuild the Jars as, strangely, my 4.1.12 didn't had the Config class(es). Martin -- To unsubscribe, e-mail: mailto:tomcat-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org
Re: tomcat and OSX
John B. Moore wrote: Martin, I you like I would be VERY glad to review your howto...G I'm working on setting this up on my iBook right now... Thanks much... John.. I shall write it up in more detail Real Soon... but, in essence, you will need to download the mod_jk.so binary for Mac OS X from the jakarta site (I followed links from the Tomcat 4.1 Docs JK HowTo) - I tried to build it from source, and failed. However, the download page (for Mac OS X) says it only works with the Apache 2.0.43 server, so if you don't have it, download and build it. I found that the --with-mpm=worker option (multi-threaded server) doesn't work, so reverted to --with-mpm=prefork (classic Apache behaviour). Make sure you specify --enable-so That done, I then went to John Turner's web site and followed the Linux example. HOWEVER - I ended up having to re-build the connector Jar, because the one I had (with 4.1.12) seemed to be missing the classes used by the Listener elements to auto-build the JkMount stuff that gets included into httpd.conf. Once I'd followed these instructions, It Just Worked! If you're interested, my complete config also includes SSL (via Apache OpenSSL). Now, all I have to do is to get all this working on the production platform (Solaris), too... HTH Martin -- To unsubscribe, e-mail: mailto:tomcat-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org
SSL, JK redirect question
I have tc4.1.12, Apache 2.0.43 mod_ssl and mod_jk set up and working successfully on my Mac (OS X 10.1.5), but tweaking the Apache config to get it to work was... involved, let's say :-) Users enter the site (using http: protocol) at /drs/home. This contains a button labelled Login that takes them to /drs/private/home. Because /drs/private/* is under a security contraint, it triggers a redirect to /drs/login which POSTs to j_security_check, etc. Previously, using tomcat-standalone, the transport-guaranteeCONFIDENTIAL/transport-guarantee triggered the switch to https: - however, this no longer works when Apache/mod_jk are in the loop. Because /drs/private/* isn't accessible via http: I was getting an Apache-generated 404 error when the login button on the home page was clicked: the solution I found was to place a Redirect /drs/private/home https://host/drs/private/home in httpd.conf Of course, this gives an extra redirect, and seems inelegant...does anyone have a better solution? [And no, I don't think mod_rewrite is a better solution!] Martin. PS I don't want to hard-code the full URL in the button on-click handler, as I don't want to have Yet Another Thing To Change when I move to the production server. -- To unsubscribe, e-mail: mailto:tomcat-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org
Re: mod_jk - Apache 2.0.43 - Tomcat 4.1.12 config issues on Solar is 8
Yesterday was one helluva day - I lost count of the number of times I typed ./configure, make, make install. Consequently, I'm not excluding the possibility that I did an mv of the jar out of tomcat instead of a cp - that would certainly explain the ClassNotFoundException :-) Martin Turner, John wrote: That is strange...the binary package is the same for all platforms. If they weren't in yours, they wouldn't be in any others. John -Original Message- From: Martin Jacobson [mailto:martin_j;libero.it] Sent: Thursday, October 24, 2002 3:33 AM To: Tomcat Users List Subject: Re: mod_jk - Apache 2.0.43 - Tomcat 4.1.12 config issues on Solar is 8 Turner, John wrote: snip On that note, there is no need to build the Java side of the connectors when building. All you need is the Apache side, and this can be done with ./configurethere is no need to run ant or anything else to get a connector binary, as the JAR binaries of the connectors are already included in the Tomcat package. Actually, this was one of the things I had to change when setting it up (on Mac OS X) - I had to rebuild the Jars as, strangely, my 4.1.12 didn't had the Config class(es). Martin -- To unsubscribe, e-mail: mailto:tomcat-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:tomcat-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org -- To unsubscribe, e-mail: mailto:tomcat-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org
Re: tomcat and OSX
John B. Moore wrote: Ian, Cool, Thanks... you are right that mod_webapp stuff is a pain.. I followed a HowTo I found for OS X and I could never to get it to work.. keep getting errors I'll get the book !! John.. I *did* get mod_webapp to work on Mac OS X, but abandonned it when I discovered how brain-dead it is. I have managed to get mod_jk to work on Mac OS X (10.1.5), thanks to John Turner's HOWTO site [Thanks John!]. I used his Linux example, which *nearly* worked: as soon as I get mod_ssl to work too, I'll write it up and post it. But, as another poster said, there seem to be very few OS X specific problems, hence the lack of posts. Martin -- To unsubscribe, e-mail: mailto:tomcat-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org
Re: Unable to use getGeneratedKeys() through dbpc
shawn wrote: Thanks for the input Steve, I agree that it SHOULDN'T be dbpc, but it looks as if it is. Actually the driver does support it quite nicely. Everything works great if I create my connection manually. Things only break if I retrieve the connection from jndi ( and thus dbpc ). //This can use getGeneratedKeys() Class.forName(com.mysql.jdbc.Driver).newInstance(); Connection conn = DriverManager.getConnection(jdbc:mysql://localhost:3306/testDB?user=- +dbUser+password=+dbPass); //This cannot.. javax.naming.Context ctx = new javax.naming.InitialContext(); javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup(java:comp/env/jdbc/testDB); Connection conn = ds.getConnection(); As things stand now I must either give up connection pooling ( not a good option ) or create a workaround through sql ( decreased performance through through additional queries ). I don't think you need worry about the performance - even if the driver supports the getGeneratedKeys() method, it still has to make an sql query (SELECT LAST_INSERT_ID() for MySQL) to get the information. The only advantage is that getGeneratedKeys() is db-independent. Martin -- To unsubscribe, e-mail: mailto:tomcat-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:tomcat-user-help;jakarta.apache.org
Re: Defining methods in JSP pages
Craig R. McClanahan wrote: The biggest problem with the general approach you suggest is that you are mixing Java logic into your pages, which means you need a Java programmer to maintain them. A much better strategy is to use a model-view-controller (MVC) style architecture that has back-end business logic setting up the dynamic things your page needs in request attributes or session attributes, and then forward to the page (which can use things like jsp:getProperty to grab them. An example of a framework for MVC style development is Struts http://jakarta.apache.org/struts. An additional benefit of banishing scriptlets from your pages is that the JSP page compiler can generate better code, as well as handling bigger and more complex pages. The general trend in modern JSP development is away from scriptlets. Another solution (which I use) is to not use JSPs at all - just servlets with the Velocity template engine http://jakarta.apache.org/velocity. Velocity allows a very clean separation between the business logic and the presentation. No weird syntax, no Java in the HTML to confuse Web designers, no run-time translation/compilation. Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
SSL used to work, now doesn't!
Hi, I'm running 4.0.4b3 4.1.12 on Mac OS X 10.1.5. I had SSL working correctly, but now, suddenly, it doesn't any more :-( I suspect that there is something wrong external to tomcat, but this is the stack trace I get: [INFO] Http11Protocol - -Initializing Coyote HTTP/1.1 on port 80 java.io.IOException: Cannot recover key at org.apache.tomcat.util.net.JSSESocketFactory.initProxy(JSSESocketFactory.java:231) at org.apache.tomcat.util.net.JSSESocketFactory.createSocket(JSSESocketFactory.java:127) at org.apache.tomcat.util.net.PoolTcpEndpoint.initEndpoint(PoolTcpEndpoint.java:263) at org.apache.coyote.http11.Http11Protocol.init(Http11Protocol.java:150) at org.apache.coyote.tomcat4.CoyoteConnector.initialize(CoyoteConnector.java:1002) at org.apache.catalina.core.StandardService.initialize(StandardService.java:579) at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:2245) at org.apache.catalina.startup.Catalina.start(Catalina.java:509) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at java.lang.reflect.Method.invoke(Native Method) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203) [ERROR] Http11Protocol - -Error initializing endpoint java.io.IOException: Cannot recover key Catalina.start: LifecycleException: Protocol handler initialization failed: java.io.IOException: Cannot recover key LifecycleException: Protocol handler initialization failed: java.io.IOException: Cannot recover key at org.apache.coyote.tomcat4.CoyoteConnector.initialize(CoyoteConnector.java:1004) at org.apache.catalina.core.StandardService.initialize(StandardService.java:579) at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:2245) at org.apache.catalina.startup.Catalina.start(Catalina.java:509) at org.apache.catalina.startup.Catalina.execute(Catalina.java:400) at org.apache.catalina.startup.Catalina.process(Catalina.java:180) at java.lang.reflect.Method.invoke(Native Method) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203) Catalina.stop: LifecycleException: This server has not yet been started I looked at the source of JSSESocketFactory, and the exception is being thrown from a rather big try{} block, and ALL exceptions are re-thrown as IOException, so it's difficult for me to identify where the problem might be. The server.xml parameters are correct (they didn't change!), and keytool can retrieve the certificate. I suspect that the culprit might be a security upgrade I recently applied to Mac OS X, but before I post a bug report to Apple, I'd like to pinpoint where the problem is, and reproduce it in a simple test class, so any help identifying the offending method call will be greatly appreciated! Thanks, Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Help with test needed.
Robert L Sowders wrote: I've just about completed a new site and I've been wondering about a few things, specifically how does the public see it. It's an ArcIMS site and I know it will appear to load a bit slow, (that's just how ArcIMS works). I'm hosting the front end in one place and the data at another. I'm wondering about the network latency that is built in. If you would go to http://terra.wr.usgs.gov/pilots/wa-id/viewer.htm, then zoom in about three times and click on the orthophoto check box that comes up on the right hand side, then hit the refresh button, this final refresh will give you an idea of the network latency. I can't see it because I'm on the DOI backbone. Any help is appreciated. I just tried it - I'm connected @ 10Mb/s to a fast backbone in Italy - and although it takes ~ 10 sec to display the page, the delay BEFORE it starts loading the image is only of the order of a second or two, so it's not too bad. I'm glad I'm not trying this at home via 56K dialup, 'though! HTH, Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: SSL security contraint for just the login page.
HAVENS,PETER (HP-Cupertino,ex3) wrote: I am using form based authentication on my Tomcat 4.0.4 server and I am trying to figure out how to set up a security constraint that would apply only to the login page. My global web.xml has a security constraint that points to a login.jsp page as the form-login-page. As I understand it, the global web.xml can only have one security-constraint. What I want to do is configure this login.jsp page to be served up via HTTPS only. This way users will not be submitting password as plain text. I know about using the user-data-constraint transport-guarantee, but I do not want to require SSL for all pages, just the login page. Is this possible? I don't know whether this is possible - I tried for a while, thinking like you that it was sufficient to protect the login page, until I Saw The Light. If you only protected the login page, then although the user's password would not be sent in clear, the session id on subsequent pages would be. Since a hacker only needs the session id to masquerade as your logged-in user, you MUST encrypt the entire session after login. This is what the servlet spec mandates, and what Tomcat does. Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: JDBC problem
Ryan wrote: Thank you, this worked! However, now, the next line of code gives me problems: Connection C = DriverManager.getConnection(jdbc:mysql://localhost/tob, user, pass); Gives me the error : javax.servlet.ServletException: Invalid authorization specification: Access denied for user: '[EMAIL PROTECTED]' (Using password: YES) When I run mysql --user=user -p with the same user/pass as in the getConnection() method, everything works fine. -thanx, ryan I had the same problem. The point is that tomcat passes the45.dhs.org as the host name, and NOT localhost. Therefore, you have to GRANT privileges to the user on this host in MySQL for the connection to work. HTH, Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Tomcat 4.0 - SSL DOES NOT WORK!
neal wrote: Thanks but this is actually specific to tomcat 3. The configuration for Tomcat 4 is a bit different. :( Some good overall SSL info though. I'll pass this to the SysAdmin to see if this tips him off to anything. Thanks. Neal Hi Neal, I'm using 4.0.4b3 with SSL working fine. Other than setting up web.xml (below), the only issues were (i) downloading JSSE and installing it as a standard extension (ie in the /lib/ext directory under Java's home. (ii) generating a self-signed cert with keytool (I don't have a Thawte cert) I did try to upgrade to 4.1.10, but I couldn't get the Coyote connector to work for me, so I've stayed with 4.0.4. Do you get any errors logged when you try using https ? Set debug to 9 and see what you get. Hope this helps - SSL DOES work - really! Martin extract from web.xml --- !-- Define an SSL HTTP/1.1 Connector on port 443 -- Connector className=org.apache.catalina.connector.http.HttpConnector port=443 minProcessors=5 maxProcessors=75 enableLookups=true redirectPort=80 acceptCount=10 debug=0 scheme=https secure=true Factory className=org.apache.catalina.net.SSLServerSocketFactory clientAuth=false keystoreFile=/Users/martin/.keystore keystorePass=mypassword protocol=TLS / /Connector -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: So what database and script language do you use?
Keith Pemberton wrote: Hi everyone... I have been trying to use MySQL and JSP,Servlets to interact with my tomcat server. So far I have had a lot of frustration and little luck. Anyway, I was just wonder what the majority of ppl are using as a database and scripting language. Your input is much appreciated! Keith My set-up: Development: Mac OS X + Tomcat 4.0.4 + Servlets + Velocity + MySQL Production : Solaris8 + Tomcat 4.0.4 + Servlets + Velocity + Oracle8i Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: form-login-config
Richard Chamberlain wrote: Hi Martin, We do have it on pretty much every page. Once the user is logged the form gets replaced with a kind of member control panel. If you look at slashdot.org they do a similar thing with a member login on each page in the right column - it's doesn't take up too much real estate. When I figured out how the form-login-config worked I realised I could of course do it like you were suggesting, however I really would like to get it working as is ideally - as that's how the html designed it. Any other suggestions? Hmm, tricky. Let's imagine that your login form posts to the member home page. Then, tomcat would re-direct to your login servlet. If this servlet had access to the user id password fields already posted, then you could simply pass them directly on to j_security_check. The trouble is, I don't know whether this information is available, nor how you might access it, and I don't have time to RTFM for you. :-) If that doesn't work, then I suggest you write a filter that goes in front of every member page; this would either check that the user had already logged in, or would validate the login parameters. HTH Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: form-login-config
Richard Chamberlain wrote: After I sent my previous message I played around a bit and it became clear that I was misinterpreting how to use form login. I'll explain what I want to do and perhaps somebody would be kind enough to point me in the right direction. I have a page that I only want members to be able to get to, member.jsp for instance. At the moment I've got it set up so attempting to access member.jsp will redirect you to the index page at which point you can login in and then be redirected to the member page. All works ok. However what I actually want is a form login on each page of the site and when a user logs in they get redirected to member.jsp. At the moment that gives me a invalid direct reference to form login page because tomcat wants me to go to member.jsp first and then be redirected to a form. Do I have to write myself some authentication code in this case? This was very easy in resin because you just mapped the j_security_check servlet and everything worked as I've outlined. Do you mean that you actually have the login form embedded in every public page? Doesn't that clutter up your pages unnecessarily? What I do is to have a Login button on every public page. The login button sends the user to the private home page. Since this is subject to a security restriction, the user is diverted to a login page first. Once logged in, he is automagically redirected to the private home page. This works well! HTH, Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: getConnection() returning a NULL JDBC driver
Robert Dunn wrote: Hi all, I am attempting to get a connection to the JDBC entry from the server.xml file and keep getting the error Cannot load JDBC driver class 'null'. The error occurs when I attempt to call ds.getConnection();. I have placed all of the Interbase JAR files in the Common\Lib directory; Do I need to register these with Tomcat somehow? snip Entry from the server.xml file is: Resource name=jdbc/Transhub auth=Container type=javax.sql.DataSource description=Resource name for the interbase client connection/ ResourceParams name=jdbc/Transhub parameter namedescription/name valueResource Parameters for the Transhub Interbase DB/value /parameter parameter namemaxActive/name value8/value /parameter parameter namemaxIdle/name value4/value /parameter parameter * nameuser/name -* change this to nameusername/name * valuesysdba/value /parameter parameter namepassword/name value/value /parameter parameter namedriverClassName/name valueinterbase.interclient.Driver/value /parameter parameter nameurl/name valuejdbc:interbase://localhost/C:/Program Files/Common Files/Insfin Shared/data/iitweb.gdb/value /parameter /ResourceParams Also, I've read somewhere on this list that folks have trouble with directory names with spaces in, so maybe you could fix that, too. But it's the parameter name that's the 'gotcha' :-) HTH, Martin. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Index.html/default welcome file - OT
garrett smith wrote: Still having troubles? On Mac OS, the OS will add an extra extension based on file type. This is done to make the computer more user-friendly, although it is exactly the opposite: it is counter-intuitive. I had to check Show Info on right-click menu and remove the hidden extension. I don't know if your OS does this, but you may want to check it out. Um, actually, no, it doesn't (we're talking OS X, right?). You can, if you want, hide the extension, but Mac OS X doesn't add one of its own. I suspect this so-called 'feature' was to make the Finder more like Windows for those making the upgrade. A Mac doesn't need a file extension to tell it what kind of file it is (this is Windows behaviour) - Mac files have a 'resource fork' which contains, amongst other things, the file type, and the associated application. Sorry for the soapbox, but I'd like to reassure fellow Mac OS X users out there - Tomcat works really well - forget it's a Mac, remember it's running BSD4.2 ! Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Trouble configuring Tomcat 4.0.4 JNDI connection to MySQL
[EMAIL PROTECTED] wrote: Vance, Good eye. It use to be driverName but got changed along the way to URL. Probably when I started following the 4.1 how-to. In any case, I changed back to driverName and, alas, same problem. Vance, do you get the same error? javax.naming.NamingException: Exception creating DataSource: org.hsql.jdbcDriver at org.apache.naming.NamingContext.lookup(NamingContext.java:842) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:194) at foo.DBTest1.init(DBTest1.java:20) at org.apache.jsp.DbTest1$jsp._jspService(DbTest1$jsp.java:60) Hi, I had this problem for ages, and resolved it by retrofitting the DataSource factory ( connection pool) from tc4.1. The basic problem is that Tyrex is broken; it happened to work for some people, but not for me and many others :-( At this point, Craig will probably come in and say to move to tc 4.1, and I'd say, 'fine, as long as you don't use SSL with a standalone tomcat, because the Coyote connector is broken in this respect.' What you can do is download 4.1.9, remove tyrex...jar from common/lib in 4.0.4, and drop in the commons-*.jar files from 4.1. Here is what I have in /usr/local/tomcat/common/lib activation.jar commons-collections.jar commons-dbcp.jar commons-pool.jar jdbc2_0-stdext.jar jndi.jar jta-spec1_0_1.jar mail.jar mm.mysql-2.0.14-bin.jar naming-common.jar naming-factory.jar naming-resources.jar servlet.jar xerces.jar HTH Martin PS: dont forget that the user parameter is username with DBCP -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: repost: tomcat's pooling
Felipe Schnack wrote: I asked this one time in this list but no reply... let's try again. When we use the pool configuration indicated in tomcat docs, we use the javax.sql.DataSource interface to get the java.sql.Connection instances. To have connection pooling we shouldn't use ConnectionPoolDataSource? The short answer is... No :-) A longer answer is that the Connection Pool still provides objects of type javax.sql.DataSource. This is good, because it means that our servlet code doesn't change if we switch between no pooling, and pooling of connections. HTH Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Poolmam vs. Tomcat's JNDI (DBCP, Pool)
neal wrote: Do you guys prefer Tomcat JNDI over PoolMan? It is looking like (from the multiple installs and the significant configuration details) that Poolman is a lot easier to setup and use that Tomcat's JNDI option. Anyone have an opinion? Thanks. Neal Last time I looked, Poolman was no longer being developed/supported, which rules it out as far as I'm concerned. When you refer to tomcat's JNDI, I suppose you mean the commons-DBCP connection pool supplied with tc 4.1? I retro-fitted DBCP to 4.0.4 and it works fine. HTH Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: help with apache tomcat webserver
Jonathan Zhang wrote: Everything is in default condition as provided by apache tomcat 4.0. People in foreign countries such as hk and china can not view it while people in US can. if it helps here's my ip addr: http://64.161.27.180:8080/index.html thanks for the help -jonathan I tried your link, and it returned me a 404 :-( Ping succeeds. I notice you said you're connected via DSL - are you sitting behind a DSL router that provides firewall facilities? Do you have a dynamic IP address (I guess not)? You *might* have problems if your firewall blocks certain ports from certain ip ranges. I am doing this from Italy. best of luck, Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Altering file extensions
Jim Bartram wrote: I'm using Tomcat 4.0 in a very simple way, hosting some straightforward .jsp files. Instead of the client seeing files served with the *.jsp extension, I'd like to be able to substitue anothe extension instead -- like *.html :-). Is there a way to do that in Tomcat ? If so, how do I go about it? This is what the servlet-mapping element does (I don't use JSPs, but it works fine for servlets). e.g. servlet servlet-namehello/servlet-name jsp-filehello.jsp/jsp-file ... /servlet servlet-mapping servlet-namehello/servlet-name url-patternhello.html/url-pattern /servlet-mapping So your user types hello.html, and gets served the output from hello.jsp. HTH, Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: BasicDataSourceFactory (dbcp)
Marc Logemann wrote: Hi, i just read http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html and saw that dbcp uses username as a property for their DataSource Implementation. I allways thought that the specs say that one should use user. Shouldnt this be consistent across all DataSource implementations? --- greetings from Marc Logemann Homebase @ www.logemann.info I have posted several times regarding this! In answer to your question, it ought to be, but because there is no standard DTD for servlet containers, or EJB containers, everybody can do his own thing! :-( I still think that there ought to be an DTD for server.xml, and maybe a way to map 'tomcat standard' parameter names to individual DataSource implementations. IMO, such a DTD (if documented!) would cut out a large proportion of the posts on this list! Just my Euro 0,02 Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: BasicDataSourceFactory (dbcp)
Marc Logemann wrote: Hi, I have posted several times regarding this! In answer to your question, sorry to bother you :) I wasn't complaining - it was merely an observation; I 'discovered' this a month back, and have posted several replies to people in difficulty. it ought to be, but because there is no standard DTD for servlet containers, or EJB containers, everybody can do his own thing! :-( i dont know if a DTD would help out, i mean we cant define bean properties for a custom datasource in advance in an DTD or? I still think that there ought to be an DTD for server.xml, and maybe a way to map 'tomcat standard' parameter names to individual DataSource implementations. IMO, such a DTD (if documented!) would cut out a large proportion of the posts on this list! THe point is, SUN defined at least some property names in http://java.sun.com/products/jdbc/jdbc20.stdext.pdf Paragraph: 5.3.1 it would be nice if at least the common ones would be uniform. Having read the doc (thanks for the link), I think you ought to post a bug report to the DBCP project for an incorrect property name... come to think of it, I might try to do that myself! But, if there is a 'standard' set of properties for a DataSource, why can't they be expressed in a formal way - i.e. currently we write: Resource name=jdbc/RadiationDB auth=Container type=javax.sql.DataSource / ResourceParams name=jdbc/RadiationDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter ... which means that an XML parser can only check that it is well-formed. Instead, it would be nice to be able to write: Resource name=jdbc/RadiationDB auth=Container type=javax.sql.DataSource / DataSourceParams name=jdbc/RadiationDB factory-class org.apache.commons.dbcp.BasicDataSourceFactory /factory-class ... with parameter reserved for vendor-specific extensions. This would allow a validating parser to barf at most errors, instead of us all having to rely on examining the log files and interpreting stack traces! Getting off soap-box, now! cheers, Martin. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Mac OSX
Matt Preston wrote: That's not the way to do it! :-) All that was neccessary for me was to set two environment variables: JAVA_HOME = /usr CATALINA_HOME = path to tomcat In my case, I have multiple tomcat versions installed, and I set a symbolic link to the one I want to use in /usr/local/tomcat. Hence, I use CATALINA_HOME = /usr/local/tomcat The only stuff I have in the standard extensions is some security encryption stuff - eq JSEE. Hope this helps, Martin Thanks, I have the two environment variables set as CATALINA_HOME=/knowledgeview/jakarta-tomcat-4.0.4 JAVA_HOME=/usr but the classes are still not being loaded unless I put all the jars into the standard extensions directory. Could this be a problem with the privileges of the user that I am logged in as? Although I am using an administrator account... Any ideas? Thanks, Matt The permissions are OK? Tomcat (ie the user that runs it), must have read permission on all files, and also execute permission on all directories under it - being an administrator doesn't automatically solve the problem! Otherwise, all I can suggest is that you make sure you are up-to-date with your OS X version (10.1.5) JDK (1.3.1). Hope this helps, Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Mac OS X, Tomcat 4.0.4, MySql configuration denies access
Jack Park wrote: Thank you! I've now got even more food for thought. You used JDBCRealm. Here is what the Tomcat how-to on that says: This document describes how to configure Tomcat to support container managed security, by connecting to an existing database of usernames, passwords, and user roles. You only need to care about this if you are using a web application that includes one or more security-constraint elements, and a login-config element defining how users are required to authenticate themselves. If you are not utilizing these features, you can safely skip this document. I should say that I am doing this in a verbose fashion in the hopes that other OS X users will be able to find it with google when/if they need it. My similar query at http://forums.osxfaq.com/viewforum.php?forum=15 has had 3 hits (one of which is mine) in the same time span as this post here; here there have been responses of great value to this inquiry, there have been none elsewhere. Now, do I need container managed security? Did you? Or was that an approach that happened to get your installation working in absence of other considerations? In a reply here by Steve Ahlstrom, he does not appear to use JDBCRealm, but does use a greatly expanded Context... entry in server.xml, and additional information (compared to what I use) in his application's web.xml. Security in my program has, all along, been handled by authentication routines built into my code (though I can imagine handing that work over to something else in the future). I configured container managed security simply because the application requires it. I used it as an example because my application code accesses the database via a connection pool and JNDI, so it's more complicated to explain. In another (later) post, you describe your Unix accounts; mine are somewhat different. In case it helps, I'll describe them... First, I'm an old-time Unix guy (SVR4, Solaris, Linux), but I don't know the ins-and-outs of BSD, nor NextStep, so I didn't know about sudo when I started hacking about. I enabled root in NetInfo, and made sure that my user (martin) was a member of a group that root was also in. Hence, I was able to su root. I created a login account for mysql, and installed mysql as per instructions. I created a mysql user 'tomcat' which can only perform selects on one database. Also, tomcat can only connect from 'localhost' or 'macx'. I created another account which can do anything on the same single database when connecting from 'localhost', and this is the account that the application code uses. To run tomcat, I cd to the base directory, su root, and type bin/startup.sh - this is because I use tomcat in standalone mode, and use ports 80/443. I suggest (if you haven't already done so) setting debug=9 everywhere(!), and then post the logs, with any relevant server.xml, web.xml and code snippets. Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Mac OSX
Matt Preston wrote: Hi, I have just installed Tomcat 4.0.4 on Mac OSX (10.1) and have had a hell of a time. Firstly I had the problem with not using gnutar (documented on this list), but that was relatively simple to work around. The big problem was with the classloaders. It proved very difficult for me to convince Tomcat that it's classes were actually present. When starting up the application I got an exception about javax.http.HttpSession not being found. I tried many ways to get the servlet.jar into the classpath (which it already was anyway) without success. In the end the only way that I could get Tomcat to start up was to copy all of the jars (common/lib server/lib bootstrap.jar) into /System/Framework/Java/Extensions Then everything works fine, except that the tomcat jars are now in the extensions directory, so I can't run another version of tomcat on this machine at the same time. Obviously this is not the best or even right way of getting tomcat to run. I felt very dirty doing this :) Has anyone else faced similar problems with OSX and got a solution? I am very new to OSX and this seems like pretty weird behaviour to me, I'm sure that I am doing something wrong, but I don't know what. That's not the way to do it! :-) All that was neccessary for me was to set two environment variables: JAVA_HOME = /usr CATALINA_HOME = path to tomcat In my case, I have multiple tomcat versions installed, and I set a symbolic link to the one I want to use in /usr/local/tomcat. Hence, I use CATALINA_HOME = /usr/local/tomcat The only stuff I have in the standard extensions is some security encryption stuff - eq JSEE. Hope this helps, Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Mac OS X, Tomcat 4.0.4, MySql configuration denies access
Jack Park wrote: I continue to get the sql exception using the above software and mm.mysql 2.0.8 drivers. MySql is 3.23.51 downloaded from entropy.ch I have granted permission to the program for both localhost (a guess) and localhost.localdomain (which I needed on wintel and linux). While roaming with google, someone (http://www.macosx.com/forums/showthread.php?s=threadid=7737highlight=mysq l+java) solved (I think) the same problem by making a new root user with host = % (I confess: I have no idea how to do that!). I tried making my program (the name I use to open a connection to mysql) a Mac User. Nothing changed. I see several candidate avenues of inquiry: tomcat 4.0.4 has problems with this configuration (I think very unlikely) mm.mysql 2.0.8 is the wrong driver for 3.23.51 3.23.51 (being a very recent release) has some problem my configuration of the database with permissions is not consistent with OS X needs (works fine on wintel and linux, however). Hi, I am successfully using mysql (3.23.46) Tomcat (4.1.4) with mm.mysql driver (2.0.14) on Mac OS X (10.1.5). My normal db connection is via JNDI/Datasource, but I also use JDBCRealm user authentication, which is a simpler configuration to show :-) I created a mysql user called 'tomcat' (no need to create a Unix account), with no password... mysql select * from user where user like 'tomcat'; +++--+-+-+-+-+-+---+-+---+--+---++-+++ | Host | User | Password | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | +++--+-+-+-+-+-+---+-+---+--+---++-+++ | localhost | tomcat | | Y | N | N | N | N | N | N | N | N| N | N | N | N | N | +++--+-+-+-+-+-+---+-+---+--+---++-+++ and then configured server.xml ... Realm className=org.apache.catalina.realm.JDBCRealm debug=0 driverName=org.gjt.mm.mysql.Driver connectionURL=jdbc:mysql://localhost/radiation?user=tomcat userTable=user userNameCol=user_id userCredCol=password userRoleTable=user_role roleNameCol=role_id / In fact, I'm lying :-) I (occasionally) had problems because mysql would refuse the connection with a message like user tomcat@macx has insufficient privileges (or something in that vein). To solve that, I simply added another line to the user table for tomcat, with macx as the hostname. I don't know why this happens - however, I use a Powerbook, both at home and at work, so I'm constantly changing my Location setting, with consequent change in IP address, and mysql may be getting confused. Although I'm using 4.1.4, this also worked on 4.0.4b3, so your Tomcat version is not an issue. I suspect that the problem can be solved by fiddling with mysql's privileges, which are (IMHO) somewhat arcane! Hope this helps, Martin. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: New to Tomcat/Mac OS 9
Aldo Bergamini wrote: Peter Werno is believed to have said: Hello Aldo, this is more guessing than knowing, but the Apple MRJ / JDK isn't Java 2. If tomcat 3.3.x uses some Java 2 commands then you'd need to upgrade to OS X (which runs any kind of Tomcat just fine) You should probably post this on the Developer-List, maybe someone there is able to tell you if there are Java 2 elements in 3.3.x Regards, Peter Thanks Peter, I'll ask the Developer-List. It seems that OS X is getting more and more unavoidable... Rgds Don't avoid OS X! Developing Java Apps on OS9 and before was terrible, to say the least! On Mac OS X it's much, much better! I recommend that you get GNU tar as the standard tar doesn't handle long paths, and I don't like the standard tcsh, so downloaded bash. BBEdit as the text editor, and you're away! And why use Tomcat 3, when Tomcat 4 is so good? I love OS X! Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Tomcat-4.1.6 and DBCP issue?
Douglas, Rory wrote: Hi there I had some problems using the DBCP connection pool with 4.1.6 and the MS SQL Server JDBC drivers. I couldn't get the pool to use the user parameter specified in server.xml, I ended up having to include the username and password as part of the JDBC URL. Oh, I've never used the built-in connection pooling before, so I can't speak for 4.1.3. What's happening with your 4.1.6 setup?? DBCP expects the user to be identified by a parameter called username, not user :-) Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Tomcat 4.0.4, jndi, jdbc and postgresql [long]
Les Hughes wrote: Ignore the remove // comment - I was looking at my oracle notes :-) I really have no idea why it's trying to load the hsql driver if there's no ref in your server.xml Post your server.xml and web.xml and we'll both have a look. I struggled for weeks (on and off) trying to figure out why Tyrex ALWAYS tries to load the hsql driver - in vain. Don't bother trying to get Tyrex to work - it just doesn't! (And neither does it pool connections) - you should try TC 4.1, which uses the jakarta-commons DBCP. DBCP works, and pools connections! Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: TC 4.1.3 ExptyStackException
Remy Maucherat wrote: Remy, I'm sure you're a busy guy, but I'd really appreciate an assist here; I moved to TC4.1 in order to have a working implementation of a JNDI DataSource, but in the process I have lost a working SSL implementation, which is *vital* for my application (this is medical data, and I need to demonstrate to the Authorities that the system is reasonably secure). If there's a problem with TC4.1 (I know it's alpha), would you suggest that I retro-grade to TC 4.0 ? I have an alternative (working!) connection-pooling setup that I could use, so it's not a total disaster for me. You can always downgrade. However, SSL works fine for me and others in more complex cases. Remy I *hope* it works for you - you wrote the thing! :-) However, since it doesn't work for me, and since I'm 99.9% certain that I have everything set-up and configured correctly, this constitutes a bug (although it could be external to Coyote/Tomcat). I am willing to persue this, and I got a copy of the sources via cvs, with a view to tracking it down, but I'd like some advice: 1) Should I join the developer list? (Say no, I get too much mail already!) 2) Should I post a bug report to Bugzilla, or do you do that? 3) Any hints as to where I should start my search? To re-iterate the problem: I use Coyote to configure a SSL connector, which *apparently* correctly initialises itself (I checked that something was happening by removing certain parameters, and it then barfed). However, when I access a protected page, the re-direct to my login page (which uses ssl) fails with a java.net.MalformedURLException, which indicates that there is no stream protocol handler registered for 'https'. Many thanks, Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: TC 4.1.3 ExptyStackException
Remy Maucherat wrote: It mentions an sslImplementation as being null, but I don't find any mention of such an attribute in the docs. Is this the problem? And if so, what do I need to put? BTW, I didn't really want to be on the bleeding edge of development - but I do need a JNDI DataSource that works, so here I am! You need JSSE for that to work (and put the JARs in common/lib, or use JDK 1.4). There is a bug in that release recognizing the keystoreType attribute, though (bugzilla 9676). This got fixed in release 4.1.4. Remy Well, I already had JSSE installed as a standard extension, but I copied it to common/lib anyway; there was no difference, I'm afraid :-( I should point out that I have this working (not with Coyote) in Tomcat 4.0.4, if that helps. Where can I get 4.1.4? I hunted around, but I can't find it on the jakarta site. Is there a binary? Best regards, and thanks for the help, Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: TC 4.1.3 ExptyStackException
Reynir Hübner wrote: You can get 4.1.5 though, 4.1.5 has issues regarding jasper2 (tag-pooling), so I would download 4.1.5 and use jasper2 from 4.1.3. on the other hand I dont know of any other problems with tc.4.1.5 (there might be as it's only in a test-release). http://jakarta.apache.org/builds/jakarta-tomcat-4.0/test/v4.1.5/ hope it helps, [EMAIL PROTECTED] I don't use JSPs (hate them!) so Jasper is not an issue... however, having downloaded 4.1.5 - thanks for the link - I still have the same problem. That is, Tomcat fails to initialize the Coyote connector for https. My logs give me the same errors as previously posted - does anyone have a working Coyote https connector - maybe there are undocumented parameters I don't know about? Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: TC 4.1.3 ExptyStackException
Remy Maucherat wrote: Martin Jacobson wrote: My logs give me the same errors as previously posted - does anyone have a working Coyote https connector - maybe there are undocumented parameters I don't know about? With JDK 1.3, this works for me: - create a key with the default password (changeit) with keytool (see SSL Howto) - uncomment the SSL connector in server.xml - put the 3 SSL JARs in common/lib - start Tomcat, and use the browser with SSL Remy As I said before, I already had this working in TC4.0, so I have a keystore with a valid cert in it - naturally, I changed the password from changeit! I HAVE copied the 3 jars into common/lib (although they were already installed as standard extensions, so they should have been available already), I have uncommented the SSL connector in server.xml, and I have restarted Tomcat !!! Oh, and I am using JDK 1.3.1. As far as I can tell, the only differences are (i) I changed the keystore password (as you MUST), and (ii) this is all running on Mac OS X 10.1.5, which I don't suppose you use (although you ought!) Any other ideas? Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: TC 4.1.3 ExptyStackException
Remy Maucherat wrote: Martin Jacobson wrote: My logs give me the same errors as previously posted - does anyone have a working Coyote https connector - maybe there are undocumented parameters I don't know about? With JDK 1.3, this works for me: - create a key with the default password (changeit) with keytool (see SSL Howto) - uncomment the SSL connector in server.xml - put the 3 SSL JARs in common/lib - start Tomcat, and use the browser with SSL Remy Another thought - I have the connectors configured to bind to ports 80/443, instead of 8080/8443 - this is perfectly normal, no? Oh, and this is standalone Tomcat, of course! Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Tomcat 4.0.4 MyApp as default context - ClassNotFoundException: org.hsql.jdbcDriver
Jakarta Tomcat Newsgroup (@Basebeans.com) wrote: Subject: Tomcat 4.0.4 MyApp as default context - ClassNotFoundException: org.hsql.jdbcDriver From: Matt Raible [EMAIL PROTECTED] === I have an entry for my web-application in server.xml so I can use a JDBCRealm and a JNDI Datasource. When I change my context's path from Context path=/myAppName docBase=myAppName ... / to: Context path= docBase=myAppName .../ I get the following exception?! And I never even refer to this JDBC Driver. I did some browsing on the mailing lists, and this appears to be a well-known error, but I couldn't find the solution. TyrexDataSourceFactory: Cannot create DataSource, Exception java.lang.ClassNotFoundException: org.hsql.jdbcDriver at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader .java:1127) at org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader .java:992) at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:115) at org.apache.naming.factory.TyrexDataSourceFactory.getObjectInstance(TyrexData SourceFactor .java:210) Thanks, I had this problem, and couldn't solve it using Tomcat 4.0 at all :-( It seems that Tyrex is broken (or, at least, cannot be successfully configured). Reading elsewhere, it seems that Tyrex doesn't provide any connection pooling, either, so it's a bit of a Waste of Space (IMHO). I 'solved' the problem by moving to Tomcat 4.1, which uses the Jakarta-commons dbcp. This works! This is the relevant part of my server.xml file: Resource name=jdbc/RadiationDB auth=Container type=javax.sql.DataSource / ResourceParams name=jdbc/RadiationDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value100/value /parameter parameter namemaxIdle/name value3/value /parameter parameter namemaxWait/name value100/value /parameter parameter nameusername/name valueme/value /parameter parameter namepassword/name valuemypassword/value /parameter parameter namedriverClassName/name valueorg.gjt.mm.mysql.Driver/value /parameter parameter nameurl/name valuejdbc:mysql://localhost/radiation/value /parameter /ResourceParams NOTE that the user is identified by username, and not user - this had me stuck for a while! Hope this helps, Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
TC 4.1.3 ExptyStackException
Since moving to TC4.1.3, I get this: 2002-06-24 14:48:22 HttpProcessor[80][4] process.invoke java.util.EmptyStackException at java.util.Stack.peek(Stack.java:82) at java.util.Stack.pop(Stack.java:64) at org.apache.tomcat.util.log.SystemLogHandler.stopCapture(SystemLogHandler.java:152) at org.apache.catalina.connector.RequestBase.recycle(RequestBase.java:562) at org.apache.catalina.connector.HttpRequestBase.recycle(HttpRequestBase.java:417) at org.apache.catalina.connector.http.HttpRequestImpl.recycle(HttpRequestImpl.java:195) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1101) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1151) at java.lang.Thread.run(Thread.java:496) 2002-06-24 14:48:55 HttpProcessor[443][4] process.invoke java.util.EmptyStackException at java.util.Stack.peek(Stack.java:82) at java.util.Stack.pop(Stack.java:64) at org.apache.tomcat.util.log.SystemLogHandler.stopCapture(SystemLogHandler.java:152) at org.apache.catalina.connector.RequestBase.recycle(RequestBase.java:562) at org.apache.catalina.connector.HttpRequestBase.recycle(HttpRequestBase.java:417) at org.apache.catalina.connector.http.HttpRequestImpl.recycle(HttpRequestImpl.java:195) at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1101) at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1151) at java.lang.Thread.run(Thread.java:496) I haven't been able to track down exactly what provokes it - it seems to happen at random :-( but sure as eggs is eggs, it'll happen sooner or later. It doesn't look like a user code error, but who knows! Anyone got any ideas of where I should look? Thanks, Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: TC 4.1.3 ExptyStackException
Remy Maucherat wrote: The old HTTP/1.1 connector is unsupported (and apparently, a bug was introduced in there). Try using Coyote HTTP/1.1 instead. You can look at the default configuration file to see how to configure it. Remy Thanks for the quick response! Have tried that, but I now have a new problem! Coyote does not appear to initialize the SSL connection properly - or I've got something wrong: here's what I find in the logs: [INFO] Http11Protocol - -Attribute port: 80 [INFO] Http11Protocol - -Attribute maxThreads: 75 [INFO] Http11Protocol - -Attribute backlog: 10 [INFO] Http11Protocol - -Attribute tcpNoDelay: true [INFO] Http11Protocol - -Attribute soTimeout: 2 [INFO] Http11Protocol - -Attribute timeout: 2 [INFO] Http11Protocol - -Attribute secure: false [INFO] Http11Protocol - -Initializing Coyote HTTP/1.1 on port 80 [INFO] Http11Protocol - -Attribute port: 443 [INFO] Http11Protocol - -Attribute maxThreads: 75 [INFO] Http11Protocol - -Attribute backlog: 10 [INFO] Http11Protocol - -Attribute tcpNoDelay: true [INFO] Http11Protocol - -Attribute soTimeout: 6 [INFO] Http11Protocol - -Attribute timeout: 6 [INFO] Http11Protocol - -Attribute secure: true [INFO] Http11Protocol - -Attribute algorithm: SunX509 [INFO] Http11Protocol - -Attribute keystore: /Users/martin/.keystore [INFO] Http11Protocol - -Attribute protocol: TLS [INFO] Http11Protocol - -Attribute sslImplementation: null [INFO] Http11Protocol - -Initializing Coyote HTTP/1.1 on port 443 2002-06-24 16:20:35 Authenticator[/drs]: Subject to constraint SecurityConstraint[Login] 2002-06-24 16:20:35 Authenticator[/drs]: Calling checkUserData() 2002-06-24 16:20:35 Authenticator[/drs]: Cannot create new URL java.net.MalformedURLException: unknown protocol: https at java.net.URL.init(URL.java:307) at java.net.URL.init(URL.java:224) at org.apache.catalina.authenticator.AuthenticatorBase.checkUserData(AuthenticatorBase.java:730) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:490) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:644) at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:644) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:483) and here's my server.xml Connector className=org.apache.coyote.tomcat4.CoyoteConnector port=80 minProcessors=5 maxProcessors=75 enableLookups=true redirectPort=443 acceptCount=10 debug=9 connectionTimeout=2 useURIValidationHack=false / Connector className=org.apache.coyote.tomcat4.CoyoteConnector port=443 minProcessors=5 maxProcessors=75 enableLookups=true acceptCount=10 debug=9 scheme=https secure=true useURIValidationHack=false Factory className=org.apache.coyote.tomcat4.CoyoteServerSocketFactory clientAuth=false keystoreFile=/Users/martin/.keystore keystorePass=mypassword protocol=TLS algorithm=SunX509 keystoreType=JKS / /Connector It mentions an sslImplementation as being null, but I don't find any mention of such an attribute in the docs. Is this the problem? And if so, what do I need to put? BTW, I didn't really want to be on the bleeding edge of development - but I do need a JNDI DataSource that works, so here I am! Thanks, Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
JNDI DataSource probs
[EMAIL PROTECTED] wrote: Hi, did anyone of you get any furter? thanks anthony I've posted a solution see Generic DataSource Resource Factory Available. JDBC Data Source and Les Hughes for your tutorials. I still could not succeed. Did anyone try to figure out why we do not get a DB-Connection? I do not find a point to start form with debugging. Rainer 'fraid not :- I have installed Tomcat 4.1.3, and I currently get a different Exception thrown, which might be construed as progress... When I've checked that I don't have any typos or other 'obvious' mistakes, I'll post details. Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: front controller pattern and security
John Gregg wrote: Hi all. I've been thinking about how the j2ee front controller pattern (used by Struts et al.) does/does not take advantage of url-based authorization constraints in web.xml. I want to avoid having to check roles in my own code as much as possible. At first I thought I could declare a URL like /somewebapp/somerole/* to require the somerole role before being allowed access to my controller servlet. Another URL would be /somewebapp/someotherrole/* but would map to the same servlet. That servlet would then pick off the action at the end of the URL and execute it. However, while I can restrict access to the servlet, or whatever other physical resource I'm trying to protect, what I really want to protect is the action that's executed. Am I just stuck with enumerating all possible actions in by web.xml (/somewebapp/somerole/someaction, /somewebapp/somerole/someotheraction, etc.)? Should I instead make a filter that enforces this for me? I'm facing the same problem with Apache SOAP's rpcrouter. Surely, the way you describe, using servlet-mapping auth-constraint does exactly what you want? In other words, you have one (controller) servlet declared, and you use servlet-mapping to declare all urls that invoke that servlet. In auth-contstraint you declare the mapping between urls and user roles. So, when a user invokes /app/manager/ac_details, the auth-constraint would trigger an authorisation check to make sure the user was in the indicated role. Then (if he's allowed), because the servlet-mapping maps this url to the controller servlet, the controller servlet is invoked, and, as you say, you can then determine what the action was (ac_details) by examining the url. This method does not restrict access to the controller servlet directly, but does protect the functions to be performed. Or have I misunderstood? Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Connection pooling doesn't work for me ... Help !!
Jacob Kjome wrote: The definitive solution has been provided by Leslie Hughes [EMAIL PROTECTED] here: snip So, please, do yourselves a favor and ignore the docs for a bit on this one. Copy the configuration line for line that Leslie has provided. Then, of course, change the values to match your setup. I *guarantee* this works and it is the standard way it is supposed to be done. Maybe this DataSource thread can finally be put to rest? I'd *love* this thread to go away and die, but until JNDI DataSource can be made to work for all of us, it's gonna run run! As my previous post indicated, I am using Les Hughes proposed solution, and I *still* get a Tyrex exception, because it's trying to instantiate the mythical hsql driver. Has anybody got any suggestions other than it works for me; I don't mind delving into the code, but it'd be nice to know where to start looking! Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Connection pooling doesn't work for me ... Help !!
anthony.dodd wrote: Hi I've posted a solution see Generic DataSource Resource Factory Available. JDBC Data Source on the tomcat user maillist. Tony Yes, but... Like many others on this list, I too have been unable to get the std JNDI DataSource thingy working; as an interim measure, I implemented a workaround (which does at least work!), but I refuse to be defeated! My understanding is that the standard naming factory wotsit is Tyrex - if I implement Anthony Dodd's offering, do I chuck out Tyrex? My latest attempt is based on the suggestions offered by Les Hughes, which uses the Jakarta Commons DBCP, collections, and pool libraries. However, when I run my application, I get the (by now, all too familiar) following exception thrown: 2002-06-13 13:37:15 static: Error! javax.naming.NamingException: Exception creating DataSource: org.hsql.jdbcDriver at org.apache.naming.factory.TyrexDataSourceFactory.getObjectInstance(TyrexDataSourceFactory.java:227) at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:165) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) at org.apache.naming.NamingContext.lookup(NamingContext.java:835) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:194) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183) at javax.naming.InitialContext.lookup(InitialContext.java:350) at com.terma.martin.drs.StaticPage.handleRequest(Unknown Source) at org.apache.velocity.servlet.VelocityServlet.doRequest(VelocityServlet.java:331) at org.apache.velocity.servlet.VelocityServlet.doGet(VelocityServlet.java:292) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) It seems as though Tyrex is trying to use org.hsql.jdbcDriver, which I don't want - I'm using MySQL - or am I not interpreting the stack trace properly? Here is the relevant part of server.xml: Resource name=jdbc/RadiationDB auth=Container type=javax.sql.DataSource/ Resource-params name=jdbc/RadiationDB parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/namevalue100/value /parameter parameter namemaxIdle/namevalue3/value /parameter parameter namemaxWait/namevalue100/value /parameter parameter nameuser/name valueme/value /parameter parameter namepassword/name valuesecret!/value /parameter parameter namedriverClassName/name valueorg.gjt.mm.mysql.Driver/value /parameter parameter nameurl/name valuejdbc:mysql://localhost/radiation/value /parameter /Resource-params My configuration is: Tomcat 4.0.4b1 mm.MySQL 2.0.12 latest DBCP from nightly build mySQL 3.23.46 running on Mac OS X (10.1.5) JDK 1.3.1 All suggestions gratefully received! Thanks, Martin PS Sorry about the length of the post :-( -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Please help me improve my question skills (number of tomcat a pps)
Knutsen Jeffrey S wrote: YES! You've hit it! I AM asking the question about how fast the car will go. At this time, I DON'T care about the type of car or engine! My question is being analyzed far too deeply by the diligent developers on this mail list. snip Well, although I agree with other posters that answering your question will not provide you with any useful information, here goes... I am developing a REAL application using Tomcat. Development is on a G3 PowerBook running Mac OS X 10.1.5, Tomcat 4.0.3 standalone, and MySQL something or other (recent, anyway!) with mm.MySQL JDBC driver. Performance is very good. Production will be on some kind of Sun box which also runs Samba (masquerades as an NT server) for local workgroup. Production DB will be Oracle 8i, which will probably slow down the app somewhat, but still confident the car will go fast enough! Now, apart from the information that the Mac is an excellent platform for Java apps, I don't know how this helps you, but hey... :-) Martin -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: fyi: tomcat 4.0.1 examples on MacOS X (error 404)
[EMAIL PROTECTED] wrote: I recently downloaded http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v4.0.1/bin/jakar ta-tomcat-4.0.1.tar.gz but the servlet examples did not work (error 404). Looking at the files in the logs/ folder showed there was a problem with loading SetCharacterEncodingFilter class. I then came across a file called SetCharacterEncodingFilter.clas in webapps/examples/WEB-INF/classes/filters/ folder. When I renamed this file to SetCharacterEncodingFilter.class the examples were accessible! It's probably something to do with my OS X being on a Mac compatible partition and so filenames longer than 32 are truncated (?) IIRR, the problem is either in Stuffit, or std Mac OS X tar - I downloaded GNU tar, and have had no problems since. Hope this helps Martin. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Tyrex/Warp JDBC NamingContext problem
Jakarta Tomcat Newsgroup (@Basebeans.com) wrote: Subject: Tyrex/Warp JDBC NamingContext problem From: Hermod Opstvedt [EMAIL PROTECTED] === Hi all I have looked all over the place, and come across several people that are experiencing the same as me. When I access my .jsp's directly to TC, a lookup of the JDBC that I configured in server.xml works fine. When starting up Apache and hence warp, it stops working. I have stepped through it, and confirmed that the JDBC entry is in the naming context, but the cast (through Tyrex) doesn't seem to work so it returns null. Hasn't anybody come across a solution for this ? My situation is slightly different, in that I'm using servlets+Velocity, and a standalone Tomcat 4.0.4b1, but I think we have the same problem: I can connect successfully to MySQL using mm.mysql JDBC driver, but configuring a Datasource using JNDI following the HOW-TO always results in a null pointer being returned from the lookup(jdbc/...). I suspect that Tyrex is broken; when I set the debug level to 99, I get an entry in catalina.out to the effect that Tyrex could not find the hypersonic driver - not surprisingly, since I don't have it or want it. Looking at the Tyrex source reveals that the hypersonic thing is a hard-coded default, which I suppose gets replaced by the name of the driver you configure in the server.xml parameters. My question is this: is ANYBODY successfully connecting to any database other than this hypersonic thingy? If so, what JDBC driver are you using? Did you have to 'tweak' the configuration given in the HOW-TO? Help please! Martin -- To unsubscribe: mailto:[EMAIL PROTECTED] For additional commands: mailto:[EMAIL PROTECTED] Troubles with the list: mailto:[EMAIL PROTECTED]