Read and write inside WEB-INF
Hi, I have seen a few apps do this now and I would like to do it, to have a configure page that read and writes a properties file somewhere inside the WEB-INF directory. That said, I have been researching and cant find out where, what is the correct way to find the location of your WEB-INF directory (or your apps directory for that matter). Best Regards, Jacob - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Read and write inside WEB-INF
Jacob Rhoden ha scritto: Hi, I have seen a few apps do this now and I would like to do it, to have a configure page that read and writes a properties file somewhere inside the WEB-INF directory. That said, I have been researching and cant find out where, what is the correct way to find the location of your WEB-INF directory (or your apps directory for that matter). Best Regards, Jacob try with String x = this.getServletContext().getRealPath(WEB-INF); Edoardo -- Jabber: [EMAIL PROTECTED] tel: 075 9142766 - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Read and write inside WEB-INF
Much Appreciated! Thanks. Edoardo Panfili wrote: Jacob Rhoden ha scritto: what is the correct way to find the location of your WEB-INF directory (or your apps directory for that matter). try with String x = this.getServletContext().getRealPath(WEB-INF); - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
how to decide the correct value for connection_pool_size
Hi I am running Tomcat 4.12, IIS 6.0 and newest JK. How do I determine the correct values for connection_pool_size I sometimes get this error: [Sat Jul 14 10:19:19 2007] [1388:5176] [error] jk_isapi_plugin.c (1507): Failed to obtain an endpoint to service request - your connection_pool_size is probably less than the threads in your web server! My current values are: worker.worker1.connection_pool_size=30 worker.worker1.connection_pool_minsize=16 worker.worker1.connection_pool_timeout=600 shouldn't this be enough. Does anyone have any experience in this? Thanks, Rasmus
Re: PORTLETS On Tomcat...
Ok I still have no idea how to use portlets... but found an easy way to get going on TC Download OpenPortal Deployer https://portlet-container.dev.java.net/ Install the OpenPortal project using these instructions on TC https://portlet-container.dev.java.net/public/TomcatInstallation.html In Netbeans 5.5.1 or better Tools-Update-Center (Netbeans Beta) Do not install the Sun System Portal server. thats the mistake I made Just install Generic Portlets... Make a default Portlet project. and compile it. Start Tomcat go to http://localhost:8080/portletdriver/dt Click on the Admin Tab Browse for your portlet War in DIST folder of project you made. Deploy it Create some more windows at bottom of page. switch to portlet tab You will see your portlets Hopefully that answers questions about developing in Netbeans for Tomcat portlets it definitely works. BUT if you make portlets on an application server... like Spring or Glassfish you going to have problems trying to moving back to a servlet container. Whether you should use portals?. thats 4 u 2 decide. ===Previous Message Done a little more research on portlets but still havnt got the things running on my dev environment If you wondering what a portlet is here are two very interesting flash video's http://portalpack.netbeans.org/files/documents/212/1236/plugindemo_deployment_management.htm https://portlet-container.dev.java.net/screencast/pc_sdk/PC_SDK.html It seems the portlet container can be installed on Tomcat... however the installation on Netbeans seems GlassFish orientated. https://portlet-container.dev.java.net/public/TomcatInstallation.html Now the thing about that is that one is a servlet container the other a application container so (and this is where I wish I had got the things running) I think its very easy for a Netbeans user to use EJB's without even realizing it and thats why I think we starting to see questions like... it gave me an EAR file, how do I use that on tomcat. Isnt the tooling in those video's amazing even if you dont like the concept of portlets awesome tools these developers are putting together. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Read and write inside WEB-INF
Hmmm does this work for packed WAR's or only Unpacked... ? Jacob Rhoden wrote: Much Appreciated! Thanks. Edoardo Panfili wrote: Jacob Rhoden ha scritto: what is the correct way to find the location of your WEB-INF directory (or your apps directory for that matter). try with String x = this.getServletContext().getRealPath(WEB-INF); - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: BASIC authentication in Tomcat 5.5.x vs. 5.0.x?
At 06:05 PM 7/13/2007, you wrote: Thomas Hicks [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have a web application which uses BASIC authentication. In Tomcat 5.0.28 (under Java 1.5 and Fedora Core 4) accessing the protected webapp causes the browser to popup a login box where username and password are entered. This works well, no matter whether passwords are plain or SHA digested and no matter whether I access the protected webapp using the HTTP port or the HTTPS port. It also works with a wide variety of browsers. Moving to Tomcat 5.5.x, however, causes the BASIC authentication not to work anymore. The login box pops up but no username/password combination ever allows access. The login box just clears the entries and one is stuck at the login box. Again, I have tried plain and SHA digested passwords in the tomcat-users.xml file with no luck either way. This behavior is the same across different web browsers. The web.xml file for the web application contains the following security configuration portion, which enables password access in 5.0.x but doesn't work in 5.5.x: !-- -- !-- Container-Security Configuration -- !-- -- security-constraint web-resource-collection web-resource-nameReports Browser/web-resource-name url-pattern/*/url-pattern /web-resource-collection auth-constraint role-name*/role-name /auth-constraint /security-constraint In TC 5.0, the special role-name '*' was incorrectly (according to the spec) being treated as 'any authenticated user'. In TC 5.5 this was fixed to mean 'any role that is declared in a security-role'. You can set the attribute allRolesMode=authOnly on the Realm / to have Tomcat revert to it's previous behavior. Thank-you very much! I didn't actually try reverting the behavior -- I took the other solution implied by your crucial information; I just declared a security role in my web.xml file, added that role to the tomcat-users.xml file and BASIC auth works again. Thanks again for your timely response. regards, -tom !-- Currently using only BASIC authentication. Use with HTTPS. -- login-config auth-methodBASIC/auth-method realm-nameProtected Area/realm-name /login-config I have searched online for answers and have reviewed the Servlet 2.4 specification (i.e. for Tomcat 5.5.x) but have found nothing. Surely, BASIC authentication is such a wellbasic thing that there must be some small change I need to make, between the Tomcat versions, to get this to work again. Any help is greatly appreciated. -tom - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Axis 2, POJO, Exceptions and Faults
Hi !! : I'd like to develop a web service in Axis 2 the easiest way possible. So, I'd like to develop a POJO, and then generate a POJO Web Service from it with the Axis 2 Service Archiver Eclipse plugin. I'd like my POJO Web Service throwed RemoteExceptions or AxisFaults and develop a RPCServiceClient catching that exceptions/faults, something like this : [web service] ... if(anErrorHappened) throw AxisFault/RemoteException; ... [web service] [RPCServiceClient] ... try { ... returned_object = call_the_pojo_web_service(parameters); ... } catch (AxisFault e) { // AxisFault or RemoteException print_an_error(e); } ... [RPCServiceClient] I've been trying to do something like that but i couldn't make it work . My test Web Service returns a String and the client receives the AxisFault/RemoteException message throwed from the Web Service as it was the returned value from the Web Service !!, so I'd been able to know in the client side if an error happened in the server side. The question is : is that scenario supported? If not... which is the best choice to do it easy and with AxisFaults/RemoteExceptions? where could i find more information about that (I've already read the Axis 2 docs)? Thanks to everybody!. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Read and write inside WEB-INF
This is quite tricky issue. I use the following method. Basically it locate the directory where you place your designated class definition! static String base; static { try { // use an object instance which is part of service! my.package.MyObject rm = new my.package.MyObject(); Class c = rm.getClass(); String name = my.package.MyObject.class; URL url = c.getClassLoader().getResource(name); String st1 = url.getPath(); int x = st1.indexOf(file:); // remvie jar:file: part; if (x=0) st1 = st1.substring(x+5); x = st1.indexOf(:); // remove leading / for Windows! if (x=0) st1 = st1.substring(1); st1 = st1.substring(0, st1.length()-name.length()-1); // remove /class name; if (st1.endsWith(!)) { // remove jar/war/aar/mar file paths; x = st1.lastIndexOf(/); if (x=0) st1 = st1.substring(0, x); } st1 = st1.replace(/, File.separator); // directory; base = st1+File.separator; System.out.println(Base: +base); } catch (Throwable t1) { t1.printStackTrace(); } } -- View this message in context: http://www.nabble.com/Read-and-write-inside-WEB-INF-tf4078368.html#a11597896 Sent from the Tomcat - User mailing list archive at Nabble.com. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Read and write inside WEB-INF
Only works for unpacked web applications. If you attempt getRealPath from inside a packed war file it will return null. --David hanasaki wrote: Hmmm does this work for packed WAR's or only Unpacked... ? Jacob Rhoden wrote: Much Appreciated! Thanks. Edoardo Panfili wrote: Jacob Rhoden ha scritto: what is the correct way to find the location of your WEB-INF directory (or your apps directory for that matter). try with String x = this.getServletContext().getRealPath(WEB-INF); - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat6 Manager App HOW-TO
I would appreciate some clarifications/advice on this How-To.. It appears that the instruction to add (paths corrected) Context path=/manager privileged=true docBase=/usr/local/tomcat/webapps/manager /Context is wrong (based on message from Charles Caldarale on 5/16/2007) So.. in reading the rest of the instructions I'm finding things are not quite working as documented. Searched this list and google and so far have not come up with any answers: Specifically.. 1) Is the instruction that you add a manager.xml to each $CATALINA_HOME/conf/[enginename]/[hostname] ..folder required? (I assume the path should be corrected since there is no longer any server directory structure.) .. at this point it does not seem to matter.. but I would like access to virtual hosts.. 2) So I can access the localhost manager at: http://localhost:8080/manager/html but can not access the host-manager at: http://localhost:8080/host-manager/html ..I get a 403 (I did try adding a host-manager role to the tomcat-user.xml , but no joy) Is there something that has not been documented as yet to configure this..??? 3) I can not access a virtual host Manager at http://www.domainhere.com:8080/manager/html Thank you for any hints or advice.. John.. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DataSources and Tomcat (continue thread: Re: How to use connection pool with tomcat 1.2.9)
RE(David Smith): though I'm guessing that this thread is over and nobody will read this follow-up. :( Change to: :) -- at least one follow-up reader. RE(Chris Shultz): | As I said, i did declare the tomcat dataSource in server.xml and | WEB-INF/web.xml. | |Don't do that. Since you're using Tomcat 5.5, you should declare your |DataSource in META-INF/context.xml, along with your Realm. Then, you |don't ever have to touch server.xml, which is nice. I also want to get the Tomcat DataSource machinery working. I'm using Tomcat 5.5.9. I've slavishly followed the mySQL example in http://tomcat.apache.org/tomcat-4.1-doc/jndi-datasource-examples-howto.html But I get: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' [I eventually want to follow the advice above, but don't know where to locate the descriptions of how to carry out the META-INF type of declaration. Right now, I want to understand why the example fails. ] I'm working on Windows (not necessarily by choice) and $CATALINA_HOME = C:\Tomcat. The following jars (among others) are present in $CATALINA_HOME/common/lib/ commons-collections-3.2.jar commons-dbcp-1.2.2.jar commons-pool-1.3.jar mysql-connector-java-3.1.14-bin.jar The database has been created and populated using the given commands (wrapped in a file DBTest.sql: GRANT ALL PRIVILEGES ON *.* TO [EMAIL PROTECTED] IDENTIFIED BY 'javadude' WITH GRANT OPTION; create database javatest; use javatest; create table testdata (id int not null auto_increment primary key, foo varchar(25), bar int); insert into testdata values(null, 'hello', 12345); - mysql select * from testdata; ++---+---+ | id | foo | bar | ++---+---+ | 1 | hello | 12345 | ++---+---+ 1 row in set (0.00 sec) [Connected to mysql using: mysql -u javauser -pjavadude ] I copied the Context (cut/paste) into server.xml --- I'll append that at the end of the message. Here's the web.xml: web-app xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; version=2.4 descriptionMySQL Test App/description resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app The jsp is in the file jsp/test_v4.jsp, with folder jsp at the same level as WEB-INF: html head titleDB Test/title /head body % foo.DBTest tst = new foo.DBTest(); tst.init(); % h2Results/h2 Foo %= tst.getFoo() %br/ Bar %= tst.getBar() % /body /html Here is catalina.out when Tomcat is started: exec ./catalina.sh start -Dcatalina.base= tomcat5.exe Using CATALINA_BASE: c:\Tomcat Using CATALINA_HOME: c:\Tomcat Using CATALINA_TMPDIR: c:\Tomcat\temp Using JRE_HOME: c:\Program Files\Java\jdk1.5.0 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { start | stop } Jul 14, 2007 9:13:22 PM org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on http-8080 Jul 14, 2007 9:13:22 PM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 781 ms Jul 14, 2007 9:13:22 PM org.apache.catalina.core.StandardService start INFO: Starting service Catalina Jul 14, 2007 9:13:22 PM org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/5.5.9 Jul 14, 2007 9:13:22 PM org.apache.catalina.core.StandardHost start INFO: XML validation disabled Jul 14, 2007 9:13:23 PM org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote HTTP/1.1 on http-8080 Jul 14, 2007 9:13:23 PM org.apache.jk.common.ChannelSocket init INFO: JK: ajp13 listening on /0.0.0.0:8009 Jul 14, 2007 9:13:23 PM org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=0/20 config=null Jul 14, 2007 9:13:23 PM org.apache.catalina.storeconfig.StoreLoader load INFO: Find registry server-registry.xml at classpath resource Jul 14, 2007 9:13:23 PM org.apache.catalina.startup.Catalina start INFO: Server startup in 1131 ms I point the browser at: http://localhost:8080/DBTest/jsp/test_v4.jsp The browser result is: Results Foo Not Connected Bar -1 The (reduced) stacktrace is: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' at
RE: Tomcat6 Manager App HOW-TO
From: John Moore [mailto:[EMAIL PROTECTED] Subject: Tomcat6 Manager App HOW-TO It appears that the instruction to add (paths corrected) Context path=/manager privileged=true docBase=/usr/local/tomcat/webapps/manager /Context is wrong (based on message from Charles Caldarale on 5/16/2007) The path attribute is only valid when the Context element is in server.xml, which is strongly discouraged. For other Context uses, the path is derived from the name of war file (or directory) or the name of the .xml file in conf/Catalina/[host]. So.. in reading the rest of the instructions I'm finding things are not quite working as documented. Please point out where in the Tomcat 6 doc you're finding discrepancies. 1) Is the instruction that you add a manager.xml to each $CATALINA_HOME/conf/[enginename]/[hostname] ..folder required? Not for Tomcat 6, since the directory structure has changed. In TC 5.5 and older, the various management applications were located outside of the normal Host appBase (in server/webapps), and therefore required [appname].xml files in conf/Catalina/[host]. For TC 6, the management applications are located under the configured appBase directory, so their Context elements can be found in their respective META-INF directories. If you configure multiple Host elements with differing appBase attributes, you have two choices. Either copy the management applications to each appBase, or keep them in one spot and create [appname].xml files with appropriate docBase attributes in each conf/[engine]/[host], similar to TC 5.5. but can not access the host-manager at: http://localhost:8080/host-manager/html ..I get a 403 (I did try adding a host-manager role to the tomcat-user.xml , but no joy) Look in the WEB-INF/web.xml file for host-manager; you'll see that the required role name is admin, not manager or host-manager. 3) I can not access a virtual host Manager at http://www.domainhere.com:8080/manager/html What appBase did you configure for the www.domainhere.com Host? If you don't have a manager webapp deployed there, you'll need to create a conf/Catalina/www.domainhere.com/manager.xml file that contains a Context element with a docBase attribute that points to the location of the manager webapp. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DataSources and Tomcat (continue thread: Re: How to use connectionpool with tomcat 1.2.9)
From: Ken Bowen [mailto:[EMAIL PROTECTED] Subject: DataSources and Tomcat (continue thread: Re: How to use connectionpool with tomcat 1.2.9) I also want to get the Tomcat DataSource machinery working. I'm using Tomcat 5.5.9. I've slavishly followed the mySQL example in http://tomcat.apache.org/tomcat-4.1-doc/jndi-datasource-examples-howto.h tml If you're using 5.5, why are you spending any time looking at the 4.1 documentation? Try using the correct doc for the level you have: http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.h tml - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat Application Read/Write properties (mk2)
I am going to re-word the question from the last thread to ask not how to do what I think I should do, but what I should do (: Where I work, ease of configuration and management is an important part of the software selection process. I have seen many tomcat applications provide an install.jsp or setup.jsp that allows you to configure various information including the name of the database. So here is my question. What is the correct/standard/java way of doing this? The database username/password are usually stored in web.xml, should the configuration page write the the web.xml file? I know what technically can be done, but what should be done? Thanks, Jacob Rhoden - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]