Load properties file from Tomcat directory
Is there a to load a properties file that is dropped in the ${catalina.base}/lib directory? When I try the following it returns null: MyClass.class.getResourceAsStream(PROPERTY_FILE_NAME) I realize I can do the following, but I don't want the code to be server specific: props.load(new File(System.getProperty("catalina.base") + "/lib/" + PROPERTY_FILE_NAME).toURL().openStream()); Thanks for the help, Justin CONFIDENTIALITY NOTICE: The information in this message, and any attachment, is intended for the sole use of the individual and entity to whom it is addressed. This information may be privileged, confidential, and protected from disclosure. If you are not the intended recipient you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it, or its contents, is strictly prohibited. If you think that you have received this message in error please notify the sender and destroy all copies of this communication and any attachments. Thank you.
RE: JAAS Module Tomcat 7 (Bundling and JNDI Datasource access)
I was loading the datasource using Spring In order for it to work it must be Also the Realm definition was not correct. The name of the JAAS class should be in a jaas.conf file, not in the Realm definition. Hope that helps someone else running into similar issues. Thanks "whartung" for the help. ~Justin -Original Message----- From: Justin Rosenberg [mailto:rosenbe...@crlcorp.com] Sent: Wednesday, January 23, 2013 7:06 PM To: users@tomcat.apache.org Subject: JAAS Module Tomcat 7 (Bundling and JNDI Datasource access) I'm running into issues accessing a JNDI datasource in a JAAS module. Can I bundle a JAAS module in my war file? When I try to do this by defining the Realm in the context.xml of the web application I get a java.lang.ClassNotFoundException. The documentation specifies I must put the module in the lib directory. Can someone confirm this? When I deploy all the JAAS module and all required dependencies in a directory listed under "common.loader", I run into the following two issue. The JAAS module cannot seem to load the JNDI datasource "javax.naming.NameNotFoundException: Name [foo/bar] is not bound in this Context. Unable to find [foo]." Is there a way to expose a JNDI datasource to a JAAS module? Tomcat Version: 7.0.34 Datasource is defined in conf/server.xml as: The datasource is exposed in conf/context.xml as: The JAAS module is defined at either the server.xml or context.xml of the web application as: If defined in the server.xml the server fails to start. If it's in the application context.xml it fails when the application tries to load. Thank you, Justin CONFIDENTIALITY NOTICE: The information in this message, and any attachment, is intended for the sole use of the individual and entity to whom it is addressed. This information may be privileged, confidential, and protected from disclosure. If you are not the intended recipient you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it, or its contents, is strictly prohibited. If you think that you have received this message in error please notify the sender and destroy all copies of this communication and any attachments. Thank you. CONFIDENTIALITY NOTICE: The information in this message, and any attachment, is intended for the sole use of the individual and entity to whom it is addressed. This information may be privileged, confidential, and protected from disclosure. If you are not the intended recipient you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it, or its contents, is strictly prohibited. If you think that you have received this message in error please notify the sender and destroy all copies of this communication and any attachments. Thank you. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Tomcat6+webapps+log4j
You might try putting the log4j properties file (or xml) in a shared loader location. In catalina.properties add something like this: shared.loader=${catalina.base}/conf/properties and then put the properties file there. ~Justin -Original Message- From: Tiago Sousa [mailto:tiago-a-so...@ext.ptinovacao.pt] Sent: Thursday, January 24, 2013 10:01 AM To: users@tomcat.apache.org Subject: Tomcat6+webapps+log4j Hello to all. I have tomcat 6 using JULI for logging (logging.properties in conf dir) plus several webapps using its own log4j.properties. I need to centralized all the logs so i thought to put a global/shared log4j.properties in $CATALINA_BASE\lib so that tomcat and each webapp can be controlled through this file. The problem i'm facing is that no logs are produced. At this time i'm trying to configure just TOMCAT, no webapps, to log through log4j but still no logs are produced. I've folowed the tutorial in Apache logging webpage with the standard log4j.properties. No logs in $CATALINA_BASE\logs. Can you help me saying what mistakes i am doing in this basic configuration (tomcat and no apps)? Thanks. Tiago - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org CONFIDENTIALITY NOTICE: The information in this message, and any attachment, is intended for the sole use of the individual and entity to whom it is addressed. This information may be privileged, confidential, and protected from disclosure. If you are not the intended recipient you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it, or its contents, is strictly prohibited. If you think that you have received this message in error please notify the sender and destroy all copies of this communication and any attachments. Thank you. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
JAAS Module Tomcat 7 (Bundling and JNDI Datasource access)
I'm running into issues accessing a JNDI datasource in a JAAS module. Can I bundle a JAAS module in my war file? When I try to do this by defining the Realm in the context.xml of the web application I get a java.lang.ClassNotFoundException. The documentation specifies I must put the module in the lib directory. Can someone confirm this? When I deploy all the JAAS module and all required dependencies in a directory listed under "common.loader", I run into the following two issue. The JAAS module cannot seem to load the JNDI datasource "javax.naming.NameNotFoundException: Name [foo/bar] is not bound in this Context. Unable to find [foo]." Is there a way to expose a JNDI datasource to a JAAS module? Tomcat Version: 7.0.34 Datasource is defined in conf/server.xml as: The datasource is exposed in conf/context.xml as: The JAAS module is defined at either the server.xml or context.xml of the web application as: If defined in the server.xml the server fails to start. If it's in the application context.xml it fails when the application tries to load. Thank you, Justin CONFIDENTIALITY NOTICE: The information in this message, and any attachment, is intended for the sole use of the individual and entity to whom it is addressed. This information may be privileged, confidential, and protected from disclosure. If you are not the intended recipient you are hereby notified that you have received this communication in error and that any review, disclosure, dissemination, distribution or copying of it, or its contents, is strictly prohibited. If you think that you have received this message in error please notify the sender and destroy all copies of this communication and any attachments. Thank you.