AW: jconsole security manager
Thanks for the reply, I got it running, but I don't understand it, maybe you can help me: Giving following permission to my tomcat (5.5.9) grant { permission javax.management.MBeanPermission *, *; permission java.lang.management.ManagementPermission monitor; permission java.util.PropertyPermission java.class.path, read; permission java.util.PropertyPermission java.library.path, read; permission java.net.SocketPermission intranet-lx1, resolve; }; and I can monitor my tomcat with jconsole. But this means I give the above permissions to all jars webapps on my tomcat. So guessed, giving these permissions only to $JAVA_HOME jars (lib, lib/ext) and tomcat jars (common,server,bin) should have the same result - but no I got a security excpetion: access: access denied (javax.management.MBeanPermission sun.management.RuntimeImpl#-[java.lang:type=Runtime] isInstanceOf) java.lang.Exception: Stack trace at java.lang.Thread.dumpStack(Thread.java:1158) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:253) at java.security.AccessController.checkPermission(AccessController.java:427) at java.lang.SecurityManager.checkPermission(SecurityManager.java:532) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.checkMBeanPermission(DefaultMBeanServerInterceptor.java:1707) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.isInstanceOf(DefaultMBeanServerInterceptor.java:1328) at com.sun.jmx.mbeanserver.JmxMBeanServer.isInstanceOf(JmxMBeanServer.java:1074) at com.sun.jmx.remote.security.MBeanServerAccessController.isInstanceOf(MBeanServerAccessController.java:439) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1414) at javax.management.remote.rmi.RMIConnectionImpl.access$100(RMIConnectionImpl.java:81) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1245) at java.security.AccessController.doPrivileged(Native Method) at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1348) And now I was surprised - all the packaeges in the stack trace (above doPrivileged) are contained in rt.jar, which do have AllPermission (and additional permissions described above - for the paranoid)!! Why can the above access denied exception occur?? This excpetion is also thrown, when no webapp is deployed - this means that only $JAVA_HOME tomcat core jars are found and loaded and all of these jars does have AllPermission?! I'm confused, Gernot -Ursprüngliche Nachricht- Von: Peter Rossbach [mailto:[EMAIL PROTECTED] Gesendet: Sonntag, 18. September 2005 10:55 An: Tomcat Users List Betreff: Re: jconsole security manager You can find detail information here: http://java.sun.com/j2se/1.5.0/docs/api/javax/management/MBeanPermission.html Very simple config example: http://mx4j.sourceforge.net/docs/ch03s10.html Peter Pfingstl Gernot schrieb: I like to monitor my tomcat 5.5 (running on jdk 1.5.0) with jconsole. If I run tomcat without security manager everything works well. If I run tomcat with security manager, monitoring the tomcat mbeans works well - but jconsoles memory view doensn't work! Sun's doc says: If your application runs a security manager, then additional permissions are required in the security permissions file. But I have not found which permissions are required? Has somebody have solved this? Which permissions are required? Thanks, Gernot - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
jconsole security manager
I like to monitor my tomcat 5.5 (running on jdk 1.5.0) with jconsole. If I run tomcat without security manager everything works well. If I run tomcat with security manager, monitoring the tomcat mbeans works well - but jconsoles memory view doensn't work! Sun's doc says: If your application runs a security manager, then additional permissions are required in the security permissions file. But I have not found which permissions are required? Has somebody have solved this? Which permissions are required? Thanks, Gernot - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
TC 5.5.9 - JMX - jconsole
Opening a remote connection with jconsole to a tomcat 5.5.9 (jdk 1.5) running with security manager works fine when disabling authentication (com.sun.management.jmxremote.authenticate=false). Using client auth no security manager works well, too. Using client auth security manager throws security exceptions: access: access denied (javax.management.MBeanPermission -#-[-] queryNames) java.lang.Exception: Stack trace at java.lang.Thread.dumpStack(Thread.java:1158) at java.security.AccessControlContext.checkPermission(AccessControlContext.java:253) at java.security.AccessController.checkPermission(AccessController.java:427) at java.lang.SecurityManager.checkPermission(SecurityManager.java:532) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.checkMBeanPermission(DefaultMBeanServerInterceptor.java:1707) at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.queryNames(DefaultMBeanServerInterceptor.java:500) at com.sun.jmx.mbeanserver.JmxMBeanServer.queryNames(JmxMBeanServer.java:600) at com.sun.jmx.remote.security.MBeanServerAccessController.queryNames(MBeanServerAccessController.java:466) at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1427) at javax.management.remote.rmi.RMIConnectionImpl.access$100(RMIConnectionImpl.java:81) at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1245) at java.security.AccessController.doPrivileged(Native Method) In my opinion all packages and classes in the stack trace are in rt.jar, so they do have AllPermission. Why do I get these excpetion(s) and which jars I have to give more permissions? Gernot - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
5.5.9 - ant deploy
How can I deploy a webapp with the tomcat deploy-ant-task to a context path e.g. /a/b? I do not have a problem to deploy a app to e.g. /a but a context path with subpaths does make problems. I tried various versions ('path=/a/b' or 'path=/a#b') in combination with varoius war names. I also have a /MEATA-INF/context.xml (without a path attribute). Gernot - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: 5.5.9 - ant deploy
Thanks, but it doesn't work: Using a#b.war and path=/a/b causes java.io.FileNotFoundException: webapps/a/b.war Using a#b.war and path=/a#b I get Deployed application at context path /a#b but app does not use context.xml (no jndi resources were found) Using without path, I get Must specify 'path' attribute # works when dropping war manually (cp) into webapps. Gernot -Ursprüngliche Nachricht- Von: Parsons Technical Services [mailto:[EMAIL PROTECTED] Gesendet: Montag, 23. Mai 2005 13:55 An: Tomcat Users List Betreff: Re: 5.5.9 - ant deploy Not having done this myself, try with no path attribute and a war file named a#b.war I think that was the recommendation from prior posts that worked. Doug - Original Message - From: Pfingstl Gernot [EMAIL PROTECTED] To: tomcat-user@jakarta.apache.org Sent: Monday, May 23, 2005 5:22 AM Subject: 5.5.9 - ant deploy How can I deploy a webapp with the tomcat deploy-ant-task to a context path e.g. /a/b? I do not have a problem to deploy a app to e.g. /a but a context path with subpaths does make problems. I tried various versions ('path=/a/b' or 'path=/a#b') in combination with varoius war names. I also have a /MEATA-INF/context.xml (without a path attribute). Gernot - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
5.5.9 unpackWARs=false
Are there any negative effects when choosing to set unpackWARs to false? Performance? Or what are the advantages to choose unpackWARS=true (I will not edit any expanded file)? Gernot - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
war deploy
How can I depoly a war to a path like '/x/y'? If I name the war x#y.war (and unpackWar=false) and put a /META-INF/context.xml into the war, I get a work/Catalina/localhost/x#y directory. Calling localhost/x/y in the browser causes a directory work/Catalina/localhost/x_y will be created. In the manager app there are listed 2 apps (x#y and x/y)!! Thx, Gernot - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: war deploy
Sorry - I forgot to say: I'm using tc 5.5.9 -Ursprüngliche Nachricht- Von: Pfingstl Gernot Gesendet: Freitag, 20. Mai 2005 22:52 An: Tomcat User (E-Mail) Betreff: war deploy How can I depoly a war to a path like '/x/y'? If I name the war x#y.war (and unpackWar=false) and put a /META-INF/context.xml into the war, I get a work/Catalina/localhost/x#y directory. Calling localhost/x/y in the browser causes a directory work/Catalina/localhost/x_y will be created. In the manager app there are listed 2 apps (x#y and x/y)!! Thx, Gernot - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
5.5.9 jasper ant compile options
I want to compile my jsps before depolying my war, so I'm using the standalone deployer build.xml. In the web.xml (for the jsp servlet) I can set some options eg. genStrAsCharArray or trimSpaces. How can I set these compile options in the ant task? Thx Gernot - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: Sessions and keep-alives
Wen launching webapp B (from A), you can pass jsessionid as url parameter (not as jsessionid) to B; with this jsessionid you can call A from B for keep-alive. Gernot -Ursprüngliche Nachricht- Von: Patrick Lacson [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 13. Mai 2005 06:57 An: Tomcat Users List Betreff: Re: Sessions and keep-alives I've considered iframes, but unfortunately not an option for us. From what I understand AJAX can make async calls to the HTTP server from the webapplication only, not on behalf of another. So if the popup application is webapp B, and the parent webapp A, how can I call the webapp A server from webapp B for the keep-alive? On 5/12/05, Tim Funk [EMAIL PROTECTED] wrote: The simplest kludge is an iframe that is hidden and uses a META refresh. Or look at using ajax. -Tim Patrick Lacson wrote: hi All! I'm involved in a project that integrates two disparate web applications: webapp A is using WebSphere and webapp B is using Tomcat. The integration involves Single Sign On, with webapp A being the primary webapp from which webapp B is launched. webapp B is launched as a popup-window. My question is: how can i ensure that while the user is working on the webapp B popup, the parent window webapp A, does not time-out? Thanks in advance! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Patrick - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: Sharing Data Sources
Did you try to define your datasource in GlobalNamingResources? And then you only have to define a resource-link in your contexts. -Ursprüngliche Nachricht- Von: Cook, Jared [mailto:[EMAIL PROTECTED] Gesendet: Donnerstag, 12. Mai 2005 21:23 An: 'tomcat-user@jakarta.apache.org' Betreff: Sharing Data Sources I have a lot of virtual hosts that need access to a lot of the same databases. Security isn't an issue because they are all trusted sites. I would like to be able to share the ResourceLinks across all the virtual hosts without having to have them all defined in every ROOT.xml. Is there a way to include a file in all my conf files? Is there a way to globally share out these datasources? Thanks. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: Directory Structure Rationale
You can install your apps whereever you want, you only have to put a context.xml file in conf/[enginename]/[hostname] and set the docBase Attribute to your app directory or war file. -Ursprüngliche Nachricht- Von: Bill Winspur [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 13. Mai 2005 11:44 An: Tomcat Users List Betreff: Directory Structure Rationale In the Tomcat distribution, why are the admin and manger webapps installed under /server/webapps, instead of in /webapps like all other webapps? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: strange autodeploy behaviour on 5.5.9
See http://issues.apache.org/bugzilla/show_bug.cgi?id=34840 -Ursprüngliche Nachricht- Von: news [mailto:[EMAIL PROTECTED] Auftrag von teknokrat Gesendet: Freitag, 13. Mai 2005 11:56 An: tomcat-user@jakarta.apache.org Betreff: strange autodeploy behaviour on 5.5.9 I have set up a new installation of tomcat 5.5.9 running on java 5(Windows XP). It starts up Ok and my webapp loads. I have the following context xml Context path=/myApp reloadable=true/Context The problem occurs when I copy over another version of my MyApp.war to the webapps directory. Tomcat only unpacks some of the files! There is a WEB-INF directory and a couple of jars in the lib directory and nothing else. Using the manager app to reload the app does not fix it. There are no exceptions being thrown. Furthermore, undeploying the app does not delete the directory, only the war file and it still remains in the application list in the manager. I have not changed any settings and this all works fine with tomcat 5.0.30. Anyone seen this before? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
security manager unpackWAR=false
Switching on security manger I can add permissions to my webapp calsses e.g. with grant codeBase file:${catalina.base}/webapps/examples/WEB-INF/classes/- If I choose to use 'unpackWAR=false', I don't have anything in my ${catalina.base}/webapps directory and my 'docBase' (my example.war) is somewhere else in my filesystem. Using codeBase as described above doesn't work. How do I grant permissions to my apps when using unpackWAR=false ('codeBase jar:file:/xxx/example.war!/-' or 'codeBase file:/xxx/example.war' doesn't work)? I'm using tomcat 5.5 Gernot - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
tomcat 5.5.9 removes mycontext.xml
I'm using tomcat 5.5.9, my server.xml contains Host name=localhost deployXML=false appBase=webapps unpackWARs=false autoDeploy=true deployOnStartup=true I tried it also with 'unpackWARs=true' - with the same result. {catalina.base}/conf/context.xml is the default one: Context !-- Default set of monitored resources -- WatchedResourceWEB-INF/web.xml/WatchedResource !-- Uncomment this to disable session persistence across Tomcat restarts - !-- Manager pathname= / -- /Context I have mycontext.xml in {catalina.base}/conf/Catalina/localhost: Context docBase=/somewhere/somewhat.war / Every time I update my somewhat.war (I tried 'jar uf ', 'cp', 'mv'), mycontext.xml (at {catalina.base}/conf/Catalina/localhost) will be deleted by tomcat! Why? Is this a bug? ...or feature? The tomcat docs (tomcat-docs/config/host.html#Automatic%20Application%20Deployment) says: An update to a WAR which has been expanded will trigger an undeploy (with a removal of the expanded webapp), followed by a deployment How should a deployment succeed if the mycontext.xml is removed? Gernot - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: DBCP ClassCastException
Tomcat 5.5 doesn't use commons-dbcp directly, the tomcat team took the source and put it in other packages. So you should use org.apache.tomcat.dbcp.dbcp.BasicDataSource instead of org.apache.commons.dbcp.BasicDataSource in your source - btw why do you cast to BasicDataSource, you can use javax.sql.DataSource? Gernot -Ursprüngliche Nachricht- Von: Dhiren Bhatia [mailto:[EMAIL PROTECTED] Gesendet: Montag, 09. Mai 2005 17:19 An: Tomcat Users List Betreff: Re: DBCP ClassCastException Hi Lutz, I changed the Resource tag definition to: Resource name=jdbc/myserver auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 driverClassName=com.mysql.jdbc.Driver/ I'm setting the username/password and jdbcurl using code. I still get the same ClassCastException. Is Tomcat instantiating the correct DataSourceFactory? I have the commons-dbcp-1.2.1.jar in my ${TOMCAT_HOME}/common/lib Thanks, Dhiren On 5/8/05, Lutz Zetzsche [EMAIL PROTECTED] wrote: Hi Dhiren, Am Montag, 9. Mai 2005 07:36 schrieb Dhiren Bhatia: Hi all, I'm getting a the following ClassCastException running Tomcat 5.5.9 with MySQL java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.BasicDataSource Here's the relevant code: *Java code:* org.apache.commons.dbcp.BasicDataSource datasource; datasource = (BasicDataSource)ctx.lookup(java:comp/env/jdbc/myserver); *web.xml* resource-ref descriptionDB Connection/description res-ref-namejdbc/myserver/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref *server.xml* ** ResourceParams name=jdbc/myserver parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter *...* This same code works in Tomcat 5.0.30. Has anything changed? Am I missing something? Yes. The syntax for the Resource tag in the server.xml has changed. The resource parameters are no longer defined in tags nested into the Resource tag, but in attributes of the tag. This is an example from the Tomcat 5.5 documentation: Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=javauser password=javadude driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/javatest?autoReconnect=true/ http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html Best wishes, Lutz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: DBCP ClassCastException
You can find org.apache.tomcat.dbcp.dbcp.BasicDataSource in common/lib/naming-factory-dbcp.jar. If you put commons-dbcp.jar, commons-pool.jar and commons-collections.jar in common/lib you (maybe) should be able to use org.apache.commons.dbcp.BasicDataSource. I do it in a similar way - I have my own ressource factory, which extends org.apache.commons.dbcp.BasicDataSourceFactory and it works in tomcat 5.5 with the above jars. Gernot -Ursprüngliche Nachricht- Von: Dhiren Bhatia [mailto:[EMAIL PROTECTED] Gesendet: Montag, 09. Mai 2005 18:47 An: Tomcat Users List Betreff: Re: DBCP ClassCastException I'm using BasicDataSource because javax.sql.DataSource does not have methods to set the driver class name, url, username/pwd etc. My app needs to support different databases and the driver is loaded based on which database is installed. If I use org.apache.tomcat.dbcp.dbcp.BasicDataSource, then my code is not portable to JBoss/Weblogic etc right? BTW, which jar is org.apache.tomcat.dbcp.dbcp.BasicDataSource in? Thanks for your response. Dhiren On 5/9/05, Pfingstl Gernot [EMAIL PROTECTED] wrote: Tomcat 5.5 doesn't use commons-dbcp directly, the tomcat team took the source and put it in other packages. So you should use org.apache.tomcat.dbcp.dbcp.BasicDataSource instead of org.apache.commons.dbcp.BasicDataSource in your source - btw why do you cast to BasicDataSource, you can use javax.sql.DataSource? Gernot -Ursprüngliche Nachricht- Von: Dhiren Bhatia [mailto:[EMAIL PROTECTED] Gesendet: Montag, 09. Mai 2005 17:19 An: Tomcat Users List Betreff: Re: DBCP ClassCastException Hi Lutz, I changed the Resource tag definition to: Resource name=jdbc/myserver auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 driverClassName=com.mysql.jdbc.Driver/ I'm setting the username/password and jdbcurl using code. I still get the same ClassCastException. Is Tomcat instantiating the correct DataSourceFactory? I have the commons-dbcp-1.2.1.jar in my ${TOMCAT_HOME}/common/lib Thanks, Dhiren On 5/8/05, Lutz Zetzsche [EMAIL PROTECTED] wrote: Hi Dhiren, Am Montag, 9. Mai 2005 07:36 schrieb Dhiren Bhatia: Hi all, I'm getting a the following ClassCastException running Tomcat 5.5.9 with MySQL java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.BasicDataSource Here's the relevant code: *Java code:* org.apache.commons.dbcp.BasicDataSource datasource; datasource = (BasicDataSource)ctx.lookup(java:comp/env/jdbc/myserver); *web.xml* resource-ref descriptionDB Connection/description res-ref-namejdbc/myserver/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref *server.xml* ** ResourceParams name=jdbc/myserver parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter *...* This same code works in Tomcat 5.0.30. Has anything changed? Am I missing something? Yes. The syntax for the Resource tag in the server.xml has changed. The resource parameters are no longer defined in tags nested into the Resource tag, but in attributes of the tag. This is an example from the Tomcat 5.5 documentation: Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=javauser password=javadude driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/javatest?autoReconnect=true/ http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html Best wishes, Lutz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: DBCP ClassCastException
My factory: import org.apache.commons.dbcp.BasicDataSource; import org.apache.commons.dbcp.BasicDataSourceFactory; public class MyDataSourceFactory extends BasicDataSourceFactory { public Object getObjectInstance( Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception { BasicDataSource basicDataSource = (BasicDataSource) super.getObjectInstance( obj, name, nameCtx, environment); if ((obj == null) || !(obj instanceof Reference)) { return (null); } Reference ref = (Reference) obj; if (!javax.sql.DataSource.equals(ref.getClassName())) { return (null); } // do some stuff here // ... return basicDataSource; } } and of course you have to specify this factory in your context.xml (or web.xml) Gernot -Ursprüngliche Nachricht- Von: Dhiren Bhatia [mailto:[EMAIL PROTECTED] Gesendet: Montag, 09. Mai 2005 19:27 An: Tomcat Users List Betreff: Re: DBCP ClassCastException It works if I use org.apache.tomcat.dbcp.dbcp.BasicDataSource. I've tried adding all the commons jars to common/lib and it still doesn't work with org.apache.commons.dbcp.BasicDataSource. How do you get it to cast with your own resource factory? The way I see it, it should be the same thing if you're extending from org.apache.commons.dbcp.BasicDataSource. Just FYI...Here's what I have in commons/lib: commons-collections-3.1.jar* log4j.jar* commons-dbcp-1.2.1.jar* mysql-connector-java-3.1.7-bin.jar* commons-pool-1.2.jar* naming-factory-dbcp.jar* jasper-compiler-jdt.jar* naming-factory.jar* jasper-compiler.jar* naming-resources.jar* jasper-runtime.jar* servlet-api.jar* jsp-api.jar* On 5/9/05, Pfingstl Gernot [EMAIL PROTECTED] wrote: You can find org.apache.tomcat.dbcp.dbcp.BasicDataSource in common/lib/naming-factory-dbcp.jar. If you put commons-dbcp.jar, commons-pool.jar and commons-collections.jarin common/lib you (maybe) should be able to use org.apache.commons.dbcp.BasicDataSource. I do it in a similar way - I have my own ressource factory, which extends org.apache.commons.dbcp.BasicDataSourceFactory and it works in tomcat 5.5with the above jars. Gernot -Ursprüngliche Nachricht- Von: Dhiren Bhatia [mailto:[EMAIL PROTECTED] Gesendet: Montag, 09. Mai 2005 18:47 An: Tomcat Users List Betreff: Re: DBCP ClassCastException I'm using BasicDataSource because javax.sql.DataSource does not have methods to set the driver class name, url, username/pwd etc. My app needs to support different databases and the driver is loaded based on which database is installed. If I use org.apache.tomcat.dbcp.dbcp.BasicDataSource, then my code is not portable to JBoss/Weblogic etc right? BTW, which jar is org.apache.tomcat.dbcp.dbcp.BasicDataSource in? Thanks for your response. Dhiren On 5/9/05, Pfingstl Gernot [EMAIL PROTECTED] wrote: Tomcat 5.5 doesn't use commons-dbcp directly, the tomcat team took the source and put it in other packages. So you should use org.apache.tomcat.dbcp.dbcp.BasicDataSource instead of org.apache.commons.dbcp.BasicDataSource in your source - btw why do you cast to BasicDataSource, you can use javax.sql.DataSource? Gernot -Ursprüngliche Nachricht- Von: Dhiren Bhatia [mailto:[EMAIL PROTECTED] Gesendet: Montag, 09. Mai 2005 17:19 An: Tomcat Users List Betreff: Re: DBCP ClassCastException Hi Lutz, I changed the Resource tag definition to: Resource name=jdbc/myserver auth=Container type= javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 driverClassName=com.mysql.jdbc.Driver/ I'm setting the username/password and jdbcurl using code. I still get the same ClassCastException. Is Tomcat instantiating the correct DataSourceFactory? I have the commons-dbcp-1.2.1.jar in my ${TOMCAT_HOME}/common/lib Thanks, Dhiren On 5/8/05, Lutz Zetzsche [EMAIL PROTECTED] wrote: Hi Dhiren, Am Montag, 9. Mai 2005 07:36 schrieb Dhiren Bhatia: Hi all, I'm getting a the following ClassCastException running Tomcat 5.5.9 with MySQL java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.BasicDataSource Here's the relevant code: *Java code:* org.apache.commons.dbcp.BasicDataSource datasource; datasource = (BasicDataSource)ctx.lookup(java:comp/env/jdbc/myserver); *web.xml* resource-ref descriptionDB Connection/description res-ref-namejdbc/myserver/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref
tomcat 5.5; context-path
Hi! I'm preparing to upgrade from tomcat 4.1 to 5.5. I've a lot of apps, which have a context path with subdirectories (e.g. /dir1/app1 ...) and it seems that tomcat 5.5 doesn't allow this. In the tomcat 5.5 docs (.../tomcat-docs/config/context.html) in the description of path there's the sentence: The value of this field must not be set except when statically defining a Context in server.xml, as it will be infered from the filenames used for either the .xml context file or the docBase. This seems to me to have only context path with has the same value as the name of the context.xml file. I want to use context.xml files and not put context information into server.xml. So isn't it possible to depoly apps in tomcat 5.5 with a context path that has subdirectories? Is this a feature (why?) - or is this a bug? If this is a feature - do you have any suggestions, how to configure my tomcat/apache that the directory structure (for the web users) will stay the same? Thanks, Gernot - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: tomcat 5.5; context-path
Thank you! It works with #! - but is this the 'official' way to do this in future releases? I have not found any docs about this. Gernot -Ursprüngliche Nachricht- Von: QM [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 06. Mai 2005 12:58 An: Tomcat Users List Betreff: Re: tomcat 5.5; context-path On Fri, May 06, 2005 at 10:07:32AM +0200, Pfingstl Gernot wrote: : This seems to me to have only context path with has the same value as the name : of the context.xml file. : I want to use context.xml files and not put context information into : server.xml. : So isn't it possible to depoly apps in tomcat 5.5 with a context path that has : subdirectories? Yes, it is possible. Search the archives for the specifics. You have to name your context's XML file a certain way: a special character represents the dir separators. So to map a context to /path1/path2/path3 your context XML would be named path1{char}path2{char}path3.xml I think {char} is a # but don't quote me on that... -QM -- software -- http://www.brandxdev.net/ tech news -- http://www.RoarNetworX.com/ code scan -- http://www.JxRef.org/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: DataSource Realm
This isn't what I want to do. In this way, you described, the web application can also obtain a DataSource and so a connection to the user database. We have a tomcat admin, which sets up the user database. And a lot of people which writes web application. The tomcat admin wants to protect the userdatabase in the way that no application has access to it. Gernot -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Gesendet: Montag, 19. Jänner 2004 15:00 An: [EMAIL PROTECTED] Betreff: RE: DataSource Realm This is probably not the only way to accomplish what you want, but a simple one to code for. 1)Define your DataSource resource in GlobalNamingResources of conf/server.xml. 2)Add a ResourceLink to the DataSource in the application context file in conf/Catalina/yourserver/yourapp.xml This way the only applications that are able to access the datasource are the ones with a ResourceLink entry. -Original Message- From: ext Pfingstl Gernot [mailto:[EMAIL PROTECTED] Sent: Sunday, January 18, 2004 3:32 PM To: [EMAIL PROTECTED] Subject: DataSource Realm If I want to use a DataSourceRealm (tomcat 4.1) like Realm className=org.apache.catalina.realm.DataSourceRealm dataSourceName=java:/comp/env/jdbc/authority ... / I had to configure a JNDI named JDBC DataSource java:/comp/env/jdbc/authority. So all web applications can also use this DataSource and can read the user-table - this is possibly a security hole. Is there a way to prohibit web applications to use this DataSource? Thanks, Gernot - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
DataSource Realm
If I want to use a DataSourceRealm (tomcat 4.1) like Realm className=org.apache.catalina.realm.DataSourceRealm dataSourceName=java:/comp/env/jdbc/authority ... / I had to configure a JNDI named JDBC DataSource java:/comp/env/jdbc/authority. So all web applications can also use this DataSource and can read the user-table - this is possibly a security hole. Is there a way to prohibit web applications to use this DataSource? Thanks, Gernot - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JNDI DataSources
I want to use one JDBC connection pool in my tomcat (4.1) instance for all contexts; therefore I configure the DataSource in GlobalNamingResources. In each context I put a ResourceLink so I can obtain the DataSource in my applications. But now I have the problem that I had to execute some SQL statements (e.g. a set role statement or some calls to stored procedures...) on the connection before it will passed to the application. This statements are different from context to context. My current solution is: I wrote a resource factory class, which is configured in every context. It does a JDNI lookup to the global connection pool, gets the DataSource and put it in a wrapper class, which exectures the SQL statetments before getConnection() deliveres the connection to the application. The SQL statements a read in before as resource parameters. This works fine except that global connection pool must be declared in the context with ResourceLink. So the application can also use this DataSource. I want to prohibit that the application can use the original DataSource! Is there a way to use a global resource only in a (context local) resource factory class and prohibit the application to use this global resource? Or do you have a better solution to solve this problem? Thanks, Gernot - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
GlobalNamingResources
If I define a resource in GlobalNamingResources (in server.xml) I can use this resource in my web-application only if I use ResourceLink in my context. So it seems to me it isn't possible to use a resource defined in GlobalNamingResources unless I permit the use with a ResourceLink in the context or the engine. Is this right?? Because I didn't find a sentence about this in the tomcat docs! Is this behaviour specified somewhere or is it subject to change? This behavoiur is important to me, becaue I will explicitely permit (or deny) the access to a global resource per context. Its a security problem. Thanks Gernot - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: GlobalNamingResources
Pfingstl Gernot wrote: If I define a resource in GlobalNamingResources (in server.xml) I can use this resource in my web-application only if I use ResourceLink in my context. So it seems to me it isn't possible to use a resource defined in GlobalNamingResources unless I permit the use with a ResourceLink in the context or the engine. Is this right?? Indeed. You can add the ResourceLink in a DefaultContext with 5.0, for convinience, if, for example, you want to allow it in a whole virtual host. I don't remember if I ported the feature and if it's also in 4.1.29. Is this behaviour specified somewhere or is it subject to change? No, it's not subject to a change. I think it's implied: nowhere it is written that global resources define stuff in the webapp naming contexts. In http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/globalresources.html there's the paragraph: GlobalNamingResources ... ... Environment name=maxExemptions value=10 type=java.lang.Integer override=false/ ... /GlobalNamingResources This is equivalent to the inclusion of the following element in the web application deployment descriptor (/WEB-INF/web.xml): env-entry env-entry-namemaxExemptions/param-name env-entry-value10/env-entry-value env-entry-typejava.lang.Integer/env-entry-type /env-entry The sentence above ...is equivalent... can be interpreted in the way, that there no ResourceLink is needed. This behavoiur is important to me, becaue I will explicitely permit (or deny) the access to a global resource per context. Its a security problem. That's the reason behind the ResourceLink. Thank you for your answer, Gernot - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: Tomcat, Eclipse, Debug, JPDA
Thank you, it works fine! But I also want to know why direct JPDA connection doesn't work or -better - who can tell me how it works!? Because I also want to debug a tomcat application on a remote machine, which theoretically should be no problem whit JPDA. Regards, Gernot -Ursprüngliche Nachricht- Von: Christian Traber [mailto:[EMAIL PROTECTED] Gesendet: Sonntag, 29. Juni 2003 15:01 An: Tomcat Users List Betreff: Re: Tomcat, Eclipse, Debug, JPDA Pfingstl Gernot wrote: I tried to debug my webapplication on my (local)tomcat with eclipse and JPDA. Both (JDK and Eclipse) seems to allow JPDA, but I always got an Failed to connect to remote VM. Connection refused error from eclipse. Try the tomcat plugin for eclipse: http://www.sysdeo.com/eclipse/tomcatPlugin.html Regards, Christian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
AW: Tomcat, Eclipse, Debug, JPDA
Now I found the missing link: the option -Xnoagent must be set and everything works!! My tomcat startcommand looks like: C:\Programme\tomcat\test\binstart Tomcat c:\programme\jdk1.3.1\bin\java -classic -Djava.compiler=NONE -Xbootclasspath:c:\programme\jdk1.3.1\lib\tools.jar;c:\programme\jdk1.3.1\jre\lib\rt.jar -Xdebug -Xrunjdwp:transport=dt_socket,address=8665,server=y,suspend=n -Xnoagent -Djava.endorsed.dirs=C:\programme\tomcat\jakarta-tomcat-4.1.18\bin;C:\programme\tomcat\jakarta-tomcat-4.1.18\common\endorsed -classpath c:\programme\jdk1.3.1\lib\tools.jar;C:\programme\tomcat\jakarta-tomcat-4.1.18\bin\bootstrap.jar -Dcatalina.base=C:\programme\tomcat\test -Dcatalina.home=C:\programme\tomcat\jakarta-tomcat-4.1.18 -Djava.io.tmpdir=C:\programme\tomcat\test\temp org.apache.catalina.startup.Bootstrap start Regards, Gernot -Ursprüngliche Nachricht- Von: Pfingstl Gernot Gesendet: Montag, 30. Juni 2003 16:15 An: Tomcat Users List Betreff: AW: Tomcat, Eclipse, Debug, JPDA Thank you, it works fine! But I also want to know why direct JPDA connection doesn't work or -better - who can tell me how it works!? Because I also want to debug a tomcat application on a remote machine, which theoretically should be no problem whit JPDA. Regards, Gernot -Ursprüngliche Nachricht- Von: Christian Traber [mailto:[EMAIL PROTECTED] Gesendet: Sonntag, 29. Juni 2003 15:01 An: Tomcat Users List Betreff: Re: Tomcat, Eclipse, Debug, JPDA Pfingstl Gernot wrote: I tried to debug my webapplication on my (local)tomcat with eclipse and JPDA. Both (JDK and Eclipse) seems to allow JPDA, but I always got an Failed to connect to remote VM. Connection refused error from eclipse. Try the tomcat plugin for eclipse: http://www.sysdeo.com/eclipse/tomcatPlugin.html Regards, Christian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat, Eclipse, Debug, JPDA
I tried to debug my webapplication on my (local)tomcat with eclipse and JPDA. Both (JDK and Eclipse) seems to allow JPDA, but I always got an Failed to connect to remote VM. Connection refused error from eclipse. My Environment: Win2000, JDK 1.3.1 (Sun), Tomcat 4.1.18, Eclipse 2.1 and 2.0 I did following steps: My startup.bat looks like: set JPDA_TRANSPORT=dt_socket set JPDA_ADDRESS=localhost:8665 set JAVA_OPTS=-classic -Djava.compiler=NONE -Xbootclasspath:c:\programme\jdk1.3.1\lib\tools.jar;c:\programme\jdk1.3.1\jre\lib\rt.jar set CATALINA_BASE=C:\programme\tomcat\test set CATALINA_HOME=C:\programme\tomcat\jakarta-tomcat-4.1.18 %CATALINA_HOME%\bin\catalina jpda run %1 %2 %3 %4 %5 %6 %7 %8 %9 Calling startup.sh produces following start command: C:\Programme\tomcat\test\binc:\programme\jdk1.3.1\bin\java -classic -Djava.compiler=NONE -Xbootclasspath:c:\programme\jdk1.3.1\lib\tools.jar;c:\programme\jdk1.3.1\jre\lib\rt.jar -Xdebug -Xrunjdwp:transport=dt_socket,address=localhost:8665,server=y,suspend=n -Djava.endorsed.dirs=C:\programme\tomcat\jakarta-tomcat-4.1.18\bin;C:\programme\tomcat\jakarta-tomcat-4.1.18\common\endorsed -classpath c:\programme\jdk1.3.1\lib\tools.jar;C:\programme\tomcat\jakarta-tomcat-4.1.18\bin\bootstrap.jar -Dcatalina.base=C:\programme\tomcat\test -Dcatalina.home= C:\programme\tomcat\jakarta-tomcat-4.1.18 -Djava.io.tmpdir=C:\programme\tomcat\test\temp org.apache.catalina.startup.Bootstrap start And following output on the console: Agent password=ke4gs Starting service Tomcat-Standalone Apache Tomcat/4.1.18 It seems correct to me, and there's always a agent password generated. On eclipse side I entered in Debug - Remote Java Application the project name, the connection type Standard (Socket Attach) and localhost and 8665 for host and port and clicking to debug shows me the above error screen. I will be never asked for a password?! What I am doing wrong? Can I set the password in the tomcat commandline, so that there's not every time I restart tomcat I get a new password? Thanks, Gernot - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JK2
How can I configure 2 JK2 connectors on one server? e.g. server service1 jk2handler one ... /service1 service2 jk2handler two ... /service2 server If I have only jk2handler one, its properties are fetchted from $CATALINABASE/conf/jk2.properties. BUT what if I also have jk2handler two? Where can I assign a different properties file or how can I arrange one property file in two sections? Second question: On my apache server I have following workers.properties file: [shm] file=${serverRoot}/logs/shm.file size=1048576 # Example socket channel, override port and host. [channel.socket:aegir:58606] # define the worker [ajp13:aegirt:58606] channel=channel.socket:aegir:58606 # Uri mapping [uri:/test/*] worker=ajp13:aegir:58606 # define the worker [status:status] # Uri mapping [uri:/jkstatus/*] worker=status:status Where aegir is the name of the server where tomcat is running (its different from the server wehre apache is running). The port number 58606 is ignored?! If I configure jk2.properies (tomcat side) to the default port 8009 everything works correct (in workers.properties is 58606!!). It seems apache module (mod_jk2-2.0.43.dll) ignores this value; if I switch on tomcat side to 58606 the request is blocked. What I'm doing wrong?? Thanks, Gernot - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
tomcat 4.1.12 hangs on HP-UX
My tomcat hangs after around 30 requests to my struts-servlet. Tomcat doesn't write anything to some log (I had also set debug in server.xml) and doesn't shutdown (I had always to use kill -9 xx). I also looked to the garbage collector (JVM option -Xloggc:gc.log), but the heap size were about 64k (-Xmx was set to 300m). The responses are delayed about 5 to 10 seconds, because there must be fetched some data via OJB. If I do a JMeter test with the tomcat ROOT page (which has practically no delay), tomcat hangs after 5 requests. Does anybody have any suggestions what to do or where the problem can be? My configuration: tomcat 4.1.12 on HP-UX with jdk 1.4.1.00: I tried with standard jvm opts, with CATALINA_OPTS=-client -d64 -Xms30m -Xmx300m -Xincgc and CATALINA_OPTS=-server -d64 -Xms30m -Xmx300m -Xincgc and CATALINA_OPTS=-client -d64 -Xms30m -Xmx300m My connector: Connector className=org.apache.coyote.tomcat4.CoyoteConnector port=58000 minProcessors=5 maxProcessors=20 enableLookups=true redirectPort=58443 acceptCount=10 debug=0 connectionTimeout=6/ Thank you, Gernot - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
JDK or is JRE sufficient?
In RUNNING.txt there is the sentence, that I have to install a JDK before running TOMCAT - is there a possibility to run TOMCAT in conjunction with the JRE only? (On our HP-UX, there's only JRE installed). If yes, is there some guideline what to change, because in the startup scripts there will be checked if jdo and javac is present. Thanks, Gernot -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]