Re: How to approximate tomcat-5.0/4.x/3.x logging in 5.5?
Quoting Adrian Robert [EMAIL PROTECTED]: Understandable. I was a little dismayed to see that what had been more automatic in Tomcat-5.0.xx had become less so in Tomcat-5.5. What I mean is, in Tomcat-5.0.xx, one could add a Logger to the context configuration file, deploy that with the webapp, and dynamically get a log file for ServletContext.log() output. In Tomcat-5.5, one has to have this in the logger config file at Tomcat startup, therefore forcing one to predict the apps that will be deployed to the appserver during runtime ... I was trying to achieve this with multiple separate log4j.properties, one in the container (common/classes/) for the uncaught stack trace and other general logging, and others in each webapp. With my setup below I was expecting to get THREE files: catalina.out (with stdout/err), tomcat.log (with the container's log4j output), and bar.log (with the webapp's log4j output, which I changed from ServletContext.log() to use Logger.info()). Instead, I got only catalina.out and tomcat.log, the latter containing everything that I thought the webapp would be sending to bar.log. And this should have worked. It works in every case I have ever tried. I suggest you double and triple check that you have log4j.jar in both common/lib and WEB-INF/lib and make sure you have log4j.properties in both common/classes and WEB-INF/classes. OK, thanks to your vote of confidence in the method, I dug further and discovered that my WEB-INF/classes/log4j.properties was never being found. If I put the log4j.properties into the same jar (in WEB-INF/lib) with the class that was instantiating the Logger, it worked correctly. That's extremely odd. What version of Tomcat are you running? That's a bug because WEB-INF/classes should be put in the classpath before jars in WEB-INF/lib. Jake - 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]
Re: How to approximate tomcat-5.0/4.x/3.x logging in 5.5?
Quoting Adrian Robert [EMAIL PROTECTED]: OK, thanks to your vote of confidence in the method, I dug further and discovered that my WEB-INF/classes/log4j.properties was never being found. If I put the log4j.properties into the same jar (in WEB-INF/lib) with the class that was instantiating the Logger, it worked correctly. That's extremely odd. What version of Tomcat are you running? That's a bug because WEB-INF/classes should be put in the classpath before jars in WEB-INF/lib. This is 5.5.7, with the 1.4 compatibility package on MacOS. I've experienced similar issues before with different tomcat versions, though I had forgotten that in this case.. Note I do NOT unpack the app from a war, just copy the full hierarchy straight under webapps. Also, the WEB-INF/classes/log4j.properties file was a symblic link. Maybe one of these makes a difference? That makes a huge difference. Symbolic links are not enabled by default. I believe there is some sort of allowLinking property you can set in the context configuration file for the app. I don't recall the syntax for that, though. See the Tomcat docs for info. Once you have that set, it will probably work as expected. Jake - 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]
Re: path attributes in context xml files
Interesting. So, what If I wanted to deploy an app as a .war file with a context.xml file in META-INF, but wanted the app to be deployed to webapps/dir1/dir2/myapp rather than just webapps/myapp? The file in META-INF must be named context.xml. What clue can one give Tomcat the clue that it should be deployed in a special way other than manually creating the context config file manually before deploying the app? Jake Quoting David Boyer [EMAIL PROTECTED]: Yep, that's it. I'd already tried underscore (and everything else except #). Thanks! [EMAIL PROTECTED] 3/3/2005 6:14:35 PM Yes there is. I cannot remember, but it is in the archives. It has to do with how you name the file. Something like dir1#dir2#appname.xml or it may have been an underscore. I will see if I can find it if no one else knows off the top. Doug - Original Message - From: David Boyer [EMAIL PROTECTED] To: tomcat-user@jakarta.apache.org Sent: Thursday, March 03, 2005 5:31 PM Subject: path attributes in context xml files I use xml files in /conf/[enginename]/[hostname] to define my contexts. I now know that Tomcat 5.5.x doesn't allow for 'path' attributes in the Context elements when defined that way. Previously, I could specify the path as '/dir1/dir2/appname'. I can easily rename the xml file to 'appname.xml', but how do I get the other directories into the path without a 'path' attribute in the Context element. Using the 5.5.x approach, by web application is at '/appname' instead of '/dir1/dir2/appname'. Is there a way to get a multi-directory path using this approach (a la Tomcat 5.0.x), or will I need to declare these Contexts in my server.xml to do that? - 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]
Re: How to approximate tomcat-5.0/4.x/3.x logging in 5.5?
Quoting Adrian Robert [EMAIL PROTECTED]: On Mar 2, 2005, at 12:25 AM, Jacob Kjome wrote: You first talk about ServletContext.log(), but then talk about log4j loggers in your app. These are two completely separate things. Which were you focusing on? With your setup, it it makes sense that ServletContext.log() messages are going to catalina.log. However, if you have log4j.jar in WEB-INF/lib and your application log4j logging is going to catalina.log, then your setup is different than what you describe here. There is quite simply no way that can happen given the setup you've described. They should go to bar.log since that's the only appender that your application's log4j configuration can see. In any case, you don't need a separate log4j.jar in WEB-INF/lib for ServletContext.log() messages to go to app-specific log files. Just define those in your log4j.properties just like you have defined the host logger. Here's my setup for Log4j-1.2.9 in common/classes.log4j.properties (You can use log4j.xml when using Log4j-1.3 because it uses a the new JoranConfigurator which doesn't define a log4j.dtd. The current DOMConfigurator's dtd defines the logger name attribute as an ID and the host and context logger names that Tomcat uses characters not allowed in attributes of type id) Thanks for your input.. I realize I wasn't clear about one thing. I don't want to define webapp-specific logging in the tomcat-global log4j.properties file. Instead, I want individual log4j.properties stored under webapp/*/WEB-INF/classes to cause logging to web-app specific files, without the container needing to be hard-coded for the webapps it is hosting. Understandable. I was a little dismayed to see that what had been more automatic in Tomcat-5.0.xx had become less so in Tomcat-5.5. What I mean is, in Tomcat-5.0.xx, one could add a Logger to the context configuration file, deploy that with the webapp, and dynamically get a log file for ServletContext.log() output. In Tomcat-5.5, one has to have this in the logger config file at Tomcat startup, therefore forcing one to predict the apps that will be deployed to the appserver during runtime. Of course, Tomcat could continue to use the Logger syntax, but only have it mean to programatically use the currently configured logger implementation to add the logger to the existing config rather than literally create a catalina logger which no longer exists. This would continue to make Tomcat-5.5 more involved in logging than it should, though. I think Yoav Shapira has it right when he says that Tomcat should not really be directly involved in logging, but use the external implementation. I'm not sure what the solution is. Probably needs more discussion. I was trying to achieve this with multiple separate log4j.properties, one in the container (common/classes/) for the uncaught stack trace and other general logging, and others in each webapp. With my setup below I was expecting to get THREE files: catalina.out (with stdout/err), tomcat.log (with the container's log4j output), and bar.log (with the webapp's log4j output, which I changed from ServletContext.log() to use Logger.info()). Instead, I got only catalina.out and tomcat.log, the latter containing everything that I thought the webapp would be sending to bar.log. And this should have worked. It works in every case I have ever tried. I suggest you double and triple check that you have log4j.jar in both common/lib and WEB-INF/lib and make sure you have log4j.properties in both common/classes and WEB-INF/classes. One thing that can trip people up is having a log4j.xml file somewhere in the classpath, whether it is in a jar or in WEB-INF/classes. Log4j looks for log4j.xml first and only looks for log4j.properties if it doesn't find it. If a rogue log4j.xml file is sitting in the classpath somewhere your webapp might be using it rather than the log4j.properties you think it is using. This is one of the reasons I always use XML config files rather than property files. I only use log4j.properties for Tomcat-5.5 because of incompatibilities with Tomcat-5.5 context and host logger names and Log4j-1.2.x's dtd. Again, Log4j-1.3 solves this be no longer having a DTD. ... log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localho st].[/myapp]=INFO, MYAPP log4j.additivity.org.apache.catalina.core.ContainerBase.[Catalina].[loc alhost].[/myapp]=false I don't understand this bracket notation. Is it documented anywhere? Is interpretation of it something implemented by tomcat or by log4j? Would it help me achieve what I'm trying to get without changing my webapp's code away from ServletContext.log()? See Remy's message about this. It is detailed in the Tomcat docs. BTW, you don't need commons-logging in your webapp. It is only Tomcat that needs it, so just put it in common/lib, not WEB-INF/lib. You can continue to put
Re: How to approximate tomcat-5.0/4.x/3.x logging in 5.5?
You first talk about ServletContext.log(), but then talk about log4j loggers in your app. These are two completely separate things. Which were you focusing on? With your setup, it it makes sense that ServletContext.log() messages are going to catalina.log. However, if you have log4j.jar in WEB-INF/lib and your application log4j logging is going to catalina.log, then your setup is different than what you describe here. There is quite simply no way that can happen given the setup you've described. They should go to bar.log since that's the only appender that your application's log4j configuration can see. In any case, you don't need a separate log4j.jar in WEB-INF/lib for ServletContext.log() messages to go to app-specific log files. Just define those in your log4j.properties just like you have defined the host logger. Here's my setup for Log4j-1.2.9 in common/classes.log4j.properties (You can use log4j.xml when using Log4j-1.3 because it uses a the new JoranConfigurator which doesn't define a log4j.dtd. The current DOMConfigurator's dtd defines the logger name attribute as an ID and the host and context logger names that Tomcat uses characters not allowed in attributes of type id) log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%-5p[%-8.8t]: %39.39c %-6r - %m%n log4j.appender.LOCALHOST=org.apache.log4j.RollingFileAppender log4j.appender.LOCALHOST.File=${catalina.home}/logs/localhost.log log4j.appender.LOCALHOST.MaxFileSize=1000KB log4j.appender.LOCALHOST.MaxBackupIndex=1 log4j.appender.LOCALHOST.layout=org.apache.log4j.PatternLayout log4j.appender.LOCALHOST.layout.ConversionPattern=%-5p[%-8.8t]: %39.39c %-6r - %m%n log4j.appender.MYAPP=org.apache.log4j.DailyRollingFileAppender log4j.appender.MYAPP.File=${catalina.base}/logs/localhost_myapp.log log4j.appender.MYAPP.DatePattern='.'-MM-dd log4j.appender.MYAPP.layout=org.apache.log4j.PatternLayout log4j.appender.MYAPP.layout.ConversionPattern=%c{1} %-6r - %m%n log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/myapp]=INFO, MYAPP log4j.additivity.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/myapp]=false log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=INFO, LOCALHOST log4j.additivity.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=false log4j.rootLogger=INFO, A1 Note that I use a ConsoleAppender because when I run from the command line, I want the output going to the command window. When I use a service, the service captures the console output and writes it to a log file named stdout.log. This is why I don't specify the file. It is done for me (and rolled daily for me). Also note the use of additivity on the host and context loggers. This is to avoid double logging to the appender configured by the root logger and the one specifically configured for the host/context log. BTW, you don't need commons-logging in your webapp. It is only Tomcat that needs it, so just put it in common/lib, not WEB-INF/lib. You can continue to put log4j.jar in both places if you desire. Otherwise, you can also use a repository selector to separate webapp logging with a single log4j.jar in common/lib. This makes more sense to start doing with Log4j-1.3, though, using the ContextJNDISelector. You get the same effect by having log4j.jar in WEB-INF/lib since the classloader isolation will, effectively, create logging isolation per webapp. Jake At 06:18 PM 3/1/2005 -0500, you wrote: I'm having trouble approximating the earlier tomcat per-context Logger functionality using log4j under tomcat-5.5. Basically, I would like to have one file coming out under $CATALINA_BASE/logs/ per web application context. This appears to be no longer possible through ServletContext.log(). So I tried using log4j: 1) put log4j.jar, commons-logging.jar in common/lib AND webapps/*/WEB-INF/lib 2) put log4j.properties in common/classes AND webapps/*/WEB-INF/classes However, I can't seem to find the right combination of log4j.properties lines, or maybe I'm trying something impossible. (I can't find good docs on the uses of log4j.properties when used inside the hierarchical classloading context that tomcat provides.) What keeps happening is that the webapp's log statements keep going into the global tomcat log. Would I be better off with JDK logging instead? common/classes/log4j.properties --- log4j.rootLogger info, R log4j.appender.R org.apache.log4j.RollingFileAppender log4j.appender.R.File ${catalina.base}/logs/tomcat.log log4j.appender.R.MaxFileSize 10MB log4j.appender.R.MaxBackupIndex10 log4j.appender.R.layoutorg.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern %p %t %c - %m%n #log4j.logger.org.apache.catalina info, R
Re: context elements in /conf/[enginename]/[hostname]
You do realize that the context configuration files have changed between Tomcat-5.0.xx and Tomcat-5.5.x, right? If not, read the docs. If you used the path attribute before in the standalone files, you no longer do that. The path is implied by the name of the file. All you specify is the docBase. And, of course, no more Logger elements. Jake Quoting David Boyer [EMAIL PROTECTED]: I'm upgrading my Tomcat 5.0.x installations to 5.5.7. All of my context elements are defined in individual files (with a .xml extension) in the $CATALINA_HOME/conf/[enginename]/[hostname]/directory as per the Tomcat documentation. All of the defined contexts are loaded when Tomcat 5.0.28 starts, but not in my 5.5.7 installation. My host element has deployXML=true, autoDeploy=true, and deployOnStartup=true. What am I missing that would cause this not to work in TC 5.5.7? If I define the contexts in my server.xml, they work fine, but I'd rather put them in $CATALINA_HOME/conf/[enginename]/[hostname]/ TIA! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Configuring dbcp in / ROOT context (tomcat 5.5.7)
You shouldn't be specifying the factory (this is a change from 5.0). It is implicit and may change under your nose anyway. If you are not using some custom factory that you are providing, let the container provide the default. Jake Quoting Peter Rossbach [EMAIL PROTECTED]: Hello, please give follwing context definition a chance conf/Calalina/localhost/ROOT.xml Context reloadable=true crossContext=true Resource name=jdbc/postgres auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=whatver password=whatver driverClassName=org.postgresql.Driver url=jdbc:postgresql://127.0.0.1:5432/whatever scope=Shareable factory=org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory/ Context Your are sure that you copy the postgres jar at common/lib? Peter Stuart Lewis schrieb: Hi, I've searched the archives and generally on google, and whilst people see the problem a lot, I've not found a definitive answer for how to configure dbcp in the root context. E.g. In server.xml I have: Context path=/DBTest docBase=DBTest debug=5 reloadable=true crossContext=true Resource name=jdbc/postgres auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=whatver password=whatver driverClassName=org.postgresql.Driver url=jdbc:postgresql://127.0.0.1:5432/whatever scope=Shareable factory=org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory/ /Context If I copy this, and have it the same, except: Context path=/ docBase=ROOT debug=5 reloadable=true crossContext=true then it fails, with: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' How should I be configuring my postgress connection for use in the root context? Any help will be hugely appreciated, and will stop me from pulling any more of my hair out! Thanks, Stuart - 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]
RE:[RESOLVED] log4j.properties not found in tomcat
Quoting Brian McGovern [EMAIL PROTECTED]: Thanks for the repliess. My issue was that I needed to set a system wide environment variable called log4j.configuration and set its value to log4j.properties, the name of my config file for log4j. This was in the log4j documentation but I guess i skimmed over that part. Log4j is a application completely separate from web container, hence the need for a system wide var. Definately liking log4j more and more. My file was located in my /webapps/myappuri/WEB-INF/classes/ So the answer turns out that log4j looks for a system env var log4j.configuration and looks in your webapps class path for it. No, I'm pretty sure this is not the case. log4j.configuration does not need to be specified. If it is, I believe it is assumed to be a file location. If relatively defined, it is resolved relative to the location that the JVM started. If not defined, Log4j looks in the classloader. Actually, I haven't checked, but it may fall back to the classloader if it can't find the log4j config file in the location specified by the system property. You'll have to verify that. Additionally I set up tomcat to use my log4j file as well by makin a file called commons-logging.properties in /webapps/myappuri/WEB-INF/classes/ whos only line was: org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger Note that commons-logging.jar needs to be in your /webapps/myappuri/WEB-INF/lib/ dir for this to work. If you want Log4j to be a system-wide service, you should really add log4j.jar and commons-logging.jar to CATALINA_HOME/common/lib and add log4j.properties to CATALINA_HOME/common/classes. There is no need for the commons-logging.properties file in that case. And it is kludgy to provide server-level properties inside a webapp. BTW, do you have log4j.jar in your WEB-INF/lib? If so, you are simply logging for your webapp alone, not system-wide. Jake Thanks -B -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 22, 2005 12:30 AM To: Tomcat Users List Subject: Re: log4j.properties not found in tomcat You have to understand that any relative path is going to be resolved relative to the location where the JVM started. If you started Tomcat via the service rather than the batch files, then the VM would be run, by default, from C:\winnt\System32. So, when you supplied -Dlog4j.configuration=log4j.properties, you got exactly what should be expected if log4j.properties were located in c:\winnt\System32. Same goes for relatively defined paths to log files defined for FileAppenders in log4j.properties. BTW, can you post your error? FileNotFoundExceptions aren't thrown when Log4j can't find its config file. You'd get a simple error saying as much. The FileNotFoundExceptions are usually thrown when you specify a file for a FileAppender in a directory that doesn't exist. Log4j makes no attempt to create directories if they don't exist already. This is the correct and safe thing to do. It is your responsibility to make sure the directory exists before Log4j attempts to use it. Jake At 11:09 PM 2/21/2005 -0500, you wrote: Where do you put log4j.properties currently? -Michael Greer On Feb 21, 2005, at 5:02 PM, Brian McGovern wrote: I have a wierd problem. Tomcat on W2k barks FileNotFound Exceptions for the log4j.properties file when i execute a servlet that instantiates log4j. Strangely enough the actual file that i create and log to with log4j.properties file logs out just fine even though stdout.log said that it couldn't find my log4j.properties file. Only time i don't get an error is when i put log4j.properites in my winnt/system32 directory. But this doesnt make sense to me. I supply -Dlog4j.configuration=log4j.properties to Java at startup and still get the same error. I also tried the FULL path to my log4j.properties in the -D option. Instantiated like this across my app. private static final Logger zLogger = Logger.getLogger(MyClassName.class); Can anyone tell me where I went wrong. thanks - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [RESOLVED] log4j.properties not found in tomcat
You've got to have something wacky set up on your systems. File IO is not used when Log4j picks the config file up from the classpath. This leads me to believe that log4j.configuration is set somewhere else upon each invocation of Tomcat. You probably just set it earlier in the launching of Tomcat overriding the one pointing to a log4j.properties file that doesn't exist. I and others have use the auto-configuration paradigm with log4j.jar in WEB-INF/lib and the config file in WEB-INF/classes for ages and haven't ever seen the issue you are seeing. That tells me that the problem is in your setup, not in Log4j. I suggest you set up a clean-room environment and try this out. I bet it works. Then try to figure out what's wrong in your other environments. Jake Quoting Brian McGovern [EMAIL PROTECTED]: Then theres something else going on. I didnt set log4j.configuration when i started, i just had my log4j.jar in my WEB-INF/lib/ and my log4j.properties in my /WEB-INF/classes/ However i still got that file not found exception. I think its gotta either the way im calling it or the properties file itself. I say this because ive now tried on 2 machines 2 OS's and same thing happened. It MAKES me define a system wide log4j.configuration. This cannot be right. Makes the whole use of log4j pointless and non portable. At any rate, ive got that wacky system-wide var defined and it supresses errors, just doesnt work the way i want. Calling like this: private static final Logger zLogger = Logger.getLogger(RepsMainController.class); zLogger.debug(something logged here); log4j.properties like this: log4j.rootLogger=DEBUG, nycbbuilderlog log4j.appender.nycbbuilderlog=org.apache.log4j.RollingFileAppender log4j.appender.nycbbuilderlog.File=${catalina.home}/logs/catalina.out log4j.appender.nycbbuilderlog.MaxFileSize=1KB log4j.appender.nycbbuilderlog.MaxBackupIndex=2 log4j.appender.nycbbuilderlog.layout=org.apache.log4j.PatternLayout log4j.appender.nycbbuilderlog.layout.ConversionPattern=%5p [EMAIL PROTECTED]:mm:ss,SSS}] - %m%n -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 22, 2005 3:01 PM To: Tomcat Users List Subject: RE:[RESOLVED] log4j.properties not found in tomcat Quoting Brian McGovern [EMAIL PROTECTED]: Thanks for the repliess. My issue was that I needed to set a system wide environment variable called log4j.configuration and set its value to log4j.properties, the name of my config file for log4j. This was in the log4j documentation but I guess i skimmed over that part. Log4j is a application completely separate from web container, hence the need for a system wide var. Definately liking log4j more and more. My file was located in my /webapps/myappuri/WEB-INF/classes/ So the answer turns out that log4j looks for a system env var log4j.configuration and looks in your webapps class path for it. No, I'm pretty sure this is not the case. log4j.configuration does not need to be specified. If it is, I believe it is assumed to be a file location. If relatively defined, it is resolved relative to the location that the JVM started. If not defined, Log4j looks in the classloader. Actually, I haven't checked, but it may fall back to the classloader if it can't find the log4j config file in the location specified by the system property. You'll have to verify that. Additionally I set up tomcat to use my log4j file as well by makin a file called commons-logging.properties in /webapps/myappuri/WEB-INF/classes/ whos only line was: org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger Note that commons-logging.jar needs to be in your /webapps/myappuri/WEB-INF/lib/ dir for this to work. If you want Log4j to be a system-wide service, you should really add log4j.jar and commons-logging.jar to CATALINA_HOME/common/lib and add log4j.properties to CATALINA_HOME/common/classes. There is no need for the commons-logging.properties file in that case. And it is kludgy to provide server-level properties inside a webapp. BTW, do you have log4j.jar in your WEB-INF/lib? If so, you are simply logging for your webapp alone, not system-wide. Jake Thanks -B -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 22, 2005 12:30 AM To: Tomcat Users List Subject: Re: log4j.properties not found in tomcat You have to understand that any relative path is going to be resolved relative to the location where the JVM started. If you started Tomcat via the service rather than the batch files, then the VM would be run, by default, from C:\winnt\System32. So, when you supplied -Dlog4j.configuration=log4j.properties, you got exactly what should be expected if log4j.properties were located in c:\winnt\System32. Same goes for relatively defined paths to log files defined
Re: log4j.properties not found in tomcat
You have to understand that any relative path is going to be resolved relative to the location where the JVM started. If you started Tomcat via the service rather than the batch files, then the VM would be run, by default, from C:\winnt\System32. So, when you supplied -Dlog4j.configuration=log4j.properties, you got exactly what should be expected if log4j.properties were located in c:\winnt\System32. Same goes for relatively defined paths to log files defined for FileAppenders in log4j.properties. BTW, can you post your error? FileNotFoundExceptions aren't thrown when Log4j can't find its config file. You'd get a simple error saying as much. The FileNotFoundExceptions are usually thrown when you specify a file for a FileAppender in a directory that doesn't exist. Log4j makes no attempt to create directories if they don't exist already. This is the correct and safe thing to do. It is your responsibility to make sure the directory exists before Log4j attempts to use it. Jake At 11:09 PM 2/21/2005 -0500, you wrote: Where do you put log4j.properties currently? -Michael Greer On Feb 21, 2005, at 5:02 PM, Brian McGovern wrote: I have a wierd problem. Tomcat on W2k barks FileNotFound Exceptions for the log4j.properties file when i execute a servlet that instantiates log4j. Strangely enough the actual file that i create and log to with log4j.properties file logs out just fine even though stdout.log said that it couldn't find my log4j.properties file. Only time i don't get an error is when i put log4j.properites in my winnt/system32 directory. But this doesnt make sense to me. I supply -Dlog4j.configuration=log4j.properties to Java at startup and still get the same error. I also tried the FULL path to my log4j.properties in the -D option. Instantiated like this across my app. private static final Logger zLogger = Logger.getLogger(MyClassName.class); Can anyone tell me where I went wrong. thanks - 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]
RE: log4j best practices
Since you define your log files relatively, they will end up relative to the directory where the JVM was started from. I you use Tomcat scripts, then it will be in CATALINA_HOME/bin. If you use the Tomcat service, then the files will end up in c:\winnt\System32 (unless you changed the base directory from which the service starts the JVM. I suggest you use... log4j.appender.stdout.File=${catalina.home}/logs/catalina.out Tomcat creates the catalina.home system property at startup. You can use it to reference Tomcat's home directory and then put the file anywhere you want relative to that. Jake Quoting Brian McGovern [EMAIL PROTECTED]: Thats the same approach im using. I have a commons-logging.properties and a log4j.properties file in my WEB-INF\classes directory. But I only get the same loggin as before in stdout.log Im using Win2k as OS. Where do my defined log files go? Im confused. Everything compiles. I have this line in my classes: private static final Logger zLogger = Logger.getLogger(MYCLASSNAME.CLASS); Logging like this: zLogger.debug(New Session Was Created); commons-logging.properties file has 1 line. org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger log4j.properties file is here: log4j.rootLogger=DEBUG, stdout, nycbbuilder_log log4j.appender.stdout=org.apache.log4j.RollingFileAppender log4j.appender.stdout.File=catalina.out log4j.appender.stdout.MaxFileSize=100KB log4j.appender.stdout.MaxBackupIndex=2 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n log4j.appender.nycbbuilder_log=org.apache.log4j.RollingFileAppender log4j.appender.nycbbuilder_log.File=nycbbuilder.log log4j.appender.nycbbuilder_log.MaxFileSize=100KB log4j.appender.nycbbuilder_log.MaxBackupIndex=2 log4j.appender.nycbbuilder_log.layout=org.apache.log4j.PatternLayout log4j.appender.nycbbuilder_log.layout.ConversionPattern=%d{ABSOLUTE} - %p %c - %m%n -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 16, 2005 1:52 PM To: Tomcat Users List Subject: Re: log4j best practices I just implemented this over the weekend. Still not totally sure what I am doing, but I do have all my classes outputting to a log file I have specified. I went with a simple approach creating a reference to a Logger object in each class (I have an external properties file supplying all the config options). My problem is everything ends up in one giant file and it is hard to interpret. I am now thinking about having each class create and configure a logger object and write to its own file. One log per class. The good thing is it is log4j is easy to set up and start logging with. Here is the tutorial I got started with: http://www.developer.com/open/article.php/10930_3097221_1 HTH Luke Hi everyone Im looking for some tips on implementing a logging system in tomcat. Ive got log4j installed and am about to write code but im just looking for some tips before i get started. My idea is to write a central logger class for my app that imports the log4j package and supplys static methods to my app but I don't know if thats a bad idea? thanks -B - 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]
Re: **CONFIDENTIAL** Configuring Log4j in webapps
A rights problem is posssible, but unlikely given that the OS is some version of Windows. However, if the server that isn't working is running as a service, the default location for a relatively defined log file would be in C:\winnt\System32, which means your log file would be at C:\winnt\logs\mywebapplog.log (assuming the FileAppender would create the logs directory if it didn't exist already (I don't think it does). The reason it would work when running Tomcat's startup.bat file is that VM would have been started up in CATALINA_HOME\bin, so the location of the relatively defined log file would actually end up in CATALINA_HOME\logs. Make sense? Relatively defined paths will be relative to the directory where the VM started from. Services start from C:\winnt\System32 by default. This can be solved in one of two ways... 1. Use ${catalina.home}/logs/mywebapp.log. Tomcat generates this system property upon startup, and you can reference it in your config file 2. Tomcat's service can change the location of where the VM is started from. Just double click on tomcat5w.exe to see all the options. Change the startup location to wherever CATALINA_HOME\bin is to normalize it with starting Tomcat using CATALINA_HOME\bin\startup.bat Jake Quoting Parsons Technical Services [EMAIL PROTECTED]: Sounds like a rights issue on the server. Make sure that the user that tomcat is running with has the needed rights on the directory. If it is running as a service, you can still have a rights problem. If at some point in the path you do not have the proper rights, it can prevent the use of relative paths. How are you starting Tomcat? Service or user? Doug - Original Message - From: Ethan Cabiac [EMAIL PROTECTED] To: tomcat-user@jakarta.apache.org Sent: Monday, February 07, 2005 9:23 AM Subject: **CONFIDENTIAL** Configuring Log4j in webapps Hi everyone, I don't know if this is a Log4j problem or a Tomcat related issue but I am posting here first because I already subscribe to this mailing list ;). I have two (theoretically) identical Tomcat webservers (Tomcat 5.0), one on my local WinXP machine for dev/testing and one on the company's Win 2003 Server machine for production. When I setup my log4j files in my webapps I use: log4j.appender.A1.File=../logs/mywebapplog.log On my test machine this will work perfectly and even create the log file on Tomcat startup if it does not exist. On my production database it will not work if I use relative path, I actually have to specify C:/path_to_logs/mywebapplog.log and if the file is not there already then Tomcat complains on startup and no log gets written for the webapp. Like I said, the two Tomcats are supposed to be identical, but maybe there is a configuration discrepancy I missed, or maybe this is a Log4j thing? Any help is appreciated. -Ethan Cabiac -- This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are the intended recipient, this message is CONFIDENTIAL as per Contract. This message should not be disseminated to 3rd parties without prior written approval or consent from a Director of TRAX. Violation of Contract Terms constitute a breach and be cause for termination. If you are NOT the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. - 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]
Re: order of creation of JNDI datasource from context.xml and Filter.init() using it
Try not specifying the factory parameter. It isn't required anyway by Tomcat-5.5.x. Tomcat-5.5.x uses its own version of commons-dbcp, so if you are specifying org.apache.commons.dbcp.BasicDataSourceFactory, that is probably not the one that Tomcat wants to use internally. I think they wrapped up the package into their own, such as maybe org.apache.tomcat.commons.dbcp.BasicDataSourceFactory (this may not be exact, I just know it is something like this), to avoid version collisions with user-provided commons-dbcp jars. Jake At 09:42 PM 2/5/2005 +0100, you wrote: Hello, My problem is so basic that I have no doubt other people have experienced it. Still, I can't find any solutions on the web. I want Tomcat to provide my webapp with DataSources through JNDI. I want Hibernate to use these DataSources. Nothing exciting so far. I configured the BasicDataSourceFactory in the META-INF/context.xml like this: Resource name=jdbc/mydb auth=Container driverClassName=org.postgresql.Driver factory=org.apache.commons.dbcp.BasicDataSourceFactory username=* password=* type=javax.sql.Datasource url=jdbc:postgresql://localhost:5432/mywebapp scope=Shareable maxActive=10 maxIdle=100 maxWait=3000 / In the web.xml I put: filter filter-nameHibernateSessionFilter/filter-name filter-classnl.kransen.mywebapp.context.HibernateSessionFilter/filter-class /filter filter-mapping filter-nameHibernateSessionFilter/filter-name url-pattern/*/url-pattern /filter-mapping ... resource-ref descriptionMy database/description res-ref-namejdbc/mydb/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref In the hibernate.cfg.xml I make a JNDI reference to the datasource: hibernate-configuration session-factory property name=connection.datasourcejava:comp/env/jdbc/mydb/property property name=dialectnet.sf.hibernate.dialect.PostgreSQLDialect/property property name=show_sqltrue/property mapping resource=hibernate-mappings/Aap.hbm.xml / mapping resource=hibernate-mappings/Noot.hbm.xml / mapping resource=hibernate-mappings/Mies.hbm.xml / /session-factory /hibernate-configuration Now I created a HibernateSessionFilter that will filter any request to the webapp and provide it with a Hibernate Session. In the init() the Hibernate SessionFactory is configured by doing a lookup on JNDI for a DataSource. My problem is that Hibernate can't find the JNDI datasource: 17:44:14,745 INFO [nl.kransen.mywebapp.context.HibernateSessionFilter] Failed to initialize Hibernate! net.sf.hibernate.HibernateException: Could not find datasource: java:comp/env/jdbc/mydb Instead, I tried to put the Datasource in the GlobalNamingResources/ of the server.xml. In the context.xml I put: ResourceLink name=My Database global=jdbc/mydb type=javax.sql.Datasource / The error I get then is: 20:31:09,550 WARN [net.sf.hibernate.cfg.SettingsFactory] Could not obtain connection metadata org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource .java:780) Instead of initializing the Hibernate SessionFactory in the Filter's init() method, I do it the first time the doFilter() is called. Then I get a similar error: 20:42:35,324 DEBUG [net.sf.hibernate.util.JDBCExceptionReporter] Cannot open connection org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource .java:780) ... Caused by: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource .java:780) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.ja va:540) at net.sf.hibernate.connection.DatasourceConnectionProvider.getConnection(Datas ourceConnectionProvider.java:59) at net.sf.hibernate.impl.BatcherImpl.openConnection(BatcherImpl.java:289) ... 54 more Caused by: java.lang.NullPointerException at java.util.StringTokenizer.init(StringTokenizer.java:182) at org.postgresql.Driver.parseURL(Driver.java:251) at org.postgresql.Driver.acceptsURL(Driver.java:159) at java.sql.DriverManager.getDriver(DriverManager.java:232) at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource .java:773) What I really want is the first solution with the JNDI datasource declaration in the webapp context.xml, and preferably initialization of Hibernate in the init() of the Filter. Is it possible that the reason
Re: Is there any option for .rar files on Tomcat 5.5.7
But you can fake it by implementing a custom javax.naming.spi.ObjectFactory and returning an object implementing javax.resource.cci.ConnectionFactory. I have done this to mimick the Kodo JDO JCA adapter so that whether the app is running in Weblogic or Tomcat, I access the JDO persistence manager in exactly the same way public Connection getConnection() { return (javax.resource.cci.Connection) pmf().getPersistenceManager(); } note: KodoPersistenceManager implements javax.resource.cci.Connection which is why this works. See: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html#Adding%20Custom%20Resource%20Factories Jake At 12:09 AM 2/4/2005 +0100, you wrote: On Thu, 03 Feb 2005 18:04:00 -0500, Edmon Begoli [EMAIL PROTECTED] wrote: I understand that Tomcat is not a full J2EE app. server, but I would like to know if there are any options to deploy .rar JCA adapters on Tomcat 5.5.7? No, Tomcat doesn't support JCA, sorry. -- x Rémy Maucherat Developer Consultant JBoss Group (Europe) SàRL x - 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]
Re: separate log4j configurations
Quoting Roberto Cosenza [EMAIL PROTECTED]: If you will configure log4j instances which are in the same classloader, they will conflict. Bootstrap | System | Common / \ Catalina Shared / \ Webapp1 Webapp2 ... http://jakarta.apache.org/tomcat/tomcat-5.5-doc/class-loader-howto.html In other words, your webapp log4j.configuration will override your tomcat-wide log4j.configuration which may annoy you /roberto No, Tomcat will continue to log just as it was configured at the server level. And, actually, his log4j.properties file in WEB-INF/classes wouldn't even get picked up by log4j at all because the default logger repository has already been configured (assuming no manual configuration) so there would be no auto-configuration triggered. I think what Tony is looking for is his Test webapp to control logging for itself. To do this, he would need to do one of two things... 1. Place a copy of log4j.jar in WEB-INF/lib. In a parent-last classloading environment, such as Tomcat provides, log4j will have its own environment to log in completely separate from that of the server. 2. Use a repository selector. I wouldn't bother with this until Log4j-1.3 comes out, but after that, once can simply define an env-entry (when using the JNDI repository selector) in web.xml to specify that the webapp should log within a named logger repository separate from the default one which the server is using. This is much more flexible because then multiple apps can log to the same logger repository if they want. Here one gets all the benefits of #1 but can also coordinate like-applications to log to the same logger repository without affecting other logger repositories. In this case, a single log4j.jar would be at the server level and not in WEB-INF/lib webapps. Jake - Original Message - From: Tony Tomcat [EMAIL PROTECTED] To: tomcat-user@jakarta.apache.org Sent: Tuesday, February 01, 2005 8:50 PM Subject: separate log4j configurations Is it safe to have 1 log4j.properties setup for all of tomcat and then override it for a webapp that might need slightly different logging? For example.. I place log4j.jar and the Jakarta commons-logging.jar into the $TOMCAT_HOME/common/lib directory and have a log4j properties file in $TOMCAT_HOME/common/classes/log4j.properties This properties file writes to ${catalina.home}/logs/all.out Then I have a test webapp that I want in its own log4j output file so I install a new log4j.properties file in that webapp. $TOMCAT_HOME/webapps/test/WEB-INF/classes/log4j.properties This properties file puts the output in ${catalina.home}/logs/test.out This appears to work but I'm just wondering if this is the correct way to go about it. The reason I want my main logging configuration in common/classes is because I want my operations team to control the logging instead of the war file. In the case of my test application I always want it to log at the debug level and it is only installed in production briefly so having the log4j.properties in the war file is fine and allows me to keep it logging at debug even if the other apps are at WARN. Any issues here? Tony - 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]
Re: separate log4j configurations
Quoting Roberto Cosenza [EMAIL PROTECTED]: No, Tomcat will continue to log just as it was configured at the server level. And, actually, his log4j.properties file in WEB-INF/classes wouldn't even get picked up by log4j at all because the default logger repository has already been configured (assuming no manual configuration) so there would be no auto-configuration triggered. Yes...assuming no manual configuration :-D But in the general case, every new webapp will modify the configuration of the same log4j! /rob You're calling the general case manual configuration? I think the general case is more likely to count on auto-configuration, in which case this isn't an issue. In any case, if log4j.jar is added to WEB-INF/lib, this is not an issue. Or if one uses a repository selector and sets the proper env-entry in web.xml, this is not an issue. That said, it is still possible for a rogue webapp to blow away the existing configuration if it is logging in the server's logger repository by using manual configuration. If you are concerned about this, I suggest you bring it up on the log4j-user list. I tend to agree that it is a problem. I've argued for treating the default logger repository in a special way (not exactly with this case in mind, but nevertheless...). later, Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: commons-loggin instead of loggers
Put log4j-1.2.9.jar and commons-logging-1.0.4.jar (not commons-logging-api.jar!!) in CATALINA_HOME/common/lib and log4j.properties in CATALINA_HOME/common/classes and make the properties file look something like... log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%-5p[%-8.8t]: %39.39c %-6r - %m%n log4j.appender.LOCALHOST=org.apache.log4j.RollingFileAppender log4j.appender.LOCALHOST.File=${catalina.home}/logs/localhost.log log4j.appender.LOCALHOST.MaxFileSize=1000KB log4j.appender.LOCALHOST.MaxBackupIndex=1 log4j.appender.LOCALHOST.layout=org.apache.log4j.PatternLayout log4j.appender.LOCALHOST.layout.ConversionPattern=%-5p[%-8.8t]: %39.39c %-6r - %m%n log4j.appender.MYAPP=org.apache.log4j.DailyRollingFileAppender log4j.appender.MYAPP.File=${catalina.home}/logs/localhost_myapp.log log4j.appender.MYAPP.DatePattern='.'-MM-dd log4j.appender.MYAPP.layout=org.apache.log4j.PatternLayout log4j.appender.MYAPP.layout.ConversionPattern=%c{1} %-6r - %m%n log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=INFO, LOCALHOST log4j.additivity.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=false log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/myapp]=INFO, MYAPP log4j.additivity.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/myapp]=false log4j.rootLogger=INFO, A1 Don't try using a log4j.xml file. The logger names above are illegal id attribute values and will cause an XML parsing error. The logger name attribute is defined as of type id in the log4j.dtd. This won't be an issue in Log4j-1.3 but still is, and will always be, in Log4j-1.2.x. BTW, Valves are like Filters, but at the server level rather than at the application level. The fact that a Valve might log something doesn't make it a logger itself. Jake At 06:58 PM 1/29/2005 +0100, you wrote: Hi, Loggers seems to have disappeared since 5.5 release It seems that we must use commons-loggin Does someone have an example to replace my classical logger which was in my context Logger className=org.apache.catalina.logger.FileLogger prefix=myappli_log. suffix=.txt timestamp=true/ PS: What is exactly the diff between a Logger and a Valve ? It seems to cover the same things ? Phil - 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]
Re: reload log4j.properties on-the-fly?
At 06:42 PM 1/21/2005 -0500, you wrote: Also keep in mind that Log4J has a JMX API that lets you configure it on the fly from the web, remotely, ... http://logging.apache.org/log4j/docs/api/org/apache/log4j/jmx/package-summary.html Except that the JMX stuff has been removed from Log4j-1.3 because there was no one maintaining it... http://cvs.apache.org/viewcvs.cgi/logging-log4j/src/java/org/apache/log4j/jmx/?hideattic=0 There has been some interest on the list for documenting this stuff, so it may come back. More interest will make it even more likely to come back. Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ?? Sharing the JSTL JARS and Classloading ??
Not all libraries are written in a way that allows for them to be used from different webapps. Struts has a statement on this written by Craig McClanahan, but I can't find it at the moment. The gist of it is that Struts (at least with 1.1) cannot be guaranteed to work properly if placed in a shared classloader. One example of where this might be problematic is with non-final static variables. If it they get changed by one app, the other app sees the change. Usually, this is not the desired behavior as it will make each app using the shared library behave in unpredictable ways. Anyhow, what error are you getting when you add the library to the shared classloader? I haven't looked at the classloader hierarchy in Tomcat for a little while, but it is possible that shared/lib cannot see common/lib, and if there are libraries that standard.jar and jstl.jar depend on libraries that exist in common/lib, then you might get the error you are seeing. Jake At 01:24 AM 1/22/2005 -0600, you wrote: Hi all, I'm using TC 5.0.30. JSTL Is working fine -- I have the standard.jar and jstl.jar files in my WEB-INF/lib directory. The problem is that I have several web applications that use JSTL and therefore several WEB-INF/lib directories. Rather than copy the aforementioned JAR files to *every* WEB-INF/lib directory I'd rather put them in one central location and have them available for *ALL* web applications. According to the crappy Tomcat documentation that's never updated, I should be able to put the JARs in $CATALINA_HOME/shared/lib. Unfortunately, that doesn't seem to work with these two JARs for some reason. Instead, I have to put them in $CATALINA_HOME/common/lib (which seems to work, for some reason). Why can't I just put these two JARs in $CATALINA_HOME/shared/lib and have them shared across all web applications, as the Tomcat documentation on Classloading indicates I should be able to? It seems very odd that I can either copy the JARs to every WEB-INF/lib directory *OR* put them in $CATALINA_HOME/common/lib, but not put them $CATALINA_HOME/shared/lib. Thanks - 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]
Re: Commons logging woes in Tomcat 5.x
Quoting [EMAIL PROTECTED]: To answer the 2nd part of my own question: There seems to be some classloading trickery (ie special treatment for commons logging Log class) if a log4j jar (or a commons-logging.properties) is found in the web app classpath (WEB-INF\lib/classes) It's not really trickery. It is child-first classloading behavior defined by the servlet spec. However, counting on this across platforms is not wise, since other appservers either don't implement child-first behavior or implement it, but specify normal Java2 parent-first behavior as the default. Jake But part 1 still stands... -Nick Extranet Nick MINUTELLO/UK/EUROPE/[EMAIL PROTECTED] - 18/01/2005 19:55 Please respond to tomcat-user@jakarta.apache.org To:tomcat-user cc: Subject:Commons logging woes in Tomcat 5.x Unless I am missing something, it seems to me that commons-logging-api.jar is loaded by the JVM AppClassLoader (ie the root classloader) There are two implications of this: The first is that tomcat itsself will only ever delegate to JDK1.4 logging as the commons-logging-api.jar has no log4j delegation classes The second, more serious, seems be that any web application (and libraries thereof) using commons logging will use the same commmons logging configuration as tomcat - and will also only delegate to JDK1.4 logging :-( Is there a way around this that I am missing? Have I correctly understood the behaviour? Cheers, Nick This message and any attachments (the message) is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. ** BNP Paribas Private Bank London Branch is authorised by CECEI AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Securities Services London Branch is authorised by CECEI AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Fund Services UK Limited is authorised and regulated by the Financial Services Authority. - 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]
Re: Commons logging woes in Tomcat 5.x
At 01:44 AM 1/19/2005 +, you wrote: Hmm, is that all? I understand the parent-first/last classloading strategies that different appservers have... However, the behaviour I observe is that depending on whether I have *log4j* in the web-inf/lib (or commons-logging.properties in classes) then the commons-logging Log instance I get will have been loaded by completely different classloaders (root vs webapp). No configuration of commons logging - the Log class's classloader is the JVM AppClassLoader If I configure commons-logging successfully to use log4j, then the Log class's classloader is the webapp classloader... Maybe there is some trickery going on in the commons-logging LogFactory. I can't argue with you there. commons-logging is all about classloader trickery (quackery?). I guess I thought you were talking about something else when I answered before. This is where the UGLI API, being introduced along with the Log4j-1.3 release comes in. It provides a common logging interface to avoid dependency on any particular logging implementation, but does so by using jar's with hardwired logging implementations. For instance, ugli-jdk14.jar, ugli-simple.jar (system.out), ugli-nop.jar (no logging), and log4j.jar (Log4j actually implements the UGLI API directly in 1.3). When this comes out officially, I highly recommend the move away from commons-logging. Jake -Nick Extranet [EMAIL PROTECTED] - 18/01/2005 22:54 Please respond to tomcat-user@jakarta.apache.org To:tomcat-user cc: Subject:Re: Commons logging woes in Tomcat 5.x Quoting [EMAIL PROTECTED]: To answer the 2nd part of my own question: There seems to be some classloading trickery (ie special treatment for commons logging Log class) if a log4j jar (or a commons-logging.properties) is found in the web app classpath (WEB-INF\lib/classes) It's not really trickery. It is child-first classloading behavior defined by the servlet spec. However, counting on this across platforms is not wise, since other appservers either don't implement child-first behavior or implement it, but specify normal Java2 parent-first behavior as the default. Jake But part 1 still stands... -Nick Extranet Nick MINUTELLO/UK/EUROPE/[EMAIL PROTECTED] - 18/01/2005 19:55 Please respond to tomcat-user@jakarta.apache.org To:tomcat-user cc: Subject:Commons logging woes in Tomcat 5.x Unless I am missing something, it seems to me that commons-logging-api.jar is loaded by the JVM AppClassLoader (ie the root classloader) There are two implications of this: The first is that tomcat itsself will only ever delegate to JDK1.4 logging as the commons-logging-api.jar has no log4j delegation classes The second, more serious, seems be that any web application (and libraries thereof) using commons logging will use the same commmons logging configuration as tomcat - and will also only delegate to JDK1.4 logging :-( Is there a way around this that I am missing? Have I correctly understood the behaviour? Cheers, Nick This message and any attachments (the message) is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. ** BNP Paribas Private Bank London Branch is authorised by CECEI AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Securities Services London Branch is authorised by CECEI AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Fund Services UK Limited is authorised and regulated by the Financial Services Authority. - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands,
Re: META-INF/context.xml TC 5.5.4 deployment problems
At 09:42 AM 12/29/2004 -0800, you wrote: Hi, I have been trying to deploy my app into 5.5.4 using a META-INF/context.xml file type config. The application is deployed according to the log; there are no errors. When I access it, I receive a 404 error, none of the JSPs respond. I have tried various combinations of path and docBase and have followed the documention but no success. I find this stuff very difficult to debug. So far, I have resisted putting the Context section into the server.xml since the documentation says to avoid that. Have you read the docs for 5.5.x? There is no path anymore. This is given by the name of the file when it gets copied to CATALINA_HOME/conf/localhost. The docbase would be something like either myapp.war or myapp. How do you configure a 5.5.4 application in a context to log to its own log file like the Logger .../ setup in TC 4.1. Use Log4j. Search for messages from me on this topic. I won't repeat it here. Jake Any suggestion would be greatly appreciated. Regards, - 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]
Re: JSP under /WEB-INF folder
Quoting Koon Yue Lam [EMAIL PROTECTED]: Hi Hassan , yes, the .js and .css are externally-accessible, but the .jsp aren't so my jsp can't refer to those .js and .css Huh? Why would you say that? Let's say I have the following structure... myapp /assets /style/my.css /script/my.js /WEB-INF web.xml /jsp/my.jsp And my.jsp looks like... html head link rel=Stylesheet href=assets/style/my.css type=text/css script src=assets/script/my.js type=text/javascript/script titlemock jsp/title /head body h1Hello World/h1 body /html So, what's the problem? The link and script locations are loaded by the browser and have no relation whatsoever to the actual location of your JSP. Keep in mind that the only way you can provide this JSP for viewing is to do a server-side forward to it. Web page resources and links will be resolved relative to the path of the URL in your browser location bar. Note that this wouldn't be strictly true if you redirected to the JSP resource, but this is impossible in this case because you can't redirect to a resoruce existing within WEB-INF because the browser client has no access to it, only the server does. In any case, you can always make the resource URL's relative to the root of the application by doing /myapp/assets/script/my.js. and after viewing this thread, I think I would take QM approche but u mentioned I can put all jsp into one folder and protect it. How? Is it a web container level or OS level protection ? The *only* valid reason I can see for not putting JSPs (not meant for direct viewing) under WEB-INF is lack of server support for it. However, any modern server worth its salt now supports this. If yours doesn't, you might want to think about changing vendors or, at least, upgrading your version to one that supports this feature. My rule of thumb is to put JSP that are not meant for direct viewing (only forwarding to from a controller servlet) under WEB-INF and jsp's that are meant for direct viewing outside of WEB-INF. You get the security for free! Why one would bother with needless extra security configuration is beyond me. And what if you forget or configure it wrong? Jake Regards On Sun, 26 Dec 2004 08:45:00 -0800, Hassan Schroeder [EMAIL PROTECTED] wrote: Koon Yue Lam wrote: Hi, I want to protect my JSP from direct access, so they can only access by Struts action. but If I want to include some Javascript or CSS to a JSP, I can't ! Because .js and .css needed to place directly under WebRoot I'm afraid I don't understand the issue. If you're putting your JS and CSS in an externally-accessible place (maybe /scripts and /styles) then the standard HTML references for external resources: link rel=stylesheet type=text/css href=/styles/example.css/ style type=text/css@import /styles/example.css;/style script type=text/javascript src=/scripts/example.js/script :: will work fine. The client UA can access them directly (and cache them, which is usually a desirable behavior). HTH, -- Hassan Schroeder - [EMAIL PROTECTED] Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com dream. code. - 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]
Re: JSP under /WEB-INF folder
Quoting Hassan Schroeder [EMAIL PROTECTED]: Koon Yue Lam wrote: yes, the .js and .css are externally-accessible, but the .jsp aren't so my jsp can't refer to those .js and .css Of course they can; most of my sites work this way. Your JSP is sending HTML to *the client UA* with the URL of the CSS and JavaScript files -- it's the UA that retrieves them. and after viewing this thread, I think I would take QM approche but u mentioned I can put all jsp into one folder and protect it. How? Is it a web container level or OS level protection ? From a previous thread, it seems that one container (BEA, per Wendy Smoak) doesn't support forwarding to JSPs under WEB-INF. Sure, 6.1 didn't. 8.1 certainly does. I've tried it and it works just fine. Time to upgrade to a modern container. Perhaps the ambiguity in the spec will be resolved next time around. But since I have no current plans to use anything but Tomcat, the portability argument carries no weight here -- I put my JSPs in WEB-INF and let the container provide the protection. No fuss, no muss :-) Exactly. Jake FWIW! -- Hassan Schroeder - [EMAIL PROTECTED] Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com dream. code. - 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]
Re: JSP under /WEB-INF folder
Quoting Koon Yue Lam [EMAIL PROTECTED]: ok, it is really strange that I need to specify full path /myApp/js/myJS.js rather then just js/myJS.js but if I use full path , everything works fine I am using Tomcat 5.028 with Struts 1.1 The server does not matter. The application framework does not matter. What matters is the URL you are accessing. What is the URL in the location field of your browser? Using relative js/myJS.js means that the URL you are accessing must be at the root of your context path (be it / or /myApp). For instance, if your js directory is at the root of your context, then the following URL would allow the relative path to work... http://localhost:8080/myApp/hello.do Because hello.do is accessed from the root of the context, the relative path to the .js file would be... http://localhost:8080/myApp/js/myJS.js Note that this is identical to specifying the absolute path of /myApp/js/myJS.js. However, the relative path will stop working if your URL goes one directory into your app while the absolutely defined one will continue to work... http://localhost:8080/myApp/somdir/hello.do now your relatively defined path to the .js file would resolve to... http://localhost:8080/myApp/somedir/js/myJS.js If you want to not have to worry about stuff like this, use an absolute path. Don't hardcode the name of your context, though. Use... script src=%=request.getContextPath()%/js/myJS.js type=text/javascript/script Struts has some JSP taglibs to help out with this so you don't necessarily have to use a scriptlet like this everywhere, so look into that, but this gives you the gist of what you need to do to make sure your web resources can be accessed no matter the path of the current URL. Jake thanks for all the help Regards On Wed, 29 Dec 2004 01:08:31 +0800, Koon Yue Lam [EMAIL PROTECTED] wrote: Thanks for all the reply, I will try it out tonight and let u all know the result ^^ Regards On Tue, 28 Dec 2004 18:52:37 +0200 (EET), [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Laba diena. Dėkojame, kad mums parašėte. Jūsų atsiųsta žinutė išsaugota mūsų duomenų bazėje. - 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]
Re: web.xml uses non-validating xml?
Quoting D. Stimits [EMAIL PROTECTED]: Peter Crowther wrote: From: D. Stimits [mailto:[EMAIL PROTECTED] I'm trying to debug something, and the individual webapps/myapp/WEB-INF/web.xml file seems to be a bit of an enigma to me. [...] I went to the DTD's to see what was written there. Initially I used this DTD: !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.2//EN http://java.sun.com/j2ee/dtds/web-app_2_2.dtd; ...shock and surprise...resource-env-ref is not even in the DTD. [...] Incidentally, this tag is properly described in http://java.sun.com/dtd/web-app_2_3.dtd. Which version of Tomcat are you using, and how did you choose the DTD against which to validate? Different versions implement different revisions of the servlet spec, and it's very likely that you're using a sufficiently recent version of Tomcat that the 2.3 or 2.4 specs are implemented. Tomcat is version 5.0.30, originally I just copied from a blank struts app set of files, which used the 2.2 DTD. Regardless of which DTD's tomcat supports under 5.0, it seems to be a bug that it ignores the stated DTD and gives no error or warning that a tag is being used that the DTD does not know anything about. Now if a DTD version stated in the web.xml file is not supported by tomcat, I'd expect an error be generated there as well. I think you have to set validating to true in server.xml. Otherwise, the file is parsed in a non-validating fashion. Sorry, don't remember exactly where you set this, but I do seem to recall something like this. It's probably on the Host tag, but I'm not sure. Check the docs. Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSP under /WEB-INF folder
Your problem is almost certainly the base tag. Why do you have it there? The href in base will skew the way the browser looks at relative paths and make it so that they are not resolved to the URL in the location bar of the browser, but to the URL in the href of the base tag. Besides, the location makes no sense. You are pointing to a resource under WEB-INF which is impossible for a browser to access in the first place. Remove base and your problems are (mostly) solved. More below... At 10:13 AM 12/29/2004 +0800, you wrote: Hi again ! ^^ here is the generated html: html lang=en head base href=http://localhost:8080/val/WEB-INF/jsp/residential_search.jsp; titleResidential Search/title script src=/val/js/resid.js type=text/javascript/script script ... ... ... which is using absolute path so no problem here, but if I use relative path: script src=/js/resid.js type=text/javascript/script Was that a typo? You are calling this a relative path, but /js/resid.js is using an absolute path. Probably just a typo, but I want to make sure you understand what you are saying here. More below... then I can reference the .js and here is the directory structure: {Tomcat home}/webapps/val | /js | /WEB-INF |--- /jsp (-- which holds all my .jsp) and the url in the browser is: http://localhost:8080/val/area_selection.do so the /js is directly under the root folder, and script src=/js/resid.js type=text/javascript/script should work, isn't it?? Ok, I guess you actually don't know what a relative path is because you keep making the same typo. You have two problems: 1. Remove the base tag. Never, ever use that abomination unless you have a REALLY good reason to do so. Based on how you are using it, I'm not even sure you understand what it does? 2. A relative path does *not* have a / prefix. That is an absolute path pointing to the root of the webserver. Based on the sample URL, your context is /val. As such, using /js/resid.js would look for the .js file in a directory at the same level as val, meaning it won't find the js directory underneath val. Here's where /js/resid.js would point... http://localhost:8080/js/resid.js That's, obviously, not what you want. Do one of two things (assuming you've removed the base tag already!) 1. Use the absolute path /val/js/resid.js 2. Use the relative path js/resid.js Either one will work. The reason to use #2 is that you don't have to hardcode the context path. The reason to use #1 is if you expect to be accessing your area_selection.do struts action at some directory level deeper into your context path. Take, for instance... http://localhost:8080/val/admin/area_selection.do Now if you are using #2, the browser would look in the following location for the .js resource... http://localhost:8080/val/admin/js/resid.js That's, obviously, not what you want. However, if you had used #1, you wouldn't have noticed a difference in functionality because it would look in the same location for the .js file as it did when area_selection.do wasn't under the admin directory. This is the freedom that absolute paths provide. However, be careful not to hardcode the name of your context (as I mentioned in another email) because the context name might change. If and when it does, your absolute path will cease to work. So, in a JSP, use %=request.getContextPath()%/js/resid.js Now you have an absolute path that will work no matter the URL in the browser location bar. Plus, if you ever decide to switch context names, or use the default context which is an empty path, your resource will continue to be found with no need for code changes. but now it seems I can only use absolute path, which is not a very big deal but it would be nice if someone help me to sort it out . ^^ Redux: Absolute path examples... /myapp/js/my.js http://localhost:8008/myapp/js/my.js; relative path example, assuming the URL is something like http://localhost:8008/myapp/hello.do and the js directory is in the root of the context... js/my.js Notice the lack of the prefixed / in the latter example. thanks I really do hope you understand this stuff after my explanation above. It took me a while to type. I hope it was worth it! Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JSP under /WEB-INF folder
Yay! That's what I was hoping to hear :-) Jake At 02:10 PM 12/29/2004 +0800, Koon Yue Lam wrote: YES !!! Everything works fine now after remove the base tag and correct the typo !! I want to give my deepest thanks to you for helping me out with such great effort Regards - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 5 startup crash, please help
A stack trace or some other error report would help. It's a bit vague when you simply describe it. Show the evidence and you will be more likely to get assistance. Jake At 06:54 AM 12/29/2004 +0100, you wrote: Hello, I am desperate, for I have been trying to find a solution to this problem for two weeks now. Can anybody help me with this? Tomcat 5 crashes as it is starting up using jsvc. It does not crash if I start Tomcat 5 as a regular application. It could be connected to struts and database connections, since it seems to be starting fine until the applications initialize the connections. Any hint or help is very much appreciated Michael Kastner - 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]
Re: Log issues in Tomcat 4.1
At 11:38 AM 12/23/2004 +0530, you wrote: Hi All, In one of my production we are using Tomcat 4.1. Problem is if we didnt restart the tomcat services for 1 month thne log size of STDout.log become more then 1 GB. I know we can reduce that by avoiding System.out.println. But we need that to get the root cause of some issues which are data related. Is there another way by which we can reset thew log file daily or Tomcat create new log files without restarting the Tomcat services . If you run as a service, you could use the latest Tomcat service that comes with versions 5.0.xx and 5.5.x. The latest one rolls stdout for you on a daily basis. It'll be up to you to see if the Tomcat service in more recent versions works with Tomcat-4.1. Jake Thanks and regards, Pradeep Chauhan DISCLAIMER: This message, including any attachments contains confidential and privileged information for the sole use of the intended recipient(s), and is protected by law. If you are not the intended recipient, please destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email or any action taken in reliance on this e-mail is strictly prohibited and may be unlawful. Indus and R Systems International Ltd reserves the right to record, monitor, and inspect all email communications through its internal and external networks. Your messages shall be subject to such lawful supervision as Indus and R Systems International Ltd deems necessary in order to protect its information, interests and reputation. Indus and R Systems International Ltd prohibits and takes steps to prevent its information systems from being used to view, store or forward offensive or discriminatory material. - 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]
Re: tomcat 5.5 and jndi context naming error
There should be away around this type of issue. I believe Tomcat already actively avoids loading java, javax, org.xml, org.w3c.dom, org.apache.xerces packages from WEB-INF/lib (I hope my memory isn't failing me here). Given this, maybe Tomcat should endorse certain core libraries so that they won't be accidentally loaded from WEB-INF/lib, thus avoiding this issue altogether? Jake Quoting Ken Hall [EMAIL PROTECTED]: I've been trying out many different avenues to make this work and finally found the following bug, hopefully this will save other people some time: http://www.mail-archive.com/tomcat-dev@jakarta.apache.org/msg64410.html which says: And finally i find the solution,that is to remove all Naming-*.jar out from /%myapp_home%/WEB-INF/lib.I firmly think there's some disorder with tomcat classloader.In other words,ClassLoader may not check which class to be loader first and which to be loaded second and which have already be loaded! -Ken From: Ken Hall Sent: Thursday, December 16, 2004 3:41 PM To: '[EMAIL PROTECTED]' Subject: tomcat 5.5 and jndi context naming error Since downloading the new version of Tomcat 5.5.4, I have been experiencing problems with jndi resources within my web app. I am porting over from an existing server where that resource is working. The error is listed at the bottom. I saw in the release notes that naming-common.jar (JNDI Context implementation) is one of the required files but it does not appear to be included in the download. When I include it from a previous release, it appears to not like it. When I leave it out, it can not find the jndi context either. java.lang.NoSuchMethodError: org.apache.naming.NamingContextBindingsEnumeration. init(Ljava/util/Iterator;)V at org.apache.naming.resources.FileDirContext.listBindings(FileDirContex t.java:335) at org.apache.naming.resources.ProxyDirContext.listBindings(ProxyDirCont ext.java:515) at org.apache.catalina.util.ExtensionValidator.validateApplication(Exten sionValidator.java:178) at org.apache.catalina.core.StandardContext.start(StandardContext.java:3 934) Here is my set up. Any help is greatly appreciated. I can't do anything with this release till this is solved. Thanks! -Ken Hall According to the docs, the preferred method is not messing with the server.xml but creating an application.xml. I've tried both name value pairs and resource parameters. This is done and placed in the conf\Catalina\localhost directory: ?xml version='1.0' encoding='utf-8'? Context docBase=c:/jakarta-tomcat-5.5/webapps/myapp path=/myapp workDir=work\Catalina\localhost\myapp Resource auth=Container name=jdbc/myapp type=javax.sql.DataSource/ ResourceParams name=jdbc/myapp parameter namemaxWait/name value5000/value /parameter parameter namemaxActive/name value6/value /parameter parameter nameusername/name valuexx/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter namepassword/name valuexx/value /parameter parameter nameurl/name valuejdbc:jtds:sqlserver://server:1433/myapp/value /parameter parameter namedriverClassName/name valuenet.sourceforge.jtds.jdbc.Driver/value /parameter parameter namemaxIdle/name value2/value /parameter /ResourceParams /Context In my app's web.xml I have: /servlet-mapping resource-ref res-ref-namejdbc/myapp/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref welcome-file-list My application is referencing the context like this: InitialContext initContext = new javax.naming.InitialContext(); Context envContext=(Context)initContext.lookup(java:comp/env); DataSource ds = (DataSource)envContext.lookup(jdbc/myapp); //Error upon calling context SEVERE: Null component Catalina:type=DataSource,path=/myapp,host=localhost,class=javax.sql.Data Source,name=jdbc/myapp Unable to connect to myapp database. Class Not Found.Name java:comp is not bound in this Context javax.naming.NameNotFoundException: Name java:comp is not bound in this Context at org.apache.naming.NamingContext.lookup(NamingContext.java:768) at org.apache.naming.NamingContext.lookup(NamingContext.java:151) at javax.naming.InitialContext.lookup(InitialContext.java:351) at my.load.servlet at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.jav a:1053) at
RE: log file by Logger ..... / for application context
At 07:58 AM 12/23/2004 +0200, you wrote: No one here have any Idea regarding my problem. What exactly is it about 5.0.19 that you are tied to? If your Logger works in 5.0.27 but doesn't work in 5.0.19, then there is something wrong with 5.0.19 and you probably shouldn't be using it. Jake -Original Message- From: Goel, Manish Kumar Sent: Wednesday, December 22, 2004 4:58 PM To: Tomcat Users List Subject: RE: log file by Logger . / for application context Thanx for replying, but requirement is such that I have to use tomcat 5.0.19. it's impossible to port the project on other version of tomcat now. any help regarding this pls. thanx in advance Manish -Original Message- From: Allistair Crossley [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 22, 2004 4:51 PM To: Tomcat Users List Subject: RE: log file by Logger . / for application context Hi, Don't use 5.0.19. Why do you want that? Allistair. -Original Message- From: Goel, Manish Kumar [mailto:[EMAIL PROTECTED] Sent: 22 December 2004 10:39 To: Tomcat Users List Subject: log file by Logger . / for application context Hi All, problem for creating the separate log file by Logger . /for my application context in tomcat-5.0.19. that is working fine in tomcat 5.0.27! please help me what the settings are to be needed to make it out on tomcat 5.0.19 . is this bug or AM I missing some thing sample of my context file which is under ..conf\Catalina\localhost\ Context displayName=SMART debug=0 docBase=Smart path=/Smart Logger className=org.apache.catalina.logger.FileLogger directory=webapps/smartlogs prefix=Smart_log. suffix=.txt timestamp=true/ . .. Context/ regards Manish ** * Information contained in this email message is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the [EMAIL PROTECTED] and destroy the original message. ** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLUE --- QAS Ltd. Developers of QuickAddress Software a href=http://www.qas.com;www.qas.com/a Registered in England: No 2582055 Registered in Australia: No 082 851 474 --- /FONT - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] *** Information contained in this email message is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the [EMAIL PROTECTED] and destroy the original message. ** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] *** Information contained in this email message is intended only for use of the individual or entity named above. If the reader of this message is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the [EMAIL PROTECTED] and destroy the original message. ** - 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
Re: Tomcat 5.5 classloading blues
Quoting Andreas Vombach [EMAIL PROTECTED]: Hello, I'm new to the list and did not read this thread from the beginning but also use tapestry (3.0) on tomcat. I keep tapestry-3.0.jar and tapestry-contrib-3.0.jar in the lib dir of the (to be deployed) war file, the rest goes to /shared/lib except xercesImpl.jar and xml-apis.jar which go in /common/endorsed (very special case) The classloading problem I ran into was on the dbms side, jdbc drivers should go into /common/lib if you want to use pooling because the dbcp stuff resides here. The class.forName() call is mostly the reason for these troubles because it relies on the current classloader ... Which is why you should always do.. Class.forName(com.mypackage.SomeClass, true, Thread.currentThread().getContextClassLoader()); Jake Cheers Andreas - 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]
Re: Tomcat 5.5 classloading blues
At 01:11 AM 12/20/2004 +, you wrote: Still remembering earlier bruises setting up Tomcat I try to run as plain vanilla as possible. Fedora Core 3, Tomcat 5.5.4 Java 5 installed with rpm's Everything ran great. I got Tapestry examples working fine. And then based on working web apps, I moved some of the Tapestry jars into shared/lib. All of a sudden the classloader couldn't find ServletInputStream. That's a bit bizarre Then I realised that I needed to install commons logging and log4j to get proper logging, so I put them in commons as described. Now I get a NoClassDefFound on LogFactory instead. Did you put commons-logging.jar (*not* commons-logging-api.jar) along with logj4-jar in common/lib? And did you make sure you webapp doesn't contain another copy of commons-logging.jar in WEB-INF/lib? 1) The logging guide advises to put the jars in commons, why not put them in server/lib and in the invidual WEB-INF/lib to get per webapp log files and no risk of classloading issues ? First, this assumes that the server applies child-first classloading behavior which is recommended by the servlet spec, but not mandated. Tomcat implements this, and I actually like that it does, but most other servers I know of either don't provide for it or provide it as a non-default option. This means that putting your logging jars in WEB-INF/lib does not guarantee per-webapp log files unless you stick to Tomcat. This can be better accomplished by using a repository selector in Log4j (especially when Log4j-1.3 is released as it makes usage of such selectors much easier). http://wiki.apache.org/logging-log4j/AppContainerLogging 2) Am I just stupid to attempt to use shared/lib rather than just sticking everything in the war file ? This is a nice little piece on the subject. I think you can extrapolate this to any framework or library, not just Struts... http://struts.apache.org/userGuide/configuration.html#config_add 3) Where can I find a list of the jar's present in server/lib commons/lib shared/lib in a fresh install ? Just grab a zipped or gzipped copy and look for yourself. Jake 4) Is JMX tools to manage Tomcat the way forward ? Thanks for any comments, Henrik - 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]
Re: log4j and tomcat 5.5
At 03:17 PM 12/16/2004 -0500, you wrote: On Thu, Dec 09, 2004 at 04:33:33PM -0600, Jacob Kjome wrote: For your own app, do you use actually use the commons-logging api or just the Log4j api? If the latter, don't bother with commons-logging. In fact, try to avoid it like the plague. Could you expand on this? I've wondered in the past about this very question (whether I should code my app to use commons-logging for logging, or directly use log4j) and I'm interested in hearing what the downsides are. This has been covered many times. Here are some good references... http://marc.theaimsgroup.com/?l=log4j-userm=102640868804904 http://marc.theaimsgroup.com/?l=log4j-userm=103864746403401w=2 http://www.qos.ch/logging/thinkAgain.jsp Commons Logging was my fault http://radio.weblogs.com/0122027/2003/08/15.html I've said it before, I'll say it again, I wish there was some sort of tomcat production hosting best practices repository. Maybe a wiki page or something. Or maybe I'll just invite people to send me suggestions for such a page. Try the docs or the apache wiki http://wiki.apache.org/jakarta-tomcat/FrontPage Jake -- Steven J. Owens [EMAIL PROTECTED] I'm going to make broad, sweeping generalizations and strong, declarative statements, because otherwise I'll be here all night and this document will be four times longer and much less fun to read. Take it all with a grain of salt. - http://darksleep.com/notablog - 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]
Re: webapp's log4j config acting wonky
Quoting Mike Curwen [EMAIL PROTECTED]: Hi all, I've been using log4j for some time and like it quite a bit. My configs are probably naieve, but they work for me. But now, another developer has pointed something out to me, and yup.. something's busted. I'm posting this to tomcat-user because I'm thinking it might be a TC/mywebapp conflict of some kind (though I'm not sure where). Tomcat 5.0.29 log4j 1.2.1 in my webapp's WEB-INF/lib You should upgrade. You very well may be running into bugs in early versions of 1.2.x. Upgrade to 1.2.9, the current release and test again. log4j.properties in my webapp's WEB-INF/classes directory. I don't have log4j.jar anywhere else and no other log4j.properties files anywhere, though perhaps I don't know where to look. One way to check is to remove log4j.properties from WEB-INF/classes and see if autoconfiguration happens. You would know this by seeing messages from Log4j saying something like there are no appenders configured for this logger. If you don't see messages like that, then Log4j is finding a config file somewhere else. Log4j looks in the default package (no package) for config files. If a config file were in a jar file, it would be in the root of the jar file. In our JSP pages we have loggers declared like so: %@ page import=org.apache.log4j.Logger % %! Logger logger = Logger.getLogger(pages.abc.page_name); % % logger.debug(foo); % pages is common throughout every JSP. abc would be a folder name (we've got the webapp organized into folders of related functions), and finally page_name is the name of the JSP file without extension. our log4j.properties file is: #log4j.properties log4j.rootCategory=DEBUG, filer log4j.category.com.gb.security=WARN, filer log4j.additivity.com.gb.security=false log4j.appender.filer=org.apache.log4j.RollingFileAppender log4j.appender.filer.layout=org.apache.log4j.PatternLayout log4j.appender.filer.layout.ConversionPattern=%-5p %c - [%m] %d{ISO8601}%n log4j.appender.filer.File=/path/to/the/log/file/debug.log log4j.appender.filer.MaxFileSize=100KB log4j.appender.filer.MaxBackupIndex=4 As you'll see we've got the root category to DEBUG and we've piped down our com.gb.security package to WARN. We've got lots of other classes, both bundled in WEB-INF/lib jar files and loosely in the WEB-INF/classes and they all spill their log4j output. But none of our log messages from the JSP pages are coming through. I've tried the following config, but it had no effect: log4j.category.pages=DEBUG, filer log4j.additivity.pages=false *If* I configure the following (adding a 'package' below 'pages'): log4j.category.pages.abc=DEBUG, filer log4j.additivity.pages.abc=false Then it will work (but obviously only for pages under 'abc'). Also, if I remove the additivity, I get two messages. That makes me think there's one message from the rootCategory, and one from this category. But when I remove the category 'pages.abc' entirely, we're back to nothing again. Any ideas? Is there a TC log4j or CL file hiding somewhere? If changes to your config file are being recognized, then it probably isn't a problem with Log4j using some other config file. I don't know why your original config wouldn't work. It really should. One note. You shouldn't be using rootCategory and category, but rootLogger, and logger. Also, additivity is only necessary when you are trying to log to a different appender than those of the current logger is inheriting. Since you've specified the filer appender to the root, you can simply define the level you want to reset your named logger to rather than also supplying the filer appender and setting additivity to false. Oh, one other thing. I don't know for sure whether order is important in properties files, but you might define your appenders first and loggers last with the rootLogger last. In Log4j XML config files, order is important and enforced by the dtd (which is not necessary to use with Logj4-1.3, not yet released, at least non-alpha). Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 5.5 Webapp logging.
So, you want System.out stuff to go to the stdout, is that right? Just set up a console appender. Note that if you want to log to Tomcat's specially named localhost and context loggers, you'll need to use a log4j.properties file rather than log4j.xml because the naming pattern violates the XML spec's naming scheme for attributes of type ID. This is only true for Log4j-1.2.x. In Log4j 1.3, we no longer use a DOMConfigurator, but the new JoranConfigurator which doesn't use a DTD and, therefore, doesn't define logger name attributes as of type ID. You can define loggers and appenders in a way where Tomcat's info can go to a separate log file than the stdout console or stdout log file. Jake Quoting Dale, Matt [EMAIL PROTECTED]: Hi, We have a 3rd party application which has a nasty habit of chucking out a load of messages to stdout and stderr. Up until tomcat 5 we used a console Logger with swallowOutput turned on to catch all that output so it didnt end up in catalina.out. Obviously in 5.5 this is not possible and Log4J seems to be the way to go. I've tried this but not having much luck. I think it's just that I don't understand the log4j.properties file. Could someone perhaps post a sample that would do roughly what I need and I can tweak it from there. Ta Matt - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat 5.5 Webapp logging.
Quoting Dale, Matt [EMAIL PROTECTED]: This sounds like kind of what I want but you've confused me. I basically want the System.out and stdout from a particular webapp to go to a specific log file that is rotated and seperate for each webapp. I'm not sure how you would separate System.out from any individual app. If you run Tomcat-5.5.x as a service (at least on WinXP, which is what I use currently), it will automatically write to a stdout.log file *and* give you daily log rotation for free. I've now got log4j working with a log4j.properties in common/classes. Everything is now logged to a rotated log file which is hunky dorey from that point of view. My second requirement is that the webapps be seperated into different log files. This, i've had trouble with, i've placed a log4j.properties in WEB-INF/classes but it seems to be ignored (log4j.jar is in the WEB-INF/lib). If you mean System.out output, then there isn't much you can do with the standard console appender. It will all go to one place. However, your normal log4j defined loggers should be working according to your properties file. log4j.properties in WEB-INF/classes with log4j.jar in WEB-INF/lib should create a separate logging environment from the server for each webapp you do this with. I could seperate things out in the the main log4j.properties but at least one of the apps is comprised mostly of jsps without a specific package so i'm unsure how to do this. You can still name your JSP's according to some psuedo-package naming scheme. Loggers aren't tied to your packages. This is just the standard way of naming loggers to make naming predictable and easy to confgure. Name them whatever you want. But where you've really confused me is the mention of log4j.xml, this is the first i've seen on it. Could you perhaps tell me where it goes and point me to something that can help me decide what to put in it? So, you didn't realize that Log4j could be configured using an XML config file? Well, it can. However, the DTD for Log4j prevents using Tomcat's host and context logger names for the reasons I stated (which, again, is not longer an isssue in Log4j-1.3 because the DTD is not used anymore). For instance, the following is illegal because the name attribute is defined by the DTD as of type ID and the [ and ] are illegal characters... logger name=org.apache.catalina.core.ContainerBase.[Catalina].[localhost] /logger If you are unaware of this naming scheme, see the Tomcat-5.5.x docs. The alternative is to use a properties file and use... log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost] In short I could do with a bit more detail if you wouldn't mind. Hopefully that cleared things up a little bit. Jake Ta Matt -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: 09 December 2004 16:55 To: Tomcat Users List Subject: Re: Tomcat 5.5 Webapp logging. So, you want System.out stuff to go to the stdout, is that right? Just set up a console appender. Note that if you want to log to Tomcat's specially named localhost and context loggers, you'll need to use a log4j.properties file rather than log4j.xml because the naming pattern violates the XML spec's naming scheme for attributes of type ID. This is only true for Log4j-1.2.x. In Log4j 1.3, we no longer use a DOMConfigurator, but the new JoranConfigurator which doesn't use a DTD and, therefore, doesn't define logger name attributes as of type ID. You can define loggers and appenders in a way where Tomcat's info can go to a separate log file than the stdout console or stdout log file. Jake Quoting Dale, Matt [EMAIL PROTECTED]: Hi, We have a 3rd party application which has a nasty habit of chucking out a load of messages to stdout and stderr. Up until tomcat 5 we used a console Logger with swallowOutput turned on to catch all that output so it didnt end up in catalina.out. Obviously in 5.5 this is not possible and Log4J seems to be the way to go. I've tried this but not having much luck. I think it's just that I don't understand the log4j.properties file. Could someone perhaps post a sample that would do roughly what I need and I can tweak it from there. Ta Matt - 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]
Re: log4j and tomcat 5.5
Are you trying to enable logging for Tomcat, your webapp, or both? You will need to add both log4j.jar and commons-logging.jar (not commons-logging-api.jar) to common/lib to enable Log4j logging for Tomcat-5.5.x itself. For your own app, do you use actually use the commons-logging api or just the Log4j api? If the latter, don't bother with commons-logging. In fact, try to avoid it like the plague. If you do require commons-logging for your webapp logging, I'm not entirely sure whether it is ok to have log4j.jar in WEB-INF/lib and commons-logging.jar in common/lib or if they have to be together. There could be classloader issues if you separate them. I'm not really sure. commons-logging issus are outside the scope of my knowledge. Jake Quoting Marcelo Moreira [EMAIL PROTECTED]: Hello, This is sure a newbie question, but I have been having a lot of trouble trying to get logging to work on tomcat 5.5 with log4j. I got everything working (I think...) but I have been wondering about something... Would anybody know why I still have to put a copy of commons-logging.jar + log4j.jar into the webapp WEB-INF/lib directory for logging to work for the webapp, even though it is already in common/lib (so it should be shared by all classes, including webapps, right...) ? Thanks, Marcelo. - 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]
Re: log4j and tomcat 5.5
Quoting Marcelo Moreira [EMAIL PROTECTED]: On Thu, 9 Dec 2004 16:33:33 -0600, Jacob Kjome [EMAIL PROTECTED] wrote: Are you trying to enable logging for Tomcat, your webapp, or both? You will need to add both log4j.jar and commons-logging.jar (not commons-logging-api.jar) to common/lib to enable Log4j logging for Tomcat-5.5.x itself. For your own app, do you use actually use the commons-logging api or just the Log4j api? If the latter, don't bother with commons-logging. In fact, try to avoid it like the plague. If you do require commons-logging for your webapp logging, I'm not entirely sure whether it is ok to have log4j.jar in WEB-INF/lib and commons-logging.jar in common/lib or if they have to be together. There could be classloader issues if you separate them. I'm not really sure. commons-logging issus are outside the scope of my knowledge. Thanks for the answer. I am trying for both. commons-logging.jar + log4j.jar are in commons/lib. But here is the question: I do not see why they also have to be on the webapp WEB-INF/lib, since it should be shared because they are already on commons/lib. If you share the common/lib instance of Log4j with your webapp, you will be using the same logger repository as the application server. There is one configuration per logger repository. If force reconfiguration within this already configured logger repository, your old configuration will be blown away. The idea Putting another copy of Log4j.jar in WEB-INF/lib in addition to the one in common/lib is to take advantage of Tomcat's classloading behavior which is child first (recommended by the servlet spec) rather than parent first (normal Java2 classloading behavior). Because each webapp looks locally for libraries first, it will find an instance of Log4j that is not in use by any other application. Therefore, the default logger repository will be distinct from that of the server and from that of any other webapp. You can configure to your hearts content without stompting on others' logging configuration. There is a way to separate application logging while sharing the same instance of Log4j and that is by using a repository selector. I would avoid this until Log4j-1.3 is released. It is more difficult to use a repository selector in Log4j-1.2. 1.3 makes it very simple. I recommend you use the first solution until Log4j-1.3 is released. If I do not put them in the webapp WEB-INF/lib, logging for the webapp does not work. You are counting on autoconfiguration here. If you have an instance in common/lib, but not one in WEB-INF/lib, the logger repository of the one in common/lib will already have been configured by the time your app is initialized. Autoconfiguration is not performed more than once. Your webapp, in this case, will be using the configuration of the config file at the server level (in common/classes). Again, with a repository selector, your app config could be separated from the default logger repository. Note that in Log4j-1.3 you will need to perform configuration as there is no autoconfiguration, at least via classloader discovery of config files, on non-default logger repositories. As I said, I got it working already, but this is just curiosity. Hopefully I explained things better and piqued your curiosity about repostiory selectors in Log4j-1.3 :-) Jake Thanks, Marcelo. - 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]
Re: Must restart tomcat after putting a jar into common/endorsed?
At 12:34 PM 12/6/2004 +0800, you wrote: Hi, I am using Tomcat 5.0.30 with JDK 1.4.2_05. I notice that if I copy a jar file into CATALINA_HOME/common/endorsed, I have to restart Tomcat for it to take effect. Why? Because classes are loaded once, and only once in a running classloader. Keep in mind that it is possible to restart apps under the appserver because the WebappClassLoader can be discarded and started again. Do that for the server's classloader hierarchy and now you've, essentially, restarted the server. Any library you put in endorsed/lib, common/lib, shared/lib, and the like will only be recognized upon server restart. Keep in mind this is true of any other appserver's global libraries. It is only when the classloader can be discarded that libraries can get reloaded while the rest of the server keeps running. Jake Thanks in advance! - 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]
Re: webapps ROOT folder significance
At 09:46 AM 12/4/2004 -0800, you wrote: Remy you really confused me. Can you elaborate a little more please ? What root.xml file in webapps\ROOT folder ? or jakarta-tomcat-5.5.3\conf\Catalina\localhost folder ? Do you mean a context.xml file in the catalnia\locahost folder ? Yep. But make sure the file name is ROOT.xml, not root.xml. Jake Please clarify. -Narahari Remy Maucherat [EMAIL PROTECTED] wrote: On Sat, 4 Dec 2004 16:25:59 -, Allistair Crossley wrote: In versions prior to 5.5, you could make your own webapp the root context by using an empty path attribute on the Context for your web application. However, in 5.5 you cannot do this and *must* use the ROOT folder for your web application *if* you want the web application accessible from http://server:8080 I would be interested also to hear from the dev team, why a user cannot package a web application with a webapp folder they desire and deploy this as root. Afterall, is forcing the webapp folder name not binding the user to Tomcat? Yes, this is all part of a grand plan to tie users to Tomcat, and take over the world. Call Austin for help, it's the only hope for mankind. Actual solution: write a ROOT.xml file pointing to whatever docBase you want for your webapp (outside of the host appBase), like: -- x Rémy Maucherat Developer Consultant JBoss Group (Europe) SàRL x - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Do you Yahoo!? All your favorites on one personal page Try My Yahoo! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat DEBUG log4j and 5.5.4?
Getting log4j logging running in Tomcat-5.5.x is pretty simple. Here's what you need... 1. Put log4j.jar in common/lib 2. Put commons-logging.jar (not commons-logging-api.jar!) in common/lib 3. Put log4j.xml or log4j.properties in common/classes You'll want to look at the new naming scheme for Host and Context loggers in the 5.5 docs. Note that if you are using log4j-1.2.x, you can't use log4j.xml because of the way the Host and Context loggers are named. They use characters that conflict with what the XML spec defines as allowed characters for an attribute of type ID. What I mean is the logger name attribute, which is of type ID when using the DOMConfigurator. Log4j-1.3 deprecates the DOMConfigurator in favor of the JoranConfigurator which doesn't validate against a DTD, so there is no conflict there. For now, just use the properties format. Here's a sample log4j.properties... log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%-5p[%-8.8t]: %39.39c %-6r - %m%n #log4j.appender.A2=org.apache.log4j.FileAppender #log4j.appender.A2.File=${catalina.home}/logs/stdout.log #log4j.appender.A2.Append=false #log4j.appender.A2.layout=org.apache.log4j.PatternLayout #log4j.appender.A2.layout.ConversionPattern=%-5p[%-8.8t]: %39.39c %-6r - %m%n log4j.appender.LOCALHOST=org.apache.log4j.RollingFileAppender log4j.appender.LOCALHOST.File=${catalina.home}/logs/localhost.log log4j.appender.LOCALHOST.MaxFileSize=1000KB log4j.appender.LOCALHOST.MaxBackupIndex=1 log4j.appender.LOCALHOST.layout=org.apache.log4j.PatternLayout log4j.appender.LOCALHOST.layout.ConversionPattern=%-5p[%-8.8t]: %39.39c %-6r - %m%n log4j.appender.SOMEAPP=org.apache.log4j.DailyRollingFileAppender log4j.appender.SOMEAPP.File=${catalina.home}/logs/localhost_someapp.log log4j.appender.SOMEAPP.DatePattern='.'-MM-dd log4j.appender.SOMEAPP.layout=org.apache.log4j.PatternLayout log4j.appender.SOMEAPP.layout.ConversionPattern=%c{1} %-6r - %m%n log4j.appender.ANOTHERAPP=org.apache.log4j.DailyRollingFileAppender log4j.appender.ANOTHERAPP.File=${catalina.home}/logs/localhost_anotherapp.log log4j.appender.ANOTHERAPP.DatePattern='.'-MM-dd log4j.appender.ANOTHERAPP.layout=org.apache.log4j.PatternLayout log4j.appender.ANOTHERAPP.layout.ConversionPattern=%c{1} %-6r - %m%n log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/someapp]=DEBUG, SOMEAPP log4j.additivity.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/someapp]=false log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/anotherapp]=INFO, ANOTHERAPP log4j.additivity.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/anotherapp]=false log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=INFO, LOCALHOST log4j.additivity.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=false log4j.rootLogger=INFO, A1 Jake Quoting Kevin A. Burton [EMAIL PROTECTED]: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/logging.html Does this actually work? I followed the steps for log4j and it won't work at all. I still get the standard logging. Are there any properties settings I can use to get more info on the bootstrap process? Kevin -- Use Rojo (RSS/Atom aggregator). Visit http://rojo.com. Ask me for an invite! Also see irc.freenode.net #rojo if you want to chat. Rojo is Hiring! - http://www.rojonetworks.com/JobsAtRojo.html If you're interested in RSS, Weblogs, Social Networking, etc... then you should work for Rojo! If you recommend someone and we hire them you'll get a free iPod! Kevin A. Burton, Location - San Francisco, CA AIM/YIM - sfburtonator, Web - http://peerfear.org/ GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412 - 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]
Re: Tomcat 5.5 with DailyRollingFileAppender and DEBUG
At 06:50 PM 12/2/2004 -0800, you wrote: Has anyone been able to configure Tomcat with a custom log4j config? For the LIFE of me I can't figure this out. http://jakarta.apache.org/tomcat/faq/logging.html for Tomcat-5.5.x, just drop log4j.jar and commons-logging.jar (not commons-logging-api.jar) into common/lib and add a log4j config file to common/classes Jake 1. I want to use a DailyRollingFileAppender so that I don't get 1TB log files ;) 2. I want to enable DEBUG for a couple of internal Tomcat classes. Kevin -- Use Rojo (RSS/Atom aggregator). Visit http://rojo.com. Ask me for an invite! Also see irc.freenode.net #rojo if you want to chat. Rojo is Hiring! - http://www.rojonetworks.com/JobsAtRojo.html If you're interested in RSS, Weblogs, Social Networking, etc... then you should work for Rojo! If you recommend someone and we hire them you'll get a free iPod! Kevin A. Burton, Location - San Francisco, CA AIM/YIM - sfburtonator, Web - http://peerfear.org/ GPG fingerprint: 5FB2 F3E2 760E 70A8 6174 D393 E84D 8D04 99F1 4412 - 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]
issue with Resource differences between 5.0.xx and 5.5.x
I created a custom resource factory for Tomcat which works great in 5.0.xx. However, I'm having an issue with the new configuration 5.5.x where all config is done via attributes rather than as nested parameter elements. Basically, I've got a parameter of which the value needs to include newlines as it is really a set of properties to be loaded into a java.util.Properties object and this simply doesn't work if the config is provided as an attribute. I didn't expect this to work, but I made an attempt and verified that it didn't. Here it is Resource name=jdo/kodoJDO auth=Container type=javax.resource.cci.ConnectionFactory factory=com.mycompany.container.jdo.JDOHelperWrapperJNDIFactory config=kodo.LicenseKey: [some license key] javax.jdo.PersistenceManagerFactoryClass: kodo.jdbc.runtime.JDBCPersistenceManagerFactory javax.jdo.option.ConnectionURL: jdbc:oracle:thin:@somedomain.com:1521:somedb javax.jdo.option.ConnectionDriverName: oracle.jdbc.driver.OracleDriver javax.jdo.option.ConnectionUserName: username javax.jdo.option.ConnectionPassword: password javax.jdo.option.Optimistic: true javax.jdo.option.RetainValues: true javax.jdo.option.NontransactionalRead: true kodo.jdbc.Schemas: SOMESCHEMA/ This is supposed to configure a Kodo JDO connection factory to be accessed via JNDI (mimicking more standard mechanisms in full J2EE servers). However, using this config in Tomcat-5.5.4 results in Kodo saying that the property javax.jdo.PersistenceManagerFactoryClass is missing and must be specified. Well, I've obviously attempted to specify it above (along with many others). It just can't deal with the newlines in the attribute. How do I get around this? Is there an option for nested parameters defined by XML elements rather than attributes like in Tomcat-5.0.xx? Here's the equivalent config that works perfectly well under Tomcat-5.0.xx Resource name=jdo/nbsJDO auth=Container type=javax.resource.cci.ConnectionFactory/ ResourceParams name=jdo/nbsJDO parameter namefactory/name valuecom.mycompany.container.jdo.JDOHelperWrapperJNDIFactory/value /parameter parameter nameconfig/name value kodo.LicenseKey: [some license key] javax.jdo.PersistenceManagerFactoryClass: kodo.jdbc.runtime.JDBCPersistenceManagerFactory javax.jdo.option.ConnectionURL: jdbc:oracle:thin:@somedomain.com:1521:somedb javax.jdo.option.ConnectionDriverName: oracle.jdbc.driver.OracleDriver javax.jdo.option.ConnectionUserName: username javax.jdo.option.ConnectionPassword: password javax.jdo.option.Optimistic: true javax.jdo.option.RetainValues: true javax.jdo.option.NontransactionalRead: true kodo.jdbc.Schemas: SOMESCHEMA /value /parameter /ResourceParams Please don't tell me to implement each of these properties as config attributes of the Resource element. The properties are free-form and there are many more possible, quite a few of them kodo-specific that I would like to be able to add without having to modify the custom resource factory constantly. It is vastly simpler to be able to load all this stuff up in a Properties object which is what Kodo expects anyway for configuration. I can understand why the whole Resource + ResourceParams + parameter was eschewed in favor of less verbose attributes, but attributes don't offer all the functionality of the nested elements. Can nested parameter elements be an option for Tomcat-5.5.x's Resource config? thanks, Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Working directory for tomcat service on W2K
Assuming you are using Tomcat 5.x.xx, you can add the following to service.bat to set the working directory... set PR_STARTPATH=%CATALINA_HOME%\bin set PR_STOPPATH=%CATALINA_HOME%\bin I set it to Tomcat's bin directory since that is where it would be if running with the startup.bat file. Just seems consistent. You can set it for anywhere you want. You can also modify this using the GUI interface. Just run tomcat5w.exe and adjust the values in the Working Path field in the Startup and Shutdown tabs. Jake At 09:32 AM 11/25/2004 +, you wrote: Is there any way to change this, when tomcat runs as a service, from c:\winnt\system32? TIA Mark - 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]
Re: Tomcat 5.5.4 and Log4j
Look in the archives for another email from me. The fact is that the logger naming scheme used by Tomcat for its host and context logs is simply incompatible with the DOMConfigurator. This is because the XML files it processes use the log4j.dtd which define the logger name attribute as an ID. The problem occurrs with the characters [, ], and /. See the XML spec (or my other email somewhere in the archives of Tomcat-user or log4j-user) for details on legal characters for attributes of type ID. There is hope coming in Log4j-1.3 which deprecates the DOMConfigurator in favor of the JoranConfigurator which works with more free-form xml (not enforced by DTD) configuration files. However, your immediate solution is to use a log4j.properties file to configure Tomcat-5.5.x logging. Here's an example... log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout log4j.appender.A1.layout.ConversionPattern=%-5p[%-8.8t]: %39.39c %-6r - %m%n log4j.appender.A2=org.apache.log4j.FileAppender log4j.appender.A2.File=${catalina.home}/logs/stdout.log log4j.appender.A2.Append=false log4j.appender.A2.layout=org.apache.log4j.PatternLayout log4j.appender.A2.layout.ConversionPattern=%-5p[%-8.8t]: %39.39c %-6r - %m%n log4j.appender.LOCALHOST=org.apache.log4j.RollingFileAppender log4j.appender.LOCALHOST.File=${catalina.home}/logs/localhost.log log4j.appender.LOCALHOST.MaxFileSize=1000KB log4j.appender.LOCALHOST.MaxBackupIndex=1 log4j.appender.LOCALHOST.layout=org.apache.log4j.PatternLayout log4j.appender.LOCALHOST.layout.ConversionPattern=%-5p[%-8.8t]: %39.39c %-6r - %m%n log4j.appender.CONTEXT1=org.apache.log4j.DailyRollingFileAppender log4j.appender.CONTEXT1.File=${catalina.home}/logs/localhost_context1.log log4j.appender.CONTEXT1.DatePattern='.'-MM-dd log4j.appender.CONTEXT1.layout=org.apache.log4j.PatternLayout log4j.appender.CONTEXT1.layout.ConversionPattern=%c{1} %-6r - %m%n log4j.appender.CONTEXT2=org.apache.log4j.DailyRollingFileAppender log4j.appender.CONTEXT2.File=${catalina.home}/logs/localhost_context2.log log4j.appender.CONTEXT2.DatePattern='.'-MM-dd log4j.appender.CONTEXT2.layout=org.apache.log4j.PatternLayout log4j.appender.CONTEXT2.layout.ConversionPattern=%c{1} %-6r - %m%n log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/context1]=INFO, CONTEXT1 log4j.additivity.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/context1]=false log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/conext2]=INFO, CONTEXT2 log4j.additivity.org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/context2]=false log4j.logger.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=INHERIT, LOCALHOST log4j.additivity.org.apache.catalina.core.ContainerBase.[Catalina].[localhost]=false log4j.rootLogger=INFO, A1 Jake Quoting Wouter De Vaal [EMAIL PROTECTED]: Hi, I'm having difficulties to configure log4j with tomcat logging per context. Here's what I have done: 1. I've added log4j.jar to the bin dir 2. I've created a log4j.xml in common/classes and added the log4j.dtd This seems to work, because when I add a debug logger for org.apache, I get a lot of extra logging lines in stdout.log. But now I have a new webapp called advertisements and this is de message that I get in de stdout.log: log4j:WARN No appenders could be found for logger (org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/advertisements]). log4j:WARN Please initialize the log4j system properly. But when I add the logger with this name I get the following error: log4j:ERROR Parsing error on line 10 and column 100 log4j:ERROR Attribute value org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/advertisements] of type ID must be a name. So I guess log4j can't handle these names? I've also tried to use a log4j.properties (which also works when I add a debug logger for org.apache), but that doesn't work either, but this time I only get the first warning. My log4j.xml: ?xml version=1.0 encoding=UTF-8 ? !DOCTYPE log4j:configuration SYSTEM log4j.dtd log4j:configuration !-- STDOUT: Outputs log information to the standard output/console -- appender name=STDOUT class=org.apache.log4j.ConsoleAppender layout class=org.apache.log4j.PatternLayout param name=ConversionPattern value=%d %-5p - %m%n/ /layout /appender logger name=org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/advertisements] level value=DEBUG/ appender-ref ref=STDOUT/ /logger logger name=org.apache level value=INFO/ appender-ref ref=STDOUT/ /logger root level value=ERROR/ /root /log4j:configuration alternative log4j.properties: log4j.rootLogger=ERROR, A1 log4j.appender.A1=org.apache.log4j.ConsoleAppender log4j.appender.A1.layout=org.apache.log4j.PatternLayout # Print the date in ISO 8601 format
Re: setting JSESSION variable
Try... https://us.domain.com/secure;JSESSIONID=7D084BCFE46540FBB779486B4E003FD3?VAR1=VAL1 Yes, order is important! Jake Quoting Alex Korneyev [EMAIL PROTECTED]: what is the proper way to set jsession id if i want my own id? basically the situation is as follows. my user authenticates into domain.com then depending on what his/her locale is i forward them to http://lang.domain.com * i.e. http://us.domain.com the problem is that once they authenticate and i redirect them to another server, JSESSION id is lost; is there a manual way to set it? currently i do this: https://us.domain.com/secure?VAR1=VAL1;JSESSIONID=7D084BCFE46540FBB779486B4E003FD3 however, on the backend, when i do: request.getCookies() it is returning null any ideas? alex - 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]
Re: Re[2]: setting JSESSION variable
Sorry, I don't use jk2. However, I would think they would have made it jsessionid aware. I think addin the rewrite rule is the way to go, but you'll have to get verification of that from someone else. Good luck! Jake Quoting Alex Korneyev [EMAIL PROTECTED]: Hello Jacob Kjome, lovely :) however, since i have Apache as a middle man, i get this error: You don't have permission to access /secure;JSESSIONID=16E54F0A406582505A7A393E5307BC12VA1=VAL1 on this server. this is related to : http://www.jguru.com/faq/view.jsp?EID=53878 however, i am using mod_jk2 any idea how to set this up with mod_jk2 ? alex k. Monday, November 22, 2004, 2:12:38 PM, you wrote: Try... https://us.domain.com/secure;JSESSIONID=7D084BCFE46540FBB779486B4E003FD3?VAR1=VAL1 Yes, order is important! Jake Quoting Alex Korneyev [EMAIL PROTECTED]: what is the proper way to set jsession id if i want my own id? basically the situation is as follows. my user authenticates into domain.com then depending on what his/her locale is i forward them to http://lang.domain.com * i.e. http://us.domain.com the problem is that once they authenticate and i redirect them to another server, JSESSION id is lost; is there a manual way to set it? currently i do this: https://us.domain.com/secure?VAR1=VAL1;JSESSIONID=7D084BCFE46540FBB779486B4E003FD3 however, on the backend, when i do: request.getCookies() it is returning null any ideas? alex - 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] -- Best regards, Alexmailto:[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]
Re: Tomcat 5.5.4, Logging and the death of my friend localhost_log
At 01:26 AM 11/13/2004 +0100, you wrote: On Fri, 12 Nov 2004 12:53:18 -0600, Jonathan Eric Miller [EMAIL PROTECTED] wrote: Actually, I guess the default isn't that bad for UNIX/Linux anyway. In On Windows, I think it's time to start using the .exe wrapper (or another similar wrapper), rather than keep using the .bat scripts, given their current limitations. This redirects output to log files, which are not rotated at the moment (unlike the main procrun logger). I suppose the feature could be added. I know the new logging is not perfect, but I think it's better than it was before. As the ServletContext logging is bad, applications were never using it, and logging could not be unified due to Tomcat's use of proprietary loggers. The container logger often has little data, usually uncaught exceptions. What I liked about the ServletContext logging was that I could dynamically create the file using a simple Logger in the Context element of my context configuration file. This way, all I have to do is the deploy the app and the log file is created and rolled for me. Of course you're right that the context logging is weak on its own, but with the logging-log4j-sandbox ServletContextLogAppender (see http://tinyurl.com/5mf2q and http://tinyurl.com/3s94q ), I can hook in application logging to go to the ServletContext log file. And since that file is specified by the server, my own log4j config file need not point at any physical location on the machine (and it is my own app's config file, not the server's). The logging will show up wherever the server decides to put the servlet context log file for the application. No more context.getRealPath(/WEB-INF/logs) which is not guaranteed to work in all cases, nor do I have to configure any directory to point logging to. Plus, I have the full power of Log4j. This is logging heaven right up to Tomcat-5.0.xx, but with 5.5.x, I lose this ability to dynamically define the logger at deployment time. For each context I want logging for, I have to set up an entry in my server-defined log4j config file in common/classes (in which case I also have to be the server admin) and then deploy the app. This extra step is a real downgrade in functionality and efficiency between 5.0.xx and 5.5.x, IMO. I'd like to see something like the old functionality come back, although I'm not holding my breath. The other thing I'll mention is not so much a bug or defect, but an unfortunate collision between log4j's dtd and Tomcat-5.5.x's ServletContext logger naming scheme. for Log4j XML config files, the log4j dtd (used for the DOMConfigurator, but not for Log4j-1.3's JoranConfigurator which will, hopefully, ameliorate this issue) specifies the logger name attribute as being of Type ID. As such, the naming scheme Tomcat-5.5.x uses causes a parsing failure because it uses characters not allowed in XML ID attributes ([, ], and / in logger name=org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/MyContext). I'm not in any way implying that this is a bug in Tomcat-5.5.x. I just thought I'd mention it for those who attempt to use Log4j XML config files with the DOMConfigurator for servlet context logging. Using a properties file (which, unfortunately, doesn't have all the functionality that an XML config file has) or using Log4j-1.3's new JoranConfigurator should get around this (although I haven't actually tested this claim as of yet). Jake -- x Rémy Maucherat Developer Consultant JBoss Group (Europe) SàRL x - 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]
RE: FW: Configuring JAAS realm for a web appplication (Catalina c lass loader bug)
Quoting Reingold Genna [EMAIL PROTECTED]: Jake, Thanks for our reply. I have tried common/lib scenario. As a matter of fact I have started with that option. However it produces the same result. Well, not the same result when you remove the jar from WEB-INF/lib as I recommended as you seem to have later stated below. I have tried to move ejb-client jar out of of web app. But then I run into the problem when the application uses a class loaded by common class loader and if the class references another class in the WEB_INF/lib jar (a different jar) I get NoClassDefError. Effectively the only safe way to install my application in that scenario is to copy all application jars into common/lib and that is fundamently wrong. It sounds like you might have to re-think your circular dependencies. You need to make a decision which jars should depend on each other and whether the dependency direction is one way, both ways, or none at all. You can't get away from making this decision no matter the appserver. What I don't understand is why my set up works in 4.1.29 and doesn't work in 5.0.28. I can't explain that. However, I suspect that you tested 4.1.29 on some other machine than what you have 5.0.28 installed upon. I would investigate how the environment might be different. Different classpaths, different ways of starting the server (batch file -vs- a service), etc Make sure you try fresh installs of each version with your app and test both in exactly the same way. Then you will be comparing apples to apples and, therefore, getting rid of extraneous variables that might be clouding the investigation. Jake -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Monday, 8 November 2004 3:52 PM To: Tomcat Users List Subject: Re: FW: Configuring JAAS realm for a web appplication (Catalina class loader bug) Well, the short answer is, move it to common/lib, not server/lib. server/lib is for stuff that *only* Tomcat itself should see. common/lib is for stuff that both the server and applications should see (and shared/lib is the converse of server/lib, but different from WEB-INF/lib since it is global to all apps in the server). Even in the common/lib case, you may run into the same problem, though, because if you put the jar in WEB-INF/lib, that will be loaded, preferentially by the application because of child first classloading behavior that Tomcat implements. If JASS looks up this class as well, but loads it in a different classloader you will run into the same issue. In this case, you'll need to remove the jar from WEB-INF/lib and load it from common/lib only. I can't say for sure that it isn't bad behavior by Tomcat, but I doubt it. It is just a classloading issue you'll have to deal with. However, this is one reason why many appservers out there don't use child first classloading behavior by default, although in the server/lib situation you'd get the same result in this case. The common/lib case would have been taken care of in a server implementing normal parent first classloading behavior, but then it would be redundant to have the jar in WEB-INF/lib in that case anyway. Bottom line is that classloaders are tricky and different situations call for different solutions so I doubt there is anything fundamentally wrong with what Tomcat is doing. Jake At 09:31 AM 11/8/2004 +1100, you wrote: Hi, My company isusing Tomcat 4.1.29 and I'm investigating a transition to version 5.0.28. We use JAAS for authentication. The realm is decleared inside the web application context. The authentication code makes an EJB call to jBoss server (we are using stand alone Tomcat not jBoss bundled version). In verion 4.1 we have ejb-client code jar in both server/lib and Web Application lib directories. I have replicated the same structure in version 5 but I get ClassCastException inside my JAAS Authentication module. If I remove the copy of ejb-client jar from Web Application it all works fine which suggest to me that the ClassCastException related to the fact that the same class id loaded by different classloaders. Tomcat doco specifies that Catalina classloader is invisible to webapplications ( and that's why we use it in Tomcat 4) but it doesn't seem to be the case. The work-around (removing ejb-client code from web app) is not a solution because it has a lot of web app specific code. If I don't copy authentication code to server/lib directory and only keep it in web app Tomcat doesn't find it. That is the case for both versions - 4 and 5. To me it suggests a different problem - since JAAS realm declared in web app context it should apply to web application only and therefore it should be looking into webapp not server/lib directory. But that is a different discussion topic altogether. Thanks in advance Genna CAUTION - This message may contain privileged and confidential
Re: FW: Configuring JAAS realm for a web appplication (Catalina class loader bug)
Well, the short answer is, move it to common/lib, not server/lib. server/lib is for stuff that *only* Tomcat itself should see. common/lib is for stuff that both the server and applications should see (and shared/lib is the converse of server/lib, but different from WEB-INF/lib since it is global to all apps in the server). Even in the common/lib case, you may run into the same problem, though, because if you put the jar in WEB-INF/lib, that will be loaded, preferentially by the application because of child first classloading behavior that Tomcat implements. If JASS looks up this class as well, but loads it in a different classloader you will run into the same issue. In this case, you'll need to remove the jar from WEB-INF/lib and load it from common/lib only. I can't say for sure that it isn't bad behavior by Tomcat, but I doubt it. It is just a classloading issue you'll have to deal with. However, this is one reason why many appservers out there don't use child first classloading behavior by default, although in the server/lib situation you'd get the same result in this case. The common/lib case would have been taken care of in a server implementing normal parent first classloading behavior, but then it would be redundant to have the jar in WEB-INF/lib in that case anyway. Bottom line is that classloaders are tricky and different situations call for different solutions so I doubt there is anything fundamentally wrong with what Tomcat is doing. Jake At 09:31 AM 11/8/2004 +1100, you wrote: Hi, My company isusing Tomcat 4.1.29 and I'm investigating a transition to version 5.0.28. We use JAAS for authentication. The realm is decleared inside the web application context. The authentication code makes an EJB call to jBoss server (we are using stand alone Tomcat not jBoss bundled version). In verion 4.1 we have ejb-client code jar in both server/lib and Web Application lib directories. I have replicated the same structure in version 5 but I get ClassCastException inside my JAAS Authentication module. If I remove the copy of ejb-client jar from Web Application it all works fine which suggest to me that the ClassCastException related to the fact that the same class id loaded by different classloaders. Tomcat doco specifies that Catalina classloader is invisible to webapplications ( and that's why we use it in Tomcat 4) but it doesn't seem to be the case. The work-around (removing ejb-client code from web app) is not a solution because it has a lot of web app specific code. If I don't copy authentication code to server/lib directory and only keep it in web app Tomcat doesn't find it. That is the case for both versions - 4 and 5. To me it suggests a different problem - since JAAS realm declared in web app context it should apply to web application only and therefore it should be looking into webapp not server/lib directory. But that is a different discussion topic altogether. Thanks in advance Genna CAUTION - This message may contain privileged and confidential information intended only for the use of the addressee(s) named above. If you are not the intended recipient of this message you are notified that any use, dissemination, distribution or reproduction of this message is prohibited. If you have received this message in error please notify Siemens Ltd., ABN 98 004 347 880, or Siemens (NZ) Limited immediately. No representation is made that this email or any attachments are free of viruses. Virus Scanning is recommended and is the responsibility of the recipient. - 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]
Re: GZip compression in 4.1.27 ..
I'm not 100% sure of this, but I don't think GZIP compression was added to the connector until Tomcat 5.0.xx. Look at the appropriate docs to verify this. Either way, you can always write a servlet filter to do the compression. This way you don't have to worry about whether Tomcat (or any other app server) natively supports gzip compression. Jake Quoting Ben Bookey [EMAIL PROTECTED]: Dear Ladies and Gentlemen, This is a follow-on for a question from last week, but as its now on a different-page of the mailing list. I decided to post another new questions, so no-one misses it. 1) Below is an original extract of my tomcat 4.1.27 server.xml. I want to enable compression in my HTTP connector. I have a customer with v. low bandwidth. I have read the Apache readme http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/coyote.html on this, but I am still not 100% clear. Would I be right in understanding that *ALL* I need to do (in the case of TC 4.*) is add the following attribute compression=on ??? !-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8081 -- Connector className=org.apache.coyote.tomcat4.CoyoteConnector port=8080 minProcessors=5 maxProcessors=75 enableLookups=true redirectPort=8443 acceptCount=100 debug=0 connectionTimeout=2 useURIValidationHack=false disableUploadTimeout=true / !-- Note : To disable connection timeouts, set connectionTimeout value to -1 -- 2) Any suggestions on a way of testing this in our high bandwidth environment first ? regards Ben - 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]
Re: Unable to verify
It verifies just fine against the .md5 file using Ant's checksum task. Jake At 07:24 PM 10/12/2004 -0700, you wrote: The following files were downloaded from the Apache Jakarta Site: jakarta-tomcat-5.0.28.tar.gz jakarta-tomcat-5.0.28.tar.gz.asc jakarta-tomcat-5.0.28.tar.gz.md5 Attempted to verify the distribution before installing it: $ gpg --verify jakarta-tomcat-5.0.28.tar.gz.asc jakarta-tomcat-5.0.28.tar.gz gpg: Signature made Sat Aug 28 18:02:16 2004 PDT using DSA key ID 7C037D42 gpg: Can't check signature: public key not found $ gpg --keyserver pgpkeys.mit.edu --recv-keys 7C037D42 gpg: no valid OpenPGP data found. gpg: Total number processed: 0 $ . . . I have tried numerous keyservers with the same result. What am I doing wrong? Peter - - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [ANN] Apache Jakarta Tomcat 5.5.3-alpha Released
Quoting Mladen Turk [EMAIL PROTECTED]: Here is what I send to Yoav directly yesterday: I think that those two should be present inside .zip file, cause one can not install the service without them. The tar.gz distribution doesn't need those two exe's. Other option is to move them to separate package (together with service.bat). Also making the same with jsvc.gz on tar.gz distributions. For example: jakarta-tomcat-5.5.X-daemon.tar.gz jsvc.tar.gz + commons-daemon.jar + deps. jakarta-tomcat-5.5.X-daemon.zip tomcat5.exe + tomcat5w.exe + service.bat The problem is that you have a 'service.bat', but no way to use it, so It's pretty confusing. Exactly my point, but better stated. Perhaps having additional distros holding only the daemon code would be a way to go if the modularity to that level is needed. Fine by me. Having service.bat there with no daemon executables is pretty pointless. Jake Regards, MT. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [ANN] Apache Jakarta Tomcat 5.5.3-alpha Released
At 09:37 AM 10/7/2004 -0400, you wrote: Hi, Looking at the left-overs from my 5.5.3 build directory, it could be that I had a misconfigured build that resulted in the tomcat5.exe and tomcat5w.exe missing from the .zip. I'll have to double-check, but it could be that what I said below is wrong in practice (though still correct in spirit). So I guess hold on for 5.5.4 is the message anyhow ;) Hmm... I avoid the .exe installer like the plague. I like being able to simply extract Tomcat to a directory and run it. I want to have full control over what it does to my system. I don't want a .exe installer adding registry entries behind my back. The .zip file is fine as it is. I understand leaving out xercesImpl.jar and xml-apis.jar since the JDK comes with an XML parser. That's fine. But the JDK doesn't come with tomcat5.exe and tomcat5w.exe. I can see the .tar.gz distribution not containing those two files since it is more meant for non-windows boxes. But the .zip dist is meant for windows boxes and I will never, ever, use the .exe installer. I don't see the benefit in removing the .exe files. Why worry about dist file size when bandwidth is getting cheaper and cheaper by the day? Ok, if this saved 10 meg, I could see it, but this is hardly worth worrying about. Please leave them in the .zip distribution for 5.5.4 and beyond. thanks, Jake Yoav Shapira Millennium Research Informatics -Original Message- From: Shapira, Yoav Sent: Thursday, October 07, 2004 8:27 AM To: Tomcat Users List Subject: RE: [ANN] Apache Jakarta Tomcat 5.5.3-alpha Released Hi, The tomcat5.exe and tomcat5w.exe seem to be missing from 5.5.3. They exist in 5.5.2. Might need to release 5.5.4. These are present in the .exe download only, by design. One of our goals with 5.5 is to reduce download size, and while these two files by themselves aren't much, overall we've made great progress in this area. We also hope to make it easier for new users by not including a ton of stuff they don't necessarily need. Regardless, 5.5.4 will be coming fairly soon, and even sooner (most likely today) will come a one-class, non-essential hotfix to 5.5.3. Yoav This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - 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]
Re: [ANN] Apache Jakarta Tomcat 5.5.3-alpha Released
The tomcat5.exe and tomcat5w.exe seem to be missing from 5.5.3. They exist in 5.5.2. Might need to release 5.5.4. Jake Quoting Shapira, Yoav [EMAIL PROTECTED]: The Apache Jakarta Tomcat team is proud to announce the immediate availability of Tomcat 5.5.3-alpha. This build addresses several stability issues and other bugs, and we hope to make this out first Beta-quality build of the 5.5 branch (the stability vote will take place on the tomcat-dev list next week, as usual). Release notes: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/RELEASE-NOTES Please refer to the change log for the list of changes: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/changelog.html Downloads: Binaries: http://jakarta.apache.org/site/binindex.cgi#tomcat-5.5 Sources: http://jakarta.apache.org/site/sourceindex.cgi#tomcat-5.5 The Apache Jakarta Tomcat Team This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - 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]
RE: [OT] Re: log4j.properties file co-opting container logging. - Found word(s) optin in the subject
At 08:19 AM 9/30/2004 +0100, you wrote: -Original Message- From: Jacob Kjome Do you know what logger is used by default by commons-logging in Tomcat if log4j isn't present? I'm not very privy to the internals of commons-logging, but I think they have some sort of simple logger which is used when there is no other logging implementation available. Don't quote me on that, though. Is it the commons-logging that produces catalina_log.date.txt? Is there a config file as per log4j? Even when testing, this file becomes quite significant. It would be nice to reduce/minimise its output. Ultimately, Tomcat uses commons-logging for logging, but uses its own Logger interface which is configured in context configuration files or server.xml. Note that this is no longer the case in 5.5.x. Read the docs on Tomcat's Logger's for more info. Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: log4j.properties file co-opting container logging.
Quoting Ben Souther [EMAIL PROTECTED]: Got it... The app in question, uses Axis which uses commons-logging (CL). The addition of the log4j config file must have co-opted the Axis src. Yep, just set the org.apache or org.apache.commons logger to warn or whatever level you prefer which will squelch all but the most important messages. Jake On Wed, 2004-09-29 at 09:25, Ben Souther wrote: Tomcat 5.0.28 RH Linux 7.3/Windows 2000 After adding log4j jar file to: CONTEXT/WEB-INF/lib and log4j.properties to: CONTEXT/WEB-INF/classes my application's log file (the one specified in log4j.properties) is being filled up with container generated debugging (sample below). It doesn't seem to happen when with a clean restart of Tomcat. The app was deployed as a war file with all the l4j files intact. I'm trying to reproduce in a sample app (with no luck so far) that I can post. In the mean time, has anyone seen anything like this before? ==sample DEBUG: Convert string '30' to class 'int' DEBUG: Using converter [EMAIL PROTECTED] DEBUG: Registering Catalina:type=Manager,path=/appname,host=localhost DEBUG: Force random number initialization starting DEBUG: Opening /dev/urandom DEBUG: Getting message digest component for algorithm MD5 DEBUG: Completed getting message digest component DEBUG: getDigest() 1 DEBUG: Force random number initialization completed DEBUG: Start: Loading persisted sessions DEBUG: Loading persisted sessions from SESSIONS.ser DEBUG: Creating custom object input stream for class loader DEBUG: Loading 0 persisted sessions DEBUG: Finish: Loading persisted sessions DEBUG: Initializing the Web Service App. DEBUG: ContextListener. rbo_account: swdev DEBUG: Creating ApplicationCodeLists Object DEBUG: RBO ACCOUNT: swdev DEBUG: *** Getting error Codes from RBO DEBUG: 0 valid sessions open. - 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]
Re: [OT] Re: log4j.properties file co-opting container logging.
Quoting Ben Souther [EMAIL PROTECTED]: Do you know what logger is used by default by commons-logging in Tomcat if log4j isn't present? I'm not very privy to the internals of commons-logging, but I think they have some sort of simple logger which is used when there is no other logging implementation available. Don't quote me on that, though. And... Is there a way to configure it separately from log4j to separate my logging from Axis's? Yes, you could log to a separate logger repository, but you'd have to use a repository selector that is not so global like the ContextJNDISelector is. The fact is, anything that uses log4j and uses the same logger repository will end up being controlled by the configuration for that logger repository. Ceki is working on something called logger domains, but I'm not entirely sure what that entails. What I suggest is setting the root logger to some higher level such as warn and then specifically setting less strict logger levels for packages or classes in which you specifically want to see more information. This should, effectively, control the cross-library aspect of the logger repository. Jake On Wed, 2004-09-29 at 11:22, Jacob Kjome wrote: Quoting Ben Souther [EMAIL PROTECTED]: Got it... The app in question, uses Axis which uses commons-logging (CL). The addition of the log4j config file must have co-opted the Axis src. Yep, just set the org.apache or org.apache.commons logger to warn or whatever level you prefer which will squelch all but the most important messages. Jake On Wed, 2004-09-29 at 09:25, Ben Souther wrote: Tomcat 5.0.28 RH Linux 7.3/Windows 2000 After adding log4j jar file to: CONTEXT/WEB-INF/lib and log4j.properties to: CONTEXT/WEB-INF/classes my application's log file (the one specified in log4j.properties) is being filled up with container generated debugging (sample below). It doesn't seem to happen when with a clean restart of Tomcat. The app was deployed as a war file with all the l4j files intact. I'm trying to reproduce in a sample app (with no luck so far) that I can post. In the mean time, has anyone seen anything like this before? ==sample DEBUG: Convert string '30' to class 'int' DEBUG: Using converter [EMAIL PROTECTED] DEBUG: Registering Catalina:type=Manager,path=/appname,host=localhost DEBUG: Force random number initialization starting DEBUG: Opening /dev/urandom DEBUG: Getting message digest component for algorithm MD5 DEBUG: Completed getting message digest component DEBUG: getDigest() 1 DEBUG: Force random number initialization completed DEBUG: Start: Loading persisted sessions DEBUG: Loading persisted sessions from SESSIONS.ser DEBUG: Creating custom object input stream for class loader DEBUG: Loading 0 persisted sessions DEBUG: Finish: Loading persisted sessions DEBUG: Initializing the Web Service App. DEBUG: ContextListener. rbo_account: swdev DEBUG: Creating ApplicationCodeLists Object DEBUG: RBO ACCOUNT: swdev DEBUG: *** Getting error Codes from RBO DEBUG: 0 valid sessions open. - 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] - 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]
Re: Tomcat dies at 167M
Quoting Shannon Scott [EMAIL PROTECTED]: Greetings, Tomcat is running, and was working fine until the memory usage went up to 167, now none of the .jsp pages will respond ( the server hangs forever ). The last entries from the Catalina.out are : java.lang.OutOfMemoryError java.lang.OutOfMemoryError java.lang.OutOfMemoryError I don't understand how the JVM could be our of memory because I set it to use 256M. So the last time this happened, I wrote a piece of code that would leak some memory thinking that might be somehow related, but the tomcat process used more than 167M when I tested that page. I have set the CATALINA_OPTS=-Xms64M -Xmx256M, and everything looks Well it could be because -Xmx256M means absolutely nothing to the VM. You need to use -Xmx256m. Notice the case of the m. It is *very* important. Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat dies at 167M
Quoting Dale Lum [EMAIL PROTECTED]: Well it could be because -Xmx256M means absolutely nothing to the VM. You need to use -Xmx256m. Notice the case of the m. It is *very* important. Not according to the docs: Ahh... Then I eat my words. Sorry about that. I don't know why I remembered the case as being important? Jake -Xmxn Specify the maximum size, in bytes, of the memory allocation pool. This value must a multiple of 1024 greater than 2MB. Append the letter k or K to indicate kilobytes, or m or M to indicate megabytes. The default value is 64MB. The upper limit for this value will be approximately 4000m on Solaris 7 and Solaris 8 SPARC platforms and 2000m on Solaris 2.6 and x86 platforms, minus overhead amounts. Examples: -Xmx83886080 -Xmx81920k -Xmx80m - 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]
Re: Serializable Logging implementation
Quoting Tim Funk [EMAIL PROTECTED]: logging instances should be static to the class. // Commons logging example but a log4j equiv should be easy to find private static Log log = LogFactory.getLog(MyClass.class); or private transient Log log = LogFactory.getLog(MyClass.class); Although this would mean a new instance of the log variable for every instance of the class. The static version is the better idea in most cases. Jake -Tim Antony Paul wrote: Hi, I used Log4J and commons logging in an ActionForm which is stored in the session. When I reload the context it is invalidating the session because it is non serializable. Is there any work around for this ?. Or do I have to use any other Logger. - 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]
Re: at the tomcat start up...log4j error..
At 05:21 PM 9/10/2004 -0400, you wrote: log4j:WARN No appenders could be found for logger (org.apache.commons.digester.D igester). log4j:WARN Please initialize the log4j system properly. Starting service Tomcat-Standalone I am getting the above error as the tomcat starts up, i hav elog4j.jar under commom/lib and log4j.proprties under webapps/myapps/WEB-INF/lib... any clue.. Tomcat itself won't see the log4j.properties in your webapp. There are two issues here: 1. Log4j tries to perform autoconfiguration at Tomcat startup and isn't finding a config file. The solution here is to put a simple log4j.properties or log4j.xml file in common/classes 2. Log4j won't perform automatic configuration for your webapp since the one in common/lib can't see WEB-INF/classes. In this case, there are a few different solutions a. add a copy of log4j.jar to WEB-INF/lib and your config file to WEB-INF/classes and autoconfiguration will happen and only affect your webapp logging. b. perform manual configuration at webapp startup and provide Log4j with the URL of the config file. However, keep in mind that this will configure logging not only for your webapp, but also for any other app that is using Log4j. This is because Log4j is global to all apps. The solution is to do as described in a or do c below... c. use a repository selector so that Log4j can be global, but use a separate logger repository for each application. This is certainly more complex than a, but it is a good option. See more here... http://wiki.apache.org/logging-log4j/AppContainerLogging If you check out the log4j-sandbox code mentioned at that link, make sure to checkout the 0_3_alpha tag, as there are certain files that are required that were removed from the HEAD branch because they were moved into Log4j-1.3 HEAD. Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Log4J in Tomcat 5.0...I don't believe the FAQ
Why do you use commons-logging in your application classes? I can see a semi-legitimate argument for a framework doing this, so as to not force a particular logging implementation on the user. However, you are the user. You choose the logging implementation. You have, obviously, chosen Log4j as your implementation of choice. Why not cut out the middle man (commons-logging) and use Log4j? You might be interested in this... http://www.qos.ch/logging/thinkAgain.html See links at the bottom of the page as well. Jake At 09:01 PM 9/5/2004 +0200, you wrote: In case it helps, this is what I do with Tomcat 5.0.28 (Win 2000 without installer, j2sdk1.4.2_04): - I do not put log4j.jar in commom/lib, but in the WEB-INF/lib of my web app. - I put log4j.xml (equivalent to log4j.properties) and commons-logging.properties in WEB-INF/classes of my app. The archive commons-logging.properties contains: org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger I use the commons-logging api in my application classes. Regards. Pedro Nevado -Mensaje original- De: Patrick Burleson [mailto:[EMAIL PROTECTED] Enviado el: domingo, 05 de septiembre de 2004 17:05 Para: [EMAIL PROTECTED] Asunto: Log4J in Tomcat 5.0...I don't believe the FAQ So I'm trying to get Tomcat 5.0 to use Log4J for its log output formatted to my liking. Started searching and found a link to this message in the Tomcat FAQ that says it has the solution. http://marc.theaimsgroup.com/?l=tomcat-userm=108330970225012w=2 Well, after performing what seem like simple steps (probably the steps I would have done anyway), still no logging through Log4J. Did I miss some magically step number 4 or even step 0? I copied log4j-1.2.8.jar to CATALINA/commons/lib and put the example log4j.properties in CATALINA/commons/classes at DEBUG level and still only got the original format with only INFO level stuff printing out. I tried with the following versions of Tomcat on Windows XP with JDK 1.4.2_05 and JDK 5.0-RC: 5.0.27 Windows Installer 5.0.27 Zip file 5.0.19 Windows Installer 5.0.19 Zip File I tried the last two since they were the version mention in the mail message. I tried the zips thinking maybe there was something different about the windows installers. Later in that thread it is mentioned by Jacob Kjome in message http://marc.theaimsgroup.com/?l=tomcat-userm=108333554729166w=2 : I've pointed out almost these exact instructions many times before and people keep asking or say it doesn't work (it does). I just don't believe it. There has to be something I missed...but that's hard to do when there's only 3 steps, one of them being Download Log4J. Any ideas? Thanks, 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]
RE: TC 5.5 - 4 issues (jasper, ROOT, jndi, logging)
Quoting Allistair Crossley [EMAIL PROTECTED]: 4/ The logging suggestion at http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/logger. html did not work for me. I have log4j.properties in my webapp classes ... does this override any other log4j config like in this example? I'm going to try adding log4j.logger.org.apache.catalina.=debug, STDOUT into my webapp log4j and see what that does but first I need my webapp to work :) If I can be of any help please let me know what you want me to find out.. There are two solutions to avoid having the Log4j config in common/classes be separate from your own webapp logging: 1. Include log4j.jar in WEB-INF/lib. This works because Tomcat implements servlet-spec recommended classloading behavior where webapps look locally first to find classes to load before looking to the parent. So, your app will be using one instance of Log4j while Tomcat itself will be using another. 2. Use a repository selector. This is more involved, but greatly simplified in Log4j-1.3 (not released yet). Tomcat could set a repository selector for all applications to use making solution #1 unnecessary. To do it on your own, see (Note that all referenced code supports Log4j-1.2.x, not 1.3 where the design and useage of repository selectors has changed significantly)... http://wiki.apache.org/logging-log4j/AppContainerLogging Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: RAM usage of Linux-based Tomcat server
At 10:57 PM 8/30/2004 -0700, you wrote: I'm not worried about the transient memory used by the Tomcat instance for it to serve servlets. But I'm worried about the memory permanently allocated for a Tomcat instance. Eg. A servlet in a particular Tomcat instance, may load the entire database into the memory for efficiency reasons. Now this Tomcat instance requires X amount of memory to keep the database and all the stuff related to that Tomcat instance (except transient memory) to keep them in memory. And it requires additional variable amount of transient memory to serve it, that depends on the demand for that Tomcat instance. What I need to know is can I restrict the size of X? If the memory allocated permanently to a particular Tomcat instance cannot be restricted, Can I restrict the total memory allocation (ie. permanent + transient memory) for that Tomcat instance? The VM starts up with a default of 64 meg of RAM Max regardless of physical memory. You can increase this using -Xmx (with the Sun VM). For example... java -Xmx 256m Any out of memory errors you get are because the amount of memory needed by the application exceeds the maximum memory barrier of the VM. The only way around this is to get rid of memory leaks and/or increase the maximum memory for the VM. look up -Xmx on Google for more info Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat will not run JSPs
sounds to me like you aren't using connection pooling. Rather, you are opening a connection each time, but not fully closing the connection. Additionally, your database is probably set to only support 1 connection for this particular user at a time. You might want to check into allowing more connections and using connection pooling so that they stay open constantly so it isn't so expensive to use them. Jake At 12:00 PM 8/29/2004 -0400, you wrote: Sorry to bother you again Jacob. But heres what I have found out, first time into a program, the database opens, updates and closes all with a Status of 0 and 0... Enter another program,and the database opens with a Status of SqlCode = -1 and SqlState = 08002 (connection name in Use). And then, any other attempt to access database results in -1 and 08000 thereafter. By backing out to Tomcat manager, stopping and restarting the application, seems to take care of the 08002, but then it reappears right after you do an initial open/close.. Is there anything at all that you are aware of, that Tomcat keeps a resource open? On my close, I do a COMMIT followed by DISCONNECT ALL.. Im so sorry for bothering you. Mike - Original Message - From: Jacob Kjome [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Friday, August 27, 2004 12:46 PM Subject: RE: Tomcat will not run JSPs Quoting Nelson, Jerry W, Contractor 146CF, SCB [EMAIL PROTECTED]: In the envorinment settings they are capitalized, it's just the way I typed the echo command. I also tried the %CATALINA_HOME% pointing to where you said, it didn't work either. Cheerfully waiting for more suggestions... And to Jake, Apache-Tomcat (Jakarta Project) version 5.0.27 (the one I'm running) does run under a server service and it has an installer to set everything up for you (supposedly) And what I'm telling you is that: 1. Don't bother with the installer. I've never seen anything but trouble with it. 2. The installer doesn't do much more than what you can do more simply with the zip file. Just a couple extra manual steps that everyone should do anyway (setting up the system vars) 3. The service that gets installed doesn't have tools.jar in the classpath (at least with service.bat). You'll have to add that before JSP's will be compiled properly. Please do what I recommended. Start up Tomcat with the startup.bat and see if it works. If it does, then the problem is the service. If you refuse to try this, then you won't be able to narrow down your issue. Sorry, but that's all the help I can provide. If you ignore the advice I've given you so far, you are on your own. Jake //SIGNED// Jerry Nelson -Original Message- From: Dennis Dai [mailto:[EMAIL PROTECTED] Sent: Thursday, August 26, 2004 10:10 PM To: Tomcat Users List Subject: Re: Tomcat will not run JSPs Of course it will not work! First, I believe the environment variables need to be CAPITALIZED, as in %JAVA_HOME% and %CATALINA_HOME%. Second, your %CATALINA_HOME% is pointing to the wrong place. It should be the root of tomcat installation (ie., D:\Program Files\Apache Software Foundation\Tomcat 5.0), not webapps\ROOT. On 8/26/2004 8:44 PM, Nelson, Jerry W, Contractor 146CF, SCB wrote: That didn't work either and I have been researching this for a week, some days as many as 10 hours. I've probably spent an entire work week on this problem and I am getting really frustrated. Here are my current envirnment settings: L:\echo %java_home% C:\j2sdk1.4.2_05 L:\echo %catalina_home% D:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\ROOT It STILL doesn't work! //SIGNED// Jerry Nelson -Original Message- From: Dennis Dai [mailto:[EMAIL PROTECTED] Sent: Thursday, August 26, 2004 6:17 PM To: Tomcat Users List Subject: Re: Tomcat will not run JSPs You need to set %JAVA_HOME% to the installation directory of JDK, Not JRE. The JDK is installed in C:\j2sdk1.4.2_05 by default. I agree with Fredrik that you need to do some more home work by yourself since this is fairly basic stuff. On 8/26/2004 6:01 PM, Nelson, Jerry W, Contractor 146CF, SCB wrote: OK, I got the instructions and the homes are set as follows: L:\echo %JAVA_HOME% C:\Program Files\Java\j2re1.4.2_05\bin\client L:\ECHO %CATALINA_HOME% D:\Program Files\Apache Software Foundation\Tomcat 5.0 Tomcat STILL can't find javac!!! What's next //SIGNED// Jerry Nelson -Original Message- From: Fredrik Liden [mailto:[EMAIL PROTECTED] Sent: Thursday, August 26, 2004 5:41 PM To: Tomcat Users List Subject: RE: Tomcat will not run JSPs Go to google: Search for setting java_home click the first link in the result link. Follow step-by-step
Re: SecurityManager
Mike, You do not need to post your question specifically to 3 different people. It's all on one list, just ask one question. Not only that, but you seem to have hijacked two threads in the process. Create a new thread for a new question. Does a post about JSP's or a post about the Tomcat SecurityManager sound anything like they have to do with databases? I don't think so, and it ought to be obvious even to the most newbie or newbies. You ought to know that you risk being ignored if you continue this behavior on the list. Yes, we all understand you have a problem that needs solving, but you are less, not more, likely to get an answer with this line of questioning. Jake At 12:23 PM 8/29/2004 -0400, you wrote: Hi Benjamin, Im sorry to bother you, but Im desperate and you seem pretty knowledgeable re Tomcat. Im using the Windows Installer version 5.0.27.. Could I ask you a question, I added my application thru the Application Manager... went to the Company Logon screen,which opens MySql database, updates it, and closes it. All successfully. I then go to the User Login screen,which does the same functions as above, open, update, closeand on my Open database, I get a 08002 (connection name in use). Any subsequent call gives an 08000. By backing out to Tomcat manager, stopping and restarting the application, seems to take care of the 08002, but then it reappears right after you do an initial open/close.. Is there anything at all that you are aware of, that Tomcat keeps a resource open? On my close, I do a COMMIT followed by DISCONNECT ALL.. Im so sorry for bothering you. By the way, Im running Servlets.. Do you have any idea what my problem may be, Im totally new to this type of programming, and extremely frustrated, cause my App works fine in CGI format under a different Web Browser, only problem is, CGI is extremely slow.. I need it to work in Servlets Thank You for any help you may be able to offer me... Mike - Original Message - From: Benjamin Armintor [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Friday, August 27, 2004 11:06 AM Subject: RE: SecurityManager Where did you add the -security? Did you move the catalina.policy file? System.getSecurityManager() returning null is generally taken to mean that the JVM is not running under the manager at all: this is obvious, I know, but it also indicates the converse. So if you start a security manager up, the system's behavior will change. In fact, I never considered the trouble one could cause calling setSecurityManager at runtime when there was no manager in effect (as opposed to trying to override an existing policy, for which there's a permission check). The AccessControlException means that after you started the manager, some bit of code tried to get its ContextClassLoader, and it did not have the appropriate runtime permissions. Are the policy file entries you indicated are all that is in your policy file? Benjamin J. Armintor Operations Systems Specialist ITS-Systems: Mainframe Group University of Texas - Austin tele: (512) 232-6562 email: [EMAIL PROTECTED] -Original Message- From: Seaman, Sloan [mailto:[EMAIL PROTECTED] Sent: Thursday, August 26, 2004 1:28 PM To: '[EMAIL PROTECTED]' Subject: SecurityManager I'm trying to get an application I have to use the SecurityManager object from Tomcat. I've added the -security to my startup so that it is enabled. When I do a System.getSecurityManager() it returns a null object. If I try and create my own SecurityManager and set it via System.setSecurityManager, I get: 004-08-26 14:07:47 StandardContext[/clinicalTrials]Exception starting filter SessionFilter java.security.AccessControlException: access denied (java.lang.RuntimePermission getClassLoader) at java.security.AccessControlContext.checkPermission(AccessControlContext. java :269) at java.security.AccessController.checkPermission(AccessController.java:401 ) at java.lang.SecurityManager.checkPermission(SecurityManager.java:524) at java.lang.Thread.getContextClassLoader(Thread.java:1182) at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFi lter Config.java:207) at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(Applicatio nFil terConfig.java:308) at org.apache.catalina.core.ApplicationFilterConfig.init(ApplicationFilte rCon fig.java:79) The only info I have added to the catalina.policy file is: grant { permission javax.security.auth.AuthPermission createLoginContext; permission javax.security.auth.AuthPermission doAs; permission javax.security.auth.AuthPermission doAsPrivileged; permission javax.security.auth.AuthPermission modifyPrincipals; permission javax.security.auth.AuthPermission getSubject; }; grant principal com.ptilabs.commons.jaas.authentication.ldap.LDAPPrincipal _app_Clinical_Trials { permission com.ptilabs.commons.jaas.authorization.URLPermission
Re: java.io.UTFDataFormatException
Is the error happening on the loading of the XML and/or XSLT documents you are loading? I used to use Ultraedit as my text editor, but found it sporadically added invalid characters in the first few characters of the doc which would cause weird exceptions upon loading the document. And I couldn't see the invalid character under Ultraedit, but could under JEdit. As such, I now use JEdit as it always saves my files properly. Might a similar issue be happening in your case? Jake At 02:38 AM 8/28/2004 -0300, you wrote: Hello All! Sorry, I am posting this message twice, But I think I have a problem with my spam-cop. I've fix this error with XSLT generation. I've copyed xalan.jar from 2jars to 'endorsed' folder of Tomcat and I've created the copy of this folder in lib of JRE. Thanks to Jacob Kjome for help!!! Now I have another problem with generation of this page. When I'm trying to pass the data to servlet it returns this error: java.io.UTFDataFormatException: Invalid byte 2 of 2-byte UTF-8 sequence. This app worked fine before on old Tomcat4.0.27 and Apache 2.0.46 with mod_jk. Is this a bug??? I'm running Win 2003, Apache2.0.50+Tomcat5.0.27. I've tryed to run it with JDK 1.5Beta2 then I've installed JDK 1.4.2_05 - without any progress. The only difference that I have - its when I'm using JDK 1.4.2 its a little slower then 1.5. But its produces the same exception. What should I do??? (the first answer I have - its kill myself:)) Seriously - what is it? Xalan, Xerces or what? I've tryed to use tools, set CLASSPATH to full Xerces and to Tools (in this case it throws this exeption each time on each request). The Java console of the browser tells this (and no any errors!): --Start quotation: Create XSLTINFO documentURL : XSLT.xslt In LayerQueryInfo LayerID =areas propertyName =PropertyFilter value =perimeter207911 create an Hastable for the layer --- Hastable ---{PropertyFilter=perimeter207911} DOCUMENT = LayerInfoRequest directOutput=true LayerQuery fullEnvelope=false envelope=false layerid=areas_geo PropertyFilterperimetergt;207911/PropertyFilter /LayerQuery Output XSLTInfo DocumentURLXSLT.xslt/DocumentURL /XSLTInfo /Output /LayerInfoRequest --End quotation Here I see the problem when I'm trying to pass the data in PropertyFilter / parameter - its converted automatically from perimeter207911 to perimetergt;207911. But I cant tell is that a real problem or not, because I just dont remember how it worked before - with this converion or not. Technically to make logical query it should pass the data 'as is' without any changes. Any suggestions how to fix this??? Or any ideas? Please... Thank you very much in advance! -- Best regards, Eugenemailto:[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]
RE: Tomcat will not run JSPs
Quoting Nelson, Jerry W, Contractor 146CF, SCB [EMAIL PROTECTED]: In the envorinment settings they are capitalized, it's just the way I typed the echo command. I also tried the %CATALINA_HOME% pointing to where you said, it didn't work either. Cheerfully waiting for more suggestions... And to Jake, Apache-Tomcat (Jakarta Project) version 5.0.27 (the one I'm running) does run under a server service and it has an installer to set everything up for you (supposedly) And what I'm telling you is that: 1. Don't bother with the installer. I've never seen anything but trouble with it. 2. The installer doesn't do much more than what you can do more simply with the zip file. Just a couple extra manual steps that everyone should do anyway (setting up the system vars) 3. The service that gets installed doesn't have tools.jar in the classpath (at least with service.bat). You'll have to add that before JSP's will be compiled properly. Please do what I recommended. Start up Tomcat with the startup.bat and see if it works. If it does, then the problem is the service. If you refuse to try this, then you won't be able to narrow down your issue. Sorry, but that's all the help I can provide. If you ignore the advice I've given you so far, you are on your own. Jake //SIGNED// Jerry Nelson -Original Message- From: Dennis Dai [mailto:[EMAIL PROTECTED] Sent: Thursday, August 26, 2004 10:10 PM To: Tomcat Users List Subject: Re: Tomcat will not run JSPs Of course it will not work! First, I believe the environment variables need to be CAPITALIZED, as in %JAVA_HOME% and %CATALINA_HOME%. Second, your %CATALINA_HOME% is pointing to the wrong place. It should be the root of tomcat installation (ie., D:\Program Files\Apache Software Foundation\Tomcat 5.0), not webapps\ROOT. On 8/26/2004 8:44 PM, Nelson, Jerry W, Contractor 146CF, SCB wrote: That didn't work either and I have been researching this for a week, some days as many as 10 hours. I've probably spent an entire work week on this problem and I am getting really frustrated. Here are my current envirnment settings: L:\echo %java_home% C:\j2sdk1.4.2_05 L:\echo %catalina_home% D:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\ROOT It STILL doesn't work! //SIGNED// Jerry Nelson -Original Message- From: Dennis Dai [mailto:[EMAIL PROTECTED] Sent: Thursday, August 26, 2004 6:17 PM To: Tomcat Users List Subject: Re: Tomcat will not run JSPs You need to set %JAVA_HOME% to the installation directory of JDK, Not JRE. The JDK is installed in C:\j2sdk1.4.2_05 by default. I agree with Fredrik that you need to do some more home work by yourself since this is fairly basic stuff. On 8/26/2004 6:01 PM, Nelson, Jerry W, Contractor 146CF, SCB wrote: OK, I got the instructions and the homes are set as follows: L:\echo %JAVA_HOME% C:\Program Files\Java\j2re1.4.2_05\bin\client L:\ECHO %CATALINA_HOME% D:\Program Files\Apache Software Foundation\Tomcat 5.0 Tomcat STILL can't find javac!!! What's next //SIGNED// Jerry Nelson -Original Message- From: Fredrik Liden [mailto:[EMAIL PROTECTED] Sent: Thursday, August 26, 2004 5:41 PM To: Tomcat Users List Subject: RE: Tomcat will not run JSPs Go to google: Search for setting java_home click the first link in the result link. Follow step-by-step instructions. Once you get passed the step of setting the paths you'll no doubt encounter tons of problems and questions. Make sure to read the basic tutorials and search the archive for the same questions. If you can't find the answer after looking in those two places please feel free to post your questions. Let's keep this list somewhat relevant shall we. Fredrik -- Dennis Dai [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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: to Jacob Kjome - Re: help to resolve a problem with XSLT generation
I can't give you any advice on using JDK 1.5b2 because I've never used it before. I can tell you that my transformations work fine under JDk 1.4.2_05 and I always have the latest versions of Xerces, xml-apis, and Xalan in an endorsed directory (either jre/lib/endorsed or common/endorsed). Jake Quoting Eugene [EMAIL PROTECTED]: Hello Jacob, thank you for reply. Yes I thought that maybe this is a problem... the thing is the clients wants the latest (they're scientists, not programmers;)). So, I've installed for them JDK-J2SE 5.0Beta2. Technically the docs of the application tells that I free to use any production environment that relatively approved by Sun. Is acceptable to run this application on JBoss (which isnt Tomcat as I know, despite of the fact that JBoss uses the TC like a platform), Orion and some others commercial app servers. So can you tell what exactly should I do in this situation (on the part of this question I have your answer already)? I trust the professionals opinion. Should I use JDK 1.4.2 instead? Is it posible to use xalan that goes with JBoss or should I download the new one from Apache? Thank you very much for your time! Eugene. Friday, August 27, 2004, 1:35:29 AM, you wrote: What version of the JDK are you using? This is telling... javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found javax.xml.transform.TransformerFactory.newInstance(Unknown Source) Either you are using a JDK less than 1.4 (1.4+ includes Xalan) or the version of Xalan in the classpath isn't matching what you have configured. Try putting xalan.jar in either JAVA_HOME/jre/lib/endorsed or in CATALINA_HOME/common/endorsed alongside xercesImpl.jar (BTW, I suggest the 2jars distribution of Xalan because the normal distribution contains an old version of BCel and will conflict with any app requiring a newer version). Also, make sure you haven't added an older version of Xerces to JAVA_HOME/jre/lib/endorsed which might not recognize the property you set for it. The version in Tomcat's endorsed directory is the latest and greatest. Don't override it. Jake At 10:31 PM 8/26/2004 -0300, you wrote: Hi, guys! I have a problem. I am running Apache 2.0.50 + Tomcat5.0.27(mod_jk2) on Windows Server 2003. We have upgraded it from Apache 2.0.46+Tomcat 4.0.27(mod_jk). This combination worked fine but for some reasons we should periodically upgrade it to a newest versions. Anyway, I've started this application and I was surprised - it didnt work like before. The base app works fine, but it seems like I have a problem with XSLT engine. Technically this application recieves requests from user, process them and then sends results to an XSLT template and then user obtains visual results through generated from this template HTML page. So on this stage I have an error 500. Please give me some advice what should I do - change the xml parser, use older version of Tomcat(which is worth decision ever in my case) or what? I am not a Java programmer, so its difficult for me to understand this situation with XML parsers - first Crimson then Xerces etc. But maybe I'm wrong and this error have the other cause, so I need a professional advice, please. Any suggestions are welcome ASAP:) BTW, this application designed to use Apache and Tomcat without any additional installations (like Ant or Xerces/Xalan or whatever) I didnt noticed nothing strange in logs (all clear) except this part of 'stdout.log': request Create Parser org.xml.sax.SAXNotRecognizedException: Feature 'http://apache.org/xml/features/validation/warn-on-undeclared-elemdef' is not recognized. xmlFile :/req.xml nodeValue :XSLT.xslt === documentURL === XSLT.xslt styleSheetTable : {} xsltRealPath : C:\webpub\apache\www\application-folder\XSLT\XSLT.xslt +++ And here is the content of error page generated by Tomcat: Estado HTTP 500 - type Informe de Excepcion Mensaje descripcion El servidor encontro un error interno () que hizo que no pudiera rellenar este requerimiento. Excepcion javax.servlet.ServletException: La ejecucion del Servlet lanzo una excepcion causa raiz javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found javax.xml.transform.TransformerFactory.newInstance(Unknown Source) com.MapEnterprise.mapService.MapService.transformationXSLT(MapService.java:1131) OurServlet.doGet(OurServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) nota La traza completa de la causa de este error se encuentra en los archivos de diario de Apache Tomcat/5.0.27.
Re: install vs deploy
Here's what I do (only relevant targets below)... presetdef name=preset-catalina-deploy catalina-deploy url=${manager.url} username=${manager.username} password=${manager.password} path=/${app.war.name} / /presetdef target name=catalina-deploy depends=war.jar,-catalina.init description=Deploy webapp remotely from war file preset-catalina-deploy update=true war=${app.war.url.file} / /target target name=catalina-install depends=war,-catalina.init description=Deploy a webapp locally from a war directory preset-catalina-deploy config=${app.war.ccf.url.file} localWar=${app.war.url.dir} / /target target name=catalina-reinstall depends=catalina-undeploy, catalina-install description=convenience target calling catalina-undeploy, then catalina-install / Jake Quoting D Sledge [EMAIL PROTECTED]: I've got two custom tasks for tomcat's manager app: taskdef name=deployclassname=org.apache.catalina.ant.DeployTask/ taskdef name=install classname=org.apache.catalina.ant.InstallTask/ target name=deploy description=Install web application deploy url=${url} username=${username} password=${password} path=${path} war=file:${env.AXIS_HOME}/webapps/axis/ /target target name=install description=Install web application install url=${url} username=${username} password=${password} path=${path} war=file:${env.AXIS_HOME}/webapps/axis/ /target After browsing through the documentation, I've found that the install task has been depreciated in favor of the deploy task. However, deploy gives me the following exception message, while install works fine: deploy: [deploy] FAIL - Encountered exception java.util.zip.ZipException: Could not find End Of Central Directory Since deploy is the favored means of deploying a web app, I want to use it instead, but I can't figure out why I'm getting this exception message. Linux Red Hat 9.0+ JRockit 1.4.2_04 tomcat 5.0.27 __ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail - 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]
Re: install vs deploy
Look at the difference between the catalina-deploy target and the catalina-install target. Notice that localWar is used to deploy a webapp from a directory and war is used to deploy a .war file to the server. Jake At 05:38 PM 8/27/2004 -0400, you wrote: From the exception you quote it is obvious the deploy task is not executing a zip/unzip/jar/unjar command properly. Where are these tasks defined? Gerardo I'm afraid I don't see exactly how that explains why I'm getting that exception message. --- Jacob Kjome [EMAIL PROTECTED] wrote: Here's what I do (only relevant targets below)... presetdef name=preset-catalina-deploy catalina-deploy url=${manager.url} username=${manager.username} password=${manager.password} path=/${app.war.name} / /presetdef target name=catalina-deploy depends=war.jar,-catalina.init description=Deploy webapp remotely from war file preset-catalina-deploy update=true war=${app.war.url.file} / /target target name=catalina-install depends=war,-catalina.init description=Deploy a webapp locally from a war directory preset-catalina-deploy config=${app.war.ccf.url.file} localWar=${app.war.url.dir} / /target target name=catalina-reinstall depends=catalina-undeploy, catalina-install description=convenience target calling catalina-undeploy, then catalina-install / __ Do you Yahoo!? Yahoo! Mail - 50x more storage than other providers! http://promotions.yahoo.com/new_mail - 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]
Re: help to resolve a problem with XSLT generation
What version of the JDK are you using? This is telling... javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found javax.xml.transform.TransformerFactory.newInstance(Unknown Source) Either you are using a JDK less than 1.4 (1.4+ includes Xalan) or the version of Xalan in the classpath isn't matching what you have configured. Try putting xalan.jar in either JAVA_HOME/jre/lib/endorsed or in CATALINA_HOME/common/endorsed alongside xercesImpl.jar (BTW, I suggest the 2jars distribution of Xalan because the normal distribution contains an old version of BCel and will conflict with any app requiring a newer version). Also, make sure you haven't added an older version of Xerces to JAVA_HOME/jre/lib/endorsed which might not recognize the property you set for it. The version in Tomcat's endorsed directory is the latest and greatest. Don't override it. Jake At 10:31 PM 8/26/2004 -0300, you wrote: Hi, guys! I have a problem. I am running Apache 2.0.50 + Tomcat5.0.27(mod_jk2) on Windows Server 2003. We have upgraded it from Apache 2.0.46+Tomcat 4.0.27(mod_jk). This combination worked fine but for some reasons we should periodically upgrade it to a newest versions. Anyway, I've started this application and I was surprised - it didnt work like before. The base app works fine, but it seems like I have a problem with XSLT engine. Technically this application recieves requests from user, process them and then sends results to an XSLT template and then user obtains visual results through generated from this template HTML page. So on this stage I have an error 500. Please give me some advice what should I do - change the xml parser, use older version of Tomcat(which is worth decision ever in my case) or what? I am not a Java programmer, so its difficult for me to understand this situation with XML parsers - first Crimson then Xerces etc. But maybe I'm wrong and this error have the other cause, so I need a professional advice, please. Any suggestions are welcome ASAP:) BTW, this application designed to use Apache and Tomcat without any additional installations (like Ant or Xerces/Xalan or whatever) I didnt noticed nothing strange in logs (all clear) except this part of 'stdout.log': request Create Parser org.xml.sax.SAXNotRecognizedException: Feature 'http://apache.org/xml/features/validation/warn-on-undeclared-elemdef' is not recognized. xmlFile :/req.xml nodeValue :XSLT.xslt === documentURL === XSLT.xslt styleSheetTable : {} xsltRealPath : C:\webpub\apache\www\application-folder\XSLT\XSLT.xslt +++ And here is the content of error page generated by Tomcat: Estado HTTP 500 - type Informe de Excepcion Mensaje descripcion El servidor encontro un error interno () que hizo que no pudiera rellenar este requerimiento. Excepcion javax.servlet.ServletException: La ejecucion del Servlet lanzo una excepcion causa raiz javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found javax.xml.transform.TransformerFactory.newInstance(Unknown Source) com.MapEnterprise.mapService.MapService.transformationXSLT(MapService.java:1131) OurServlet.doGet(OurServlet.java:617) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) nota La traza completa de la causa de este error se encuentra en los archivos de diario de Apache Tomcat/5.0.27. Apache Tomcat/5.0.27 Thank you very much for any help!!! -- Best regards to all, Eugene mailto:[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]
RE: Tomcat will not run JSPs
Ok, start over. Uninstall Tomcat. Grab the .zip file distribution and extract it to a directory *without spaces*. Now, change the value of CATALINA_HOME to the new location of Tomcat. Reboot. The reboot is sometimes not necessary, but many times it is in order for your environment variables to be recognized. Just be safe and reboot. Now you are ready to run. The question is, which way are you running it? I suggest running using the startup.bat file. You can create a shortcut to this on your desktop (same with shutdown.bat) to make things easier. Since you seem to be a relative newbie to Tomcat (and possibly to programming???), I don't suggest trying to set up the windows service, especially since the service.bat currently doesn't include tools.jar in the classpath and will cause JSP not to compile. Why this hasn't been changed by the Tomcat developers is beyond me. I've reported it many a time and it is simply ignored. Baffling! Anyway, you should be set to go. Seriously, Tomcat is one of the simplest apps out there to set up. If you are having trouble, you might want to take a class of some sort to get up to speed on some of this rather than banging your head against the wall for as long as you have been. Jake At 04:44 AM 8/27/2004 +0100, you wrote: That didn't work either and I have been researching this for a week, some days as many as 10 hours. I've probably spent an entire work week on this problem and I am getting really frustrated. Here are my current envirnment settings: L:\echo %java_home% C:\j2sdk1.4.2_05 L:\echo %catalina_home% D:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\ROOT It STILL doesn't work! //SIGNED// Jerry Nelson -Original Message- From: Dennis Dai [mailto:[EMAIL PROTECTED] Sent: Thursday, August 26, 2004 6:17 PM To: Tomcat Users List Subject: Re: Tomcat will not run JSPs You need to set %JAVA_HOME% to the installation directory of JDK, Not JRE. The JDK is installed in C:\j2sdk1.4.2_05 by default. I agree with Fredrik that you need to do some more home work by yourself since this is fairly basic stuff. On 8/26/2004 6:01 PM, Nelson, Jerry W, Contractor 146CF, SCB wrote: OK, I got the instructions and the homes are set as follows: L:\echo %JAVA_HOME% C:\Program Files\Java\j2re1.4.2_05\bin\client L:\ECHO %CATALINA_HOME% D:\Program Files\Apache Software Foundation\Tomcat 5.0 Tomcat STILL can't find javac!!! What's next //SIGNED// Jerry Nelson -Original Message- From: Fredrik Liden [mailto:[EMAIL PROTECTED] Sent: Thursday, August 26, 2004 5:41 PM To: Tomcat Users List Subject: RE: Tomcat will not run JSPs Go to google: Search for setting java_home click the first link in the result link. Follow step-by-step instructions. Once you get passed the step of setting the paths you'll no doubt encounter tons of problems and questions. Make sure to read the basic tutorials and search the archive for the same questions. If you can't find the answer after looking in those two places please feel free to post your questions. Let's keep this list somewhat relevant shall we. Fredrik -- Dennis Dai [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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Context Path Not Working when autoDeploy=true
It's a mistake that it was there. Check out the conf/Catalina/localhost directory. You'll see a balancer.xml file there as well, along with a few others. That is the correct place for context configuration files (CCF) to be... at least for the localhost Host (as defined in server.xml). Put your file there and it should work just fine, although you might notice the app being deployed twice because it will be autodeployed under the path /jsp-examples as well as your defined path /je. To avoid this, you would want to move jsp-examples out of webapps and point to it in the CCF. The other option would be to turn off autodeploy in the Host config in server.xml. Jake At 08:59 PM 8/23/2004 -0700, you wrote: Hi everyone, I am using Tomcat 5.0.27, straight out of the box. I have a question... First, I added an Context Descriptor XML file, jsp-examples.xml, to the webapps/jsp-examples directory. My intent was to be able to access the jsp-examples app with this URL: http://localhost:8080/je; Here's the jsp-example.xml contents: --- Context path=/je docBase=jsp-examples debug=0 privileged=true /Context --- I did this because I noticed the balancer app has a balancer.xml. It seems like it should work, right? But it doesn't. The URL, http://localhost:8080/je;, gives me a 404 Not Found. Is this a bug maybe? There's nothing in the log to indicate a problem. Is there a way to keep the webapps/jsp-examples structure intact yet be able to use the URL I want? Thank you, Lisa ___ Do you Yahoo!? Win 1 of 4,000 free domain names from Yahoo! Enter now. http://promotions.yahoo.com/goldrush - 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]
Re: How do I configure Tomcat to translate UTF-8 encoded parameters
At 08:34 PM 8/23/2004 -0700, you wrote: Filip Hanik (lists) wrote: doesn't URIEncoding suggest that the URI is encoded, in a POST, the parameters are passed in the body, not in the URI? Yes it does, and hence the second part of my question. Do you know how one can configure Tomcat to decode input parameters with UTF-8 encoding? form name=myform action=/someplace accept-charset=UTF-8 . /form And then make sure to set the request's encoding to UTF-8 as well. Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: docBase attribute in context element doesn't recognize c$
Are you running as a service? Try running the startup script instead and see if that works. The service runs under the system user which may not have access to the network drive. Jake At 06:34 AM 8/22/2004 -0700, you wrote: Hi, i migrated from TC4 to TC 5. in TC 4 i had a context element in web.xml which had an attribute of \\my-computer\c$\temp this worked fine. in TC 5 i get this error: java.lang.IllegalArgumentException: Document base \\my-computer\c\temp does not exist or is not a readable directory some how it removes the $ and caused the Document base not to be found . any suggestions ? workarrounds? i DO have to use a hidden directory c$ in my application regards Sun House - Do you Yahoo!? Yahoo! Mail Address AutoComplete - You start. We finish. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Windows 2000 Tomcat 5.0 as Service -- which JDK from what path is it using?
How about looking at the service.bat and seeing what it does. Set JAVA_HOME system variable. Make sure to re-install the service any time you change the value of JAVA_HOME (and you will have to open a new command prompt to get the new value or, in some cases, reboot). service.bat remove service.bat install Also see: http://jakarta.apache.org/commons/daemon/procrun.html The doc is a bit dated, but the information for launching the GUI editor for the service is still valid. Jake At 03:46 PM 8/19/2004 -0700, you wrote: I've searched through the registry using regedit far and wide, and I have seen some of the tomcat parameters, both under SOFTWARE and under SERVICES, but none of them refer to a path to the JDK, and there is no entry that says JVM... There is a 'Java' key with Data of 'java'. Could be system PATH be used? My issues were not due to different JDK's, so I will table this for now, but I'm still curious as to how the path is determined. Betty -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Thursday, August 19, 2004 11:55 AM To: Tomcat Users List Subject: RE: Windows 2000 Tomcat 5.0 as Service -- which JDK from what path is it using? Hi, I guess my original STFA wasn't explicit enough. Figures. Anyways, try http://marc.theaimsgroup.com/?l=tomcat-userm=104914298630480w=2. Yoav Shapira Millennium Research Informatics -Original Message- From: Chang, Betty [mailto:[EMAIL PROTECTED] Sent: Thursday, August 19, 2004 2:49 PM To: Tomcat Users List Subject: RE: Windows 2000 Tomcat 5.0 as Service -- which JDK from what path is it using? Hi -- That archive discusses JVM options, but what I want to know is, how do I specify the Directory PATH of which java.exe is being used? Thanks Betty -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Thursday, August 19, 2004 11:36 AM To: Tomcat Users List Subject: RE: Windows 2000 Tomcat 5.0 as Service -- which JDK from what path is it using? Hi, The archives have pointers to registry locations of Tomcat JVM options. For example, http://marc.theaimsgroup.com/?l=tomcat-userm=105232343109162w=2. Yoav Shapira Millennium Research Informatics -Original Message- From: Chang, Betty [mailto:[EMAIL PROTECTED] Sent: Thursday, August 19, 2004 2:31 PM To: Tomcat Users List Subject: Windows 2000 Tomcat 5.0 as Service -- which JDK from what path is it using? Hi -- This is driving me nuts. After I have installed Tomcat 5.0 as a Service, how do I find out what JDK it is using? And, how can I change it? I have NO JAVA_HOME set on the machine. The install-docs say that it uses the registry or JAVA_HOME. I don't see any Path to anything in the registry, and I cannot find it in the config files. There are several JDK's on my machine, and I am having some issues. Thanks Betty This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - 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] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - 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]
Re: Class loader looks in Tomcat work directory and not in webapp directory for resources
It is isn't really meant to be part of the classpath, don't put it in WEB-INF/lib. Put it in some other location under WEB-INF. Should work fine. Tomcat extracts resources (in the classpath) to its work directory. I don't entirely know why, but it might be for performance reasons? Anyway, if you are going to overload the purpose of WEB-INF/lib, you are going to have to expect to run into clashes with container (and not just Tomcat, I imagine). Jake Quoting Oliver Kuntze [EMAIL PROTECTED]: Hi QM, thanks a lot for the prompt answer! Unfortunately I have to provide some application resources in a JAR. I am using hibernate in my persistence layer. I generate my persistent classes and their O/R mappings directly from the database and deploy that stuff to my app. If you don't want to specify all hibernate mappings that hibernate should use one by one you have to provide these mappings in a JAR and read it into hibernate. In that way I don't have to touch any classes in my persistence layer. I just tell hibernate Use whatever mapping you find in this JAR.. The only thing I have to do when implementing the persistence layer of a new app is then call the middlegen hibernate plugin and generate the app specific bos and mappings. The rest is implemented in framework classes that don't have to be changed. I tried to rename the JAR to a ZIP but that does not get accepted and an exception is thrown. Do you have any ideas how to solve this problem? Desperately, Oliver QM qm300 @brandxdev.net To: Tomcat Users List [EMAIL PROTECTED] cc: 17.08.2004 22:28 Subject: Re: Class loader looks in Tomcat work directory and not in webapp directory for Please respond resources to Tomcat Users List On Tue, Aug 17, 2004 at 08:43:54PM +0200, Oliver Kuntze wrote: : For the second resource lookup (the JAR) the class loader searches in : Tomcat 5.0\work\Catalina\localhost\rad_webmodule\loader (Tomcat's work : directory) and not in the webapp classpath under Tomcat 5.0 : \webapps\rad_webmodule\WEB-INF\classes (or in the WEB-INF/lib) where the : JAR is located. Why? That just seems to be where Tomcat5 deploys JARs from WAR files... probably for easy access. Is there any reason you're trying to manipulate JARs directly within your app? If you need to get to a set of files, why not place them under a directory structure in the classpath? -QM -- software -- http://www.brandxdev.net tech news -- http://www.RoarNetworX.com - 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]
Re: SOLVED: How to get the context path for a web application?
Quoting David Wall [EMAIL PROTECTED]: contextPath = path.substring(0, path.lastIndexOf(/)); contextPath = contextPath.substring(contextPath.lastIndexOf(/) + 1); This looks like a reasonable hack, but isn't it true that the filesystem path and the context path don't have to match? For example, I can map to /webapps/ROOT can't I? Or map /myapp to /webapps/somethingelse? David The path returned by context.getResource(/) has nothing whatsoever to do with the file system. By your logic, my app located at C:\apps\myappbuld\target\war, using said method above, would end up with the value war. Yet, it ends up with whatever I set the path to in my context configuration file. If you want to continue to challenge this, do the test yourself. If you find something different than what I describe, let me know. Jake - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Customizing BASIC authentication
You can use request.getRemoteUser() to obtain the username. The password is not really accessible except by examining the http headers. Jake At 11:21 PM 8/13/2004 -0400, you wrote: Hi all, I've been spending the last few hours reading about realms, valves, authenticators and the like, and I'm totally confused. I'm hoping if I describe my situation, someone can help me cut through the fog. I'm working on a simple web app that will feed custom RSS XML to clients that must use basic authentication. In my application, I need to do more than just look up users somewhere. Instead, the login/password values returned via basic authentication headers will be used in some fairly complex ways to both authenticate and then construct the custom response. What is the simplest way to customize basic authentication in Tomcat 4? It seems that realms are not the way to go, since they just handle authentication and have nothing to do with the request/response. Valves/authenticators seem like overkill. Form based authentication is not an option. Can I have Tomcat manage basic authentication headers but pass the login/password values to my code? And can I then have access to that information in the servlet that creates the response? Many thanks, Fred - 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]
Re: SOLVED: How to get the context path for a web application?
To get the context path at init time, try this from: http://cvs.apache.org/viewcvs.cgi/logging-log4j-sandbox/src/java/org/apache/log4j/servlet/InitShutdownController.java /** * Retrieves the context path of the web application from the servlet context. * * @param context the current servlet context * @return the derived context path, guaranteed non-null */ private static String getContextPath(final ServletContext context) { //old way to determine context path //String tempdir = + //context.getAttribute(javax.servlet.context.tempdir); //int lastSlash = tempdir.lastIndexOf(File.separator); //if ((tempdir.length() - 1) lastSlash) { // logHomePropName = tempdir.substring(lastSlash + 1) + .log.home; //} String contextPath = ; try { //use a more standard way to obtain the context path name //which should work across all servers. The tmpdir technique //(above) depends upon the naming scheme that Tomcat uses. String path = context.getResource(/).getPath(); //first remove trailing slash, then take what's left over //which should be the context path less the preceeding //slash such as MyContext contextPath = path.substring(0, path.lastIndexOf(/)); contextPath = contextPath.substring(contextPath.lastIndexOf(/) + 1); } catch (Exception e) { ; } return contextPath; } Jake At 10:28 AM 8/12/2004 +0200, you wrote: On Wed, 11 Aug 2004, David Wall wrote: | The cause for some of these specs is the fact servlet containers aren't | required to run on file systems. For example, they may run entirely | inside a DBMS (and Oracle had such a container for a while), in which | case you must deploy in a packed WAR and the subset under a server's | URL name space is not a hard-drive path. I do know this. | | Nobody cares if this maps to a file system or not. Totally agree - it has nothing at all with filesystem, or whether the webapp is stored on a read-only stone-tablet - I want to know what subset of the webserver's URL namespace I'm mounted beneath, at init time. What I'll do with that information is my business! As this is a static element; the webapp is, -per definition- (The javadoc snippet) mounted beneath a subset of the URL namespace; there is no reason I can fathom why this shouldn't be made available to us coders that are making webapps, at init time. The point is that the webapp won't change mount point from request to request, will it? So the web container must know at init-time which sub-space it will mount the webapp under.. Just please make that information available then, at init time! IMO, that is. ( -My- use-case is, as mentioned, that I want to make it easy for developers to override some (development-)settings of the framework. In the webapp I'll check whether it is possible to do file-system access and System-property-getting, and if so, then check for and read the files $userdir/devel/develconfig.xml, and then $userdir/devel/webappname/develconfig.xml. It if it is not possible, then I won't do that, and assume that I am in a production environment or something. ) I'd just love to see this extra method added. Endre. - 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]
RE: serialized objects invalidating session
This is all based purely on my observation of Tomcat behavior and hasn't been verified by looking at the code. With that said Recent versions of Tomcat will trash the serialized session if any of the objects stored there are not Serializable. In the past, non-serializable objects would cause exception to be thrown in an attempt to deserialize them, but the serializable objects of the session survived. It is all or none now. I suspect that there is at least one non-serializable object in your session. It might not even be something you are meaning to put there. It might be something added by the presentation framework you are using without your knowledge. I'd bet that it all works for you in a simple test of adding a string to the session. You'll just have to fetter out which object is the non-serializable one. Keep in mind that a non-serializable member variable of an otherwise serializable object will cause a deserialization exception. Jake Quoting Shapira, Yoav [EMAIL PROTECTED]: Hi, Does this behavior also happen for you in 5.0.27? Yoav Shapira Millennium Research Informatics -Original Message- From: Carey Boldenow [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 10, 2004 10:05 AM To: 'Tomcat Users List' Subject: RE: serialized objects invalidating session Hi, I am using version 5.0.19. The objects that I am serializing contain nothing but String attributes and a Collection of other String objects. After shutting down Tomcat, I can view the SESSIONS.SER file and I can make out what appears to be those objects. However, once I restart Tomcat, and invoke request.isRequestedSessionIdValid(), it returns false. However, it returns true if I do not serialize my objects. Regards, Carey -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 10, 2004 7:54 AM To: Tomcat Users List Subject: RE: serialized objects invalidating session Hi, 5.0.27 is stable. Yoav Shapira Millennium Research Informatics -Original Message- From: Alex [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 10, 2004 9:17 AM To: Tomcat Users List Subject: RE: serialized objects invalidating session is 5.0.27 no longer beta? sometimes i see you folks posting to tomcat-dev@ when new releases are available...but i never saw anything stating it's moved out of beta. On Tue, 10 Aug 2004, Shapira, Yoav wrote: Date: Tue, 10 Aug 2004 08:56:36 -0400 From: Shapira, Yoav [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: RE: serialized objects invalidating session Hi, Needless to say, it works for me ;) We routinely save/restore sessions with Serializable attributes. (Although you didn't specify what Tomcat release you're using, I'm assuming and using 5.0.27). Yoav Shapira Millennium Research Informatics - 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] - 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]
RE: serialized objects invalidating session
Try using this session binding listener (see attached) with the following configuration in web.xml... listener listener-classorg.mypackage.servlet.MySessionBindingListener/listener-class /listener That should log any session activity as it happens. BTW, you mentioned that you were implementing Serializable and then went on to say that you weren't doing anything with readObject() and writeObject() (which is perfectly fine), but never mentioned whether you had a member variable which wasn't, itself, Serializable. This would cause your object to not be serializable. Like I said before, try setting some strings to the session and see if they come back alright after restart. You might also want to delete the work directory and start fresh. Have you done anything with Tomcat's configuration? If so, try blowing away Tomcat and starting fresh. Tomcat persists sessions just fine. Take Yoav's advice and do a serialization test outside the container using ObjectOutputStream. For instance... String hello = hello world; ByteArrayOutputStream byteOut = new ByteArrayOutputStream(); ObjectOutputStream objectOut = new ObjectOutputStream(byteOut); objectOut.writeObject(hello); objectOut.close(); ByteArrayInputStream byteIn = new ByteArrayInputStream(byteOut.toByteArray()); ObjectInputStream objectIn = new ObjectInputStream(byteIn); String helloDeserialized = (String) objectIn.readObject(); Just replace the hello string with your own object and see what happens. BTW, the stdOut.log file getting cleared upon restart is expected behavior. Jake At 08:41 PM 8/10/2004 -0500, you wrote: Hi Yoav, Thanks for your help, but I give up. I can't persist a session anymore if my life depended on it :-) I tried putting the distributable element in my application web.xml, in my context xml file in Tomcat (in the conf/Catalina/localhost/appname.xml file, and in the server.xml file, but to no avail. I set it to true, to false, and no matter what I could not create a SESSION.SER file anywhere. I monitored the sessions through the Management console, and it always went back to 0 after a Tomcat start and stop. At least with 5.0.19 I could get my sessions to persist if I didn't serialize any of the objects in the sessions. One other thing I noticed with 5.0.27 is that when you stop and start, the stdXXX log files get deleted automatically, which I guess is a good thing/bad thing depending on your need to see what has transpired over a period of time. Thanks again for your help! Carey -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 10, 2004 12:17 PM To: Tomcat Users List Subject: RE: serialized objects invalidating session Hi, My first question is is there a configuration parameter I need to set to allow Tomcat to serialize the sessions in 5.0.27? Tomcat serializes sessions by default, as required by the Servlet Specification. This specific behavior is controlled by the Manager element in your server.xml (this is not the same as the Manager webapp), whose docs are at http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/manager.html. ... or what may be happening is that per Jacob's response, there is some other object in the session that does not implement the Serializable interface, so therefore, the whole thing is trashed. FYI, my object is simply implementing the Serializable interface. I am doing nothing else like implementing readObject, writeObject, etc.. You don't need to implement the custom serialization methods: declaring that you implement Serializable is sufficient. You can test to see if your class is serializable by trying to serialize it outside of Tomcat, it's pretty trivial to do with a ByteArrayOutputStream. Or commons-lang's SerializationUtils. Try setting the distributable flag of your Context to true. Let us know if the behavior changes then. The relevant code is at http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-catalina/catalina/src/s hare/org/apache/catalina/session/StandardSession.java?view=markup, specifically the writeObject method. Non-Serializable attributes are unbound. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - 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] package org.mypackage.servlet; import javax.servlet.http.*; public class
Re: 'tomcat' XP starting as a service - not starting/not listed
It should be listed as Apache Tomcat. How did you install? It should be... %CATALINA_HOME%\bin\tomcat5.exe [install | remove] Make sure when you install that you do it under an administrator account, otherwise the command will look as if it succeeded, but the service won't exist. Just start up a cmd prompt using run as and some administrator. You'll have to do the same thing when bringing up the services applet in order to be able to start/stop the service. Jake At 09:18 PM 8/8/2004 -0700, you wrote: List; I am new to tomcat and am trying to work my way through the needed setup and configuration by trial and error (what else is new..). PLATFORM: Windows XP ISSUE, I am not seeing the 'tomcat' service when I look in 'services'. I noted ~/bin/'TOMCAT' service file in the bin directory but do not know how to set this up to actually run as a service I tried properties RUN AS but it was already set to run as my account which has administer already. Question, how do I cause 'tomcat' to run as a service. This is a newbie type of question, and thanks for your patience! Jon - 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]
Re: [5.0.27] org.w3c.dom.Document.getElementById() not working - worked with Resin-2.11
Please verify that your XHTML is valid using: http://validator.w3.org/ Jake Quoting Jens Ansorg [EMAIL PROTECTED]: hi, I have a class that reads XHTML files and deals with them as dom document. javax.xml.parsers.DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); javax.xml.parsers.DocumentBuilder builder = factory.newDocumentBuilder(); org.w3c.dom.Document doc = builder.parse(new File(getUrl())); one method tries to get a certain element in this dom org.w3c.dom.Element contentElement = doc.getElementById(content); unfortunately this code fails, contentElement is always null. another method grabs all Anchors and deals with them org.w3c.dom.NodeList links = doc.getElementsByTagName(a); for (int i = 0; i links.getLength(); i++) { org.w3c.dom.Node link = links.item(i); //... do something useful ... } this code works! the class runs fine on a Resin Server but fails on Tomcat 5.0.27 any ideas how to get this working on tomcat? thanks Jens - 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]
Re: Running Tomcat as service on Win2000 Server
1. Download Tomcat 2. Unzip the archive to a directory 3. Set CATALINA_HOME 4. Open a command prompt and type... %CATALINA_HOME%\bin\service.bat [install | remove] 5. Open the services applet from the admin tools 6. Start the Apache Tomcat service Note that I've had to add JAVA_HOME/lib/tools.jar to the classpath (inside service.bat) in order for JSP compilation to work properly, but servlets should run fine with the stock service.bat. Jake At 12:14 PM 7/15/2004 +0800, you wrote: Hello! Can anybody tell me how to run Tomcat 5.0.25 as a SERVICE on windows 2000 server? Please in step by step explanation... Thanks a lot!!! -Original Message- From: Birt, Jeffrey [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 5:28 AM To: Tomcat Users List Subject: RE: Running Tomcat as service on Win2003 Server Web Edition will not run any 'Enterprise' Applications (from MS at least). I've tried SQL 2000 with no luck. Jeff Birt Electronics Engineer Integrated Systems Facility University of Missouri - Rolla 573.341.6058 -Original Message- From: Ty Mercer [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 14, 2004 2:50 PM To: Tomcat Users List Subject: Re: Running Tomcat as service on Win2003 Server wha The actual limitations are max number of cpu's, disk size and memory, not applications. I have no issues with any type of program not loading on a web edition install of 2k3 over one of Standard or Enterprise 2k3. The error log that Tomcat generates is going to provide more information that the windows Event log. I have tomcat running on several 2k3 web editon servers just fine, yet they are running with apache and not IIS (they are running as services though). Can you provide some more info on your configuration to assist in troubleshooting? On Wed, 14 Jul 2004 12:25:04 -0500, Birt, Jeffrey [EMAIL PROTECTED] wrote: What version of Win2003 sever are you running, Standard, Web Edition? Web edition is made only to serve web pages. Some software won't even LOAD on it. Jeff Birt Electronics Engineer Integrated Systems Facility University of Missouri - Rolla 573.341.6058 -Original Message- From: Bui, Bao-Ha D [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 14, 2004 11:03 AM To: 'Tomcat Users List' Subject: Running Tomcat as service on Win2003 Server Hello, I am trying to set up Tomcat 4.0.2 to run as service on Win2003 server with IIS 6. The service will start and stop right away. Looking into the event viewer, the log indicated that Tomcat failed to start. Could anyone tell me what's wrong? We have the same version of Tomcat running fine on Win2K server. Thanks very much. Bao-Ha Dam Bui * This communication may contain information that is proprietary, privileged, confidential or legally exempt from disclosure. If you are not a named addressee, you are notified that you are not authorized to read, print, retain, copy or disseminate this communication without the consent of the sender and that doing so may be unlawful. If you have received this communication in error, please notify the sender via return e-mail and delete it from your computer. Thank you. St. Jude Medical, Inc. * - 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] - 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]
Re: session invalidation
At 10:15 AM 7/5/2004 +0200, you wrote: Hello Ashert, may be you ran into the same prob as me i also had the problem, that URL-rewriting under Tomcat 5 did not work although i explicitly used it. I found out, that URL-rewriting does only work, if your application runs in the root context, looking like that in server.xml: Context path= docBase=myWebapp cookies=false / I was running my app under a named context: Context path=myWebapp docBase=myWebapp cookies=false / After changing the context definition to the first sample, URL-rewriting worked fine hope this helps best regards, Well, this helps very little. If you want to help, then provide the version of Tomcat5 you are working with. For all we know it is an old version with a quirky bug that has already been fixed in more recent versions. And if that is true, you are just adding to the confusion saying it is broken when it isn't anymore. If it is still broken, however, it is your duty to report the bug so it can be fixed. Have you done that or even checked if someone else reported it? The Tomcat developers are pretty responsive to fixing bugs. If you have the ability to describe and reproduce this bug and you neglect to do so, then you are doing a disservice to the Tomcat community. Some might disagree with the whole it is your duty part. It is an unwritten rule that, if followed, will provide benefit to yourself and everyone else. Jake Thilo hello, 1. a webapp has a filter, which filters all of the requests to application's servlets. 2. the filter makes a simple check: if (session == null || session.getAttribute(abc) == null) //redirect the request to the login page; else //continue with it as it is 3. if i invalidate the session, and then try to use back button of the browser the filter kicks me to the login page. on tomcat4 this works fine. at least i didn't see any problem ever. 4. on tomcat 5 this logic works fine only with browser whith enabled cookies. using the session tracking with url rewriting doesn't work.works the debugging shows that the flow runs into the code block that must invalidate the session, but it's not invalidated. i still can get back,see the pages and use the data stored in session!:( did u have any expirience with this stuff? thanks in advance. - 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]
Re: session invalidation
At 10:05 PM 7/5/2004 +0200, you wrote: hey jacob, i tried it on 5.0.16. That's better, now we know that we're dealing with an old release. there is always a chance this was fixed since that version. i didn't find anything about it in the bugzilla. that's why i posted just to ask if someone already met this problem . You had a valid post asking a question (although neglected to mention the version, but that's less important in the context of your question). Note that my response was to Thilo, not to you, because he claimed there existed a bug, but didn't mention any bug report he had made, nor the version with which he was seeing the bug occur. He did more harm than good by posting. i posted another bug earlier (see my utf-8 problem posts) and got an answer that this is not a bug, but the attached solution didn't solve my problem. I'm glad to see you are active in not only helping yourself, but the project as a whole by taking the initiative to post a bug when you encounter it. Sorry you haven't found a solution yet! when i reposted, the answer was that i should write to this board. Yep, sounds like a good idea to me. and please, leave the DUTIES stuff for other discussions. Being that my response was in no way directed at your post, I fail to see how this is relevant to a discussion between the two of us. Jake asher. - Original Message - From: Jacob Kjome [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Sent: Monday, July 05, 2004 8:53 PM Subject: Re: session invalidation At 10:15 AM 7/5/2004 +0200, you wrote: Hello Ashert, may be you ran into the same prob as me i also had the problem, that URL-rewriting under Tomcat 5 did not work although i explicitly used it. I found out, that URL-rewriting does only work, if your application runs in the root context, looking like that in server.xml: Context path= docBase=myWebapp cookies=false / I was running my app under a named context: Context path=myWebapp docBase=myWebapp cookies=false / After changing the context definition to the first sample, URL-rewriting worked fine hope this helps best regards, Well, this helps very little. If you want to help, then provide the version of Tomcat5 you are working with. For all we know it is an old version with a quirky bug that has already been fixed in more recent versions. And if that is true, you are just adding to the confusion saying it is broken when it isn't anymore. If it is still broken, however, it is your duty to report the bug so it can be fixed. Have you done that or even checked if someone else reported it? The Tomcat developers are pretty responsive to fixing bugs. If you have the ability to describe and reproduce this bug and you neglect to do so, then you are doing a disservice to the Tomcat community. Some might disagree with the whole it is your duty part. It is an unwritten rule that, if followed, will provide benefit to yourself and everyone else. Jake Thilo hello, 1. a webapp has a filter, which filters all of the requests to application's servlets. 2. the filter makes a simple check: if (session == null || session.getAttribute(abc) == null) //redirect the request to the login page; else //continue with it as it is 3. if i invalidate the session, and then try to use back button of the browser the filter kicks me to the login page. on tomcat4 this works fine. at least i didn't see any problem ever. 4. on tomcat 5 this logic works fine only with browser whith enabled cookies. using the session tracking with url rewriting doesn't work.works the debugging shows that the flow runs into the code block that must invalidate the session, but it's not invalidated. i still can get back,see the pages and use the data stored in session!:( did u have any expirience with this stuff? thanks in advance. - 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] - 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]
Re: Controlling access to j_security_check
I think Matt Rable has something that does what you need as part of his AppFuse development. http://raibledesigns.com/wiki/Wiki.jsp?page=AppFuse Jake At 10:40 AM 7/3/2004 +0200, you wrote: Hi! I want to limt access to j_security_check. If there have been a certain number of requests to j_security_check with one j_username and some invalid j_password, the following requests to j_security_check with the same j_username shold be redirected to another page where the user has to do some tasks to be able to login again. I found out that it is not possible to plave a Filter in front of j_security_check in tomcat. So what would be a convienient way to control access to j_security_check in tomcat? Regards, Henrik - 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]
Re: strange error when processing stylesheets: tomcat, jdk1.4, windows, xalan
Quoting Martin Monsorno [EMAIL PROTECTED]: Martin Monsorno [EMAIL PROTECTED] writes: Hi *, I get the following error when trying to transform a xml document with a XSLT stylesheet: ; SystemID: jndi:/localhost/ipas/xsl/minutes_pdf.xsl; Line#: 298; Column#: 66 javax.xml.transform.TransformerException: Unknown error in XPath at org.apache.xpath.XPath.bool(XPath.java:411) at org.apache.xalan.templates.ElemIf.execute(ElemIf.java:198) ... In the stylesheet, I test for an empty string: xsl:if test=not(string(./title)) The error occurs: - with ANY test condition that tests for an empty string (e.g. with string-length(./entry) = 0 - with having xalan.jar, xml-apis.jar and xercesImpl.jar in my WEB-INF/lib from any xalan versions of 2.5.0, 2.5.2, 2.6.0 - with Tomcat 4.1.29 on Windows 2000 and JDK 1.4x - NOT with JDK 1.3 Well, this should be obvious by now. JDK1.4+ ships with Xalan. As such, it is an endorsed library. You shouldn't be putting endorsed libraries in WEB-INF/lib. Since Tomcat adds Xerces and xml-apis to common/endorsed, they become endorsed libraries as well. Tomcat classloaders will actively ignore endorsed libraries sitting in WEB-INF/lib. As such, your own versions of the libraries are doing nothing whatsoever being there. If you want to update Tomcat with the latest Xerces and xml-apis, delete the existing ones from common/endorsed and add yours there. You can also add Xalan there, but probably should add it to JAVA_HOME/jre/lib/endorsed (create the directory if it doesn't already exist). I suggest you use the 2jars release to avoid making BCel (which Xalan ships with... and old version at that) an endorsed library. If things don't work after this, then I'm at a loss. - NOT on Linux - NOT with resin Ah, yes, and it does NOT occur when running the transforming by directly calling xalan from the command line and not via TomCat! Jake -- Martin - 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]
Re: XSLT transformations with tomcat
Quoting Martin Monsorno [EMAIL PROTECTED]: Hi *, I have some questions about XSLT transformations with tomcat (4 and 5). 1.) There doesn't seem to be a XSLT-processor included in TomCat. Isn't this mandatory for a J2EE web container? Isn't this needed for the transform taglibs? 2.) When removing the xalan.jar-package from my web-app, I get the following error: javax.xml.transform.TransformerFactoryConfigurationError: Provider org.apache.xalan.processor.TransformerFactoryImpl not found Why does tomcat looks after the org.apache.xalan.processor.TransformerFactoryImpl class? I didn't configured this implementation for being used. You do realize that JDK1.4+ comes with Xalan as the default XSLT processor, right? You wouldn't have needed to specifically configure this implementation because it is the default. And you also shouldn't put xalan.jar in WEB-INF/lib since Xalan is an endorsed library. If you want to the JDK to use a newer version of Xalan, put the new copy in JAVA_HOME/jre/lib/endorsed or CATALINA_HOME/common/endorsed. I would also suggest usin the 2jars distribution rather than the normal distribution so that you don't end up making BCel an endorsed library. Xalan ships with an older version of BCel embedded in its default jar to enable XSLTC. The 2jars distribution keeps the core of Xalan and XSLTC stuff separated. Jake Thanks for your help, -- Martin - 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]
RE: Please Help!
You specify Tomcat5.0. If that's true, you are using a pre-release version of Tomcat5. Update to the latest official version (or Tomcat-5.0.27beta) and retest. Make sure your driver is in common/lib as well. Note that CATALINA_HOME/bin/service.bat can be used to install/remove the service. Make sure to set your CATALINA_HOME variable before you run service.bat. Jake Quoting Aris Javier [EMAIL PROTECTED]: Thanks! My system works fine when i run tomcat5.0 in console... but when i run tomcat5.0 in service, this error occurs... org.apache.commons.dbcp.DbcpException: java.sql.SQLException: General error I already declared my enviroment variables.. i declared bootstrap.jar and tools.jar in classpath... anyway, here's my system info... OS: Windows 2000 Database: MS Access 2000 System DSN: EZX_DS Technology: Java Servlet/JSP MVC Tomcat Folder: D:\Tomcat_5.0 Server.xml context... Context path=/tees docBase=tees debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_tees_log. suffix=.txt timestamp=true/ Resource name=jdbc/EZX_DS auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/EZX_DS parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value100/value /parameter parameter namemaxIdle/name value30/value /parameter parameter namemaxWait/name value1/value /parameter parameter namedriverClassName/name valuesun.jdbc.odbc.JdbcOdbcDriver/value /parameter parameter nameurl/name valuejdbc:odbc:EZX_DS/value /parameter /ResourceParams /Context Web.xml contains... web-app display-nameEAZIX TEES Tomcat to Access/display-name resource-ref descriptionDB Connection/description res-ref-namejdbc/EZX_DS/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref context-param param-nameconfigFile/param-name param-valued:\\eazixprojects\\tees\\xml\\mapping.xml/param-value /context-param servlet servlet-nameEazixServlet/servlet-name servlet-classtees.main.util.EazixServlet/servlet-class /servlet servlet-mapping servlet-nameEazixServlet/servlet-name url-pattern*.ezx/url-pattern /servlet-mapping servlet servlet-nameCewolfServlet/servlet-name servlet-classde.laures.cewolf.CewolfRenderer/servlet-class !-- sets overlib.js location relative to webapp -- init-param param-nameoverliburl/param-name param-valueD:\\eazixprojects\\tees\\js\\etc\\overlib.js/param-value /init-param !-- turn on or off debugging logging -- init-param param-namedebug/param-name param-valuetrue/param-value /init-param load-on-startup1/load-on-startup /servlet servlet-mapping servlet-nameCewolfServlet/servlet-name url-pattern/cewolf/*/url-pattern /servlet-mapping welcome-file-list welcome-filewelcome.jsp/welcome-file /welcome-file-list error-page locationmsewFailed.jsp/location /error-page /web-app -Original Message- From: Kunthar [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 29, 2004 3:41 PM To: Tomcat Users List Subject: Re: Please Help! Hello, Please give us more detail. Your OS and database to connect to, Send your server.xml and web.xml definitions. Then we can have clear idea... Take care Gokhan Aris Javier wrote: Please Help! This error kept on bugging me everytime i run tomcat5 as service... My environment variables are already declared as well as my system dsn... but still... org.apache.commons.dbcp.DbcpException: java.sql.SQLException: General error Please Help! Thanks! - 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] - To
Re: docbase=myapp.war does not work correctly
that's just behavior you will have to live with if you insist on using an ancient (by today's standards) version of Tomcat. Upgrade to the latest Tomcat5 release and do docBase=myapp.war and the WAR file *will* be unpacked. Jake Quoting Woodchuck [EMAIL PROTECTED]: i'm using tomcat 4.1.24 i have both unpackWARs and autoDeploy set to true. i have a context for myapp defined: Context path=/myapp docBase=myapp debug=0 reloadable=true tomcat is not expanding my myapp.war file. why is this? so after reading archives people suggested setting docbase=myapp.war so i did that, but my application is not working correctly, there are run-time nullpointer exceptions. however, if i manually unpack my war, my app works fine, no errors. why is tomcat not unpacking? (or why does setting docBase=myapp.war not work 100%?) __ Do you Yahoo!? Yahoo! Mail is new and improved - Check it out! http://promotions.yahoo.com/new_mail - 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]
Re: Please Help! Tomcat 5.0.25
At 09:37 AM 6/30/2004 +0800, you wrote: Hello! I installed Tomcat 5.0.25 i noticed that tomcat won't start unless i first make service install command? under catalina_home/bin/service.bat also, after running tomcat service... my previous error (org.apache.commons.dbcp.DbcpException: java.sql.SQLException: General) was converted to org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory, cause: General error I see you are using the sun.jdbc.odbc.JdbcOdbcDriver driver. This is a bad idea. What Database are you connecting to? You should use the driver made for that database. However, I think the error is coming from not having tools.jar in the classpath. You'll have to add this to service.bat. You might also notice that JSP's don't compile for the same reason. I have asked the Tomcat developers to add tools.jar to classpath in service.bat, but it never seems to get done. I have created my own copy of service.bat that works better for me and brings it more in line with starting from the startup.bat file. I'll attach it. Jake but when i run startup.bat, no error occured... what's the difference then? running tomcat as a service and running tomcat using startup.bat...??? i need to run my application as a service.. so that it will keep on running eventhough i'm not logged-in... -Original Message- From: Aris Javier Sent: Wednesday, June 30, 2004 8:22 AM To: Tomcat Users List Subject: RE: Please Help! My current tomcat version is tomcat5.0.7 also, i dont see service.bat under catalina_home/bin folder... do i have to download latest tomcat version? -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 29, 2004 11:46 PM To: Tomcat Users List Subject: RE: Please Help! You specify Tomcat5.0. If that's true, you are using a pre-release version of Tomcat5. Update to the latest official version (or Tomcat-5.0.27beta) and retest. Make sure your driver is in common/lib as well. Note that CATALINA_HOME/bin/service.bat can be used to install/remove the service. Make sure to set your CATALINA_HOME variable before you run service.bat. Jake Quoting Aris Javier [EMAIL PROTECTED]: Thanks! My system works fine when i run tomcat5.0 in console... but when i run tomcat5.0 in service, this error occurs... org.apache.commons.dbcp.DbcpException: java.sql.SQLException: General error I already declared my enviroment variables.. i declared bootstrap.jar and tools.jar in classpath... anyway, here's my system info... OS: Windows 2000 Database: MS Access 2000 System DSN: EZX_DS Technology: Java Servlet/JSP MVC Tomcat Folder: D:\Tomcat_5.0 Server.xml context... Context path=/tees docBase=tees debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_tees_log. suffix=.txt timestamp=true/ Resource name=jdbc/EZX_DS auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/EZX_DS parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value100/value /parameter parameter namemaxIdle/name value30/value /parameter parameter namemaxWait/name value1/value /parameter parameter namedriverClassName/name valuesun.jdbc.odbc.JdbcOdbcDriver/value /parameter parameter nameurl/name valuejdbc:odbc:EZX_DS/value /parameter /ResourceParams /Context Web.xml contains... web-app display-nameEAZIX TEES Tomcat to Access/display-name resource-ref descriptionDB Connection/description res-ref-namejdbc/EZX_DS/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref context-param param-nameconfigFile/param-name param-valued:\\eazixprojects\\tees\\xml\\mapping.xml/param-value /context-param servlet servlet-nameEazixServlet/servlet-name servlet-classtees.main.util.EazixServlet/servlet-class /servlet servlet-mapping servlet-nameEazixServlet/servlet-name url-pattern*.ezx/url-pattern /servlet-mapping servlet servlet-nameCewolfServlet/servlet-name servlet-classde.laures.cewolf.CewolfRenderer/servlet-class !-- sets overlib.js location relative to webapp -- init-param param-nameoverliburl/param-name param-valueD:\\eazixprojects\\tees\\js\\etc
RE: Please Help! Tomcat 5.0.25
I'm at a loss at this point. I'm not sure if there is a specific JDBC driver for Access. I would avoid using Access anyway, but I suppose it might not be by choice. Hopefully someone else will know what is up with using the Sun driver and the Tomcat service. BTW, you did do service remove and then service install, right? Jake At 12:16 PM 6/30/2004 +0800, you wrote: Still the same error occured after replacing my service.bat with your service.bat... (declares tools.jar inside) =| org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory, cause: General error When i run startup.bat... it worked fine again... the following are the logged scripts in MS DOS when i run startup.bat... Jun 30, 2004 11:59:11 AM org.apache.coyote.http11.Http11Protocol init INFO: Initializing Coyote HTTP/1.1 on http-8080 Jun 30, 2004 11:59:11 AM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 7240 ms Jun 30, 2004 11:59:12 AM org.apache.catalina.core.StandardService start INFO: Starting service Catalina Jun 30, 2004 11:59:12 AM org.apache.catalina.core.StandardEngine start INFO: Starting Servlet Engine: Apache Tomcat/5.0.25 Jun 30, 2004 11:59:12 AM org.apache.catalina.core.StandardHost start INFO: XML validation disabled Jun 30, 2004 11:59:17 AM org.apache.catalina.core.StandardHost getDeployer INFO: Create Host deployer for direct deployment ( non-jmx ) Jun 30, 2004 11:59:17 AM org.apache.catalina.core.StandardHostDeployer install INFO: Processing Context configuration file URL file:D:\Tomcat_5.0\conf\Catalina \localhost\admin.xml Jun 30, 2004 11:59:19 AM org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=tru e Jun 30, 2004 11:59:19 AM org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNul l=true Jun 30, 2004 11:59:21 AM org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='org.apache.webapp.admin.ApplicationResources', retur nNull=true Jun 30, 2004 11:59:30 AM org.apache.catalina.core.StandardHostDeployer install INFO: Processing Context configuration file URL file:D:\Tomcat_5.0\conf\Catalina \localhost\balancer.xml Jun 30, 2004 11:59:31 AM org.apache.catalina.core.StandardHostDeployer install INFO: Processing Context configuration file URL file:D:\Tomcat_5.0\conf\Catalina \localhost\manager.xml Jun 30, 2004 11:59:31 AM org.apache.catalina.core.StandardHostDeployer install INFO: Installing web application at context path /jsp-examples from URL file:D:\ Tomcat_5.0\webapps\jsp-examples Jun 30, 2004 11:59:33 AM org.apache.catalina.core.StandardHostDeployer install INFO: Installing web application at context path from URL file:D:\Tomcat_5.0\we bapps\ROOT Jun 30, 2004 11:59:34 AM org.apache.catalina.core.StandardHostDeployer install INFO: Installing web application at context path /servlets-examples from URL fil e:D:\Tomcat_5.0\webapps\servlets-examples Jun 30, 2004 11:59:35 AM org.apache.catalina.core.StandardHostDeployer install INFO: Installing web application at context path /tomcat-docs from URL file:D:\T omcat_5.0\webapps\tomcat-docs Jun 30, 2004 11:59:35 AM org.apache.catalina.core.StandardHostDeployer install INFO: Installing web application at context path /webdav from URL file:D:\Tomcat _5.0\webapps\webdav Jun 30, 2004 11:59:36 AM org.apache.coyote.http11.Http11Protocol start INFO: Starting Coyote HTTP/1.1 on http-8080 Jun 30, 2004 11:59:38 AM org.apache.jk.common.ChannelSocket init INFO: JK2: ajp13 listening on /0.0.0.0:8009 Jun 30, 2004 11:59:38 AM org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=0/280 config=D:\Tomcat_5.0\conf\jk2.properties Jun 30, 2004 11:59:38 AM org.apache.catalina.startup.Catalina start INFO: Server startup in 26689 ms -Original Message- From: Aris Javier Sent: Wednesday, June 30, 2004 11:36 AM To: Tomcat Users List Subject: RE: Please Help! Tomcat 5.0.25 Thanks for the updated service.bat Sir Jake! I'll test it at once... Regarding my database... I'm just using MS Access 2000... I don't know what driver to use or how to install or configure it that's why I use sun.jdbc.odbc.JdbcOdbcDriver driver. What do you think is the proper driver for MS Access 2000? and how to install it...? Thanks! I'll test your updated service.bat and update you of my progress... -Original Message- From: Jacob Kjome [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 30, 2004 10:52 AM To: Tomcat Users List Subject: Re: Please Help! Tomcat 5.0.25 At 09:37 AM 6/30/2004 +0800, you wrote: Hello! I installed Tomcat 5.0.25 i noticed that tomcat won't start unless i first make service install command? under catalina_home/bin/service.bat also, after running tomcat service... my previous error (org.apache.commons.dbcp.DbcpException: java.sql.SQLException: General) was converted to org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory
Re: problem with classpath
You can achieve this by using the thread context class loader.. Thread.currentThread().getContextClassLoader().getResourceAsStream(client1.properties); Or, just pass the classloader to the classes that need to load the properties files and you will get the same effect. Jake At 11:44 AM 6/26/2004 +0530, you wrote: I wanted some info on using single instance of tomcat for managing multiple web applications. I am repeating my question below, please help me out with the same ... I am running an application for multiple clients and the setup is like the set of classes being used are common and the property files are different for each client. The structure looks as below : /usr/local/common_application_classes/ - this folder contains all classes /usr/local/properties/client1/ - this folder contains properties of client1 /usr/local/properties/client2/ - this folder contains properties of client2 .. etc for all the different clients. Now, this is a web based application and the classes in the /usr/local/common_application_classes/ are being used from the web application (servlet, jsp files). The properties files are being used from the classes contained in the /usr/local/common_application_classes/ folder. I want to setup a common tomcat (preferabbly tomcat3, or tomcat4) for all these clients, but how should I setup the classpath? /usr/local/common_application_classes/ should be in tomcat's classpath. But, properties files are different for different classes, so thought of creating single tomcat and under that, multiple contexts, one for each client and the properties files goes in the respective client's context/WEB-INF/classes. But, since the classes accessing the properties files are outside tomcat (not in context/WEB-INF/classes), are not being able to access properties files - gives MissingResourceException. Let say, I have a test.jsp file in context /test, which calls a TestClass.class file and this TestClass.class file is looking up some property file through ResourceBundle. The property file is in /test/WEB-INF/classes/ directory. Now, if the TestClass.class is in /test/WEB-INF/classes, then it works perfectly fine, but if the TestClass.class is outside tomcat (included in tomcat's classpath), then it gives MissingResourceException while looking up property file. Please give me some direction to prceed further - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, June 22, 2004 11:45 AM Subject: Re: problem with classpath i am sorry you got a wrong address here i don't know who you are and what you are talking about - 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]
Re: class loader interdependencies
At 12:12 PM 6/26/2004 +0530, you wrote: Let say, my physical class file is located in /common and I put a soft link to this in the WEB-INF/classes of a webapp. (using the ln command - RH Linux). In this case, this class would be loaded by which class loader? The classloader of the webapp or the common class loader? I'm not entirely sure about soft linking and classloading on Linux, but I can tell you it is probably a bad strategy. You are playing with fire and, even if this works for the moment, will probably get burned in the future. Think about this; if the class is successfully loaded by the parent via the link, will that newly loaded class then have access to it's own dependencies which, presumably, exist in WEB-INF/class or WEB-INF/lib? Even if it did work, you common library would now have loaded a separate class than the classes in WEB-INF/classes and WEB-INF/lib. Not physically separate, but separate because a class' identity is define not only by itself, but by the classloader that loaded it. Again, even if it did work momentarily, you would probably end up with odd ClassCastExceptions. You have to think about classloading behavior from the beginning if you plan on using separate classloaders. Separate components which shouldn't depend on each other at compile time. If you do that, then you will know about classloading dependencies before runtime because nothing will compile until you get it straight. In certain cases, you might find that if you want to share certain libraries, that entails sharing others. In other cases, you can factor out the dependency, thereby creating a better separation of concerns between your classes. Moral of the story. Be wary of using quick fix solutions for classloader problems or use JBoss and figure that everything is in a single classloader. Good luck with that one as well. It always sounds good until you get to the details. Just be wary. Jake Ankit - Original Message - From: Cox, Charlie [EMAIL PROTECTED] To: 'Tomcat Users List' [EMAIL PROTECTED] Sent: Friday, June 25, 2004 7:27 PM Subject: RE: class loader interdependencies Classes in /common and /shared can not see classes in /WEB-INF. A class loaded by the nth classloader will not see any classes loaded by (n-1) classloader. However, it will see classes loaded by n+1 loader. This is the classloader hierarchy. Any classloader only has one parent to which it can delegate any classes that it can not resolve. Since multiple classloaders(one for each webapp) can have the same parent, the common classloader would not know which WEB-INF to reference when searching for a class. Therefore all your classes need to be in /common if any within /common reference them. As an alternate, you can copy all classes to each /WEB-INF. Charlie -Original Message- From: Larry Levin [mailto:[EMAIL PROTECTED] Sent: Friday, June 25, 2004 9:30 AM To: [EMAIL PROTECTED] Subject: class loader interdependencies Hi all; I am trying to share some jars across multiple web-apps, each of which runs in its own environment (i.e, JVM). To do this I make use of the CATALINA_BASE environment variable. My problem is in regards to class loading. I have a number of jar files that are common to each webapp but I also have a couple that are unique to each app. According to the documentation for Tomcat 4.1: from the perspective of a web application, class or resource loading looks in the following repositories, in this order: 1) /WEB-INF/classes of your web application 2) /WEB-INF/lib/*.jar of your web application 3) Bootstrap classes of your JVM 4) System class loader classes 5) $CATALINA_HOME/common/classes 6) $CATALINA_HOME/common/endorsed/*.jar 7) $CATALINA_HOME/common/lib/*.jar 8) $CATALINA_BASE/shared/classes 9) $CATALINA_BASE/shared/lib/*.jar I have therefore tried two different approaches, both of which fail for the same reason. 1st approach: I modified the standard startup script to add the shared jars to the CLASSPATH, thereby treating them as System class loader classes (i.e., category #4 in the above sequence). 2nd approach: I placed the shared jars in $CATALINA_HOME/common/lib (i.e., category #7 in the above sequence). In both cases everything works fine UNTIL one of these shared classes needs to access a class located in one of the /WEB-INF/lib/*.jar of a web application (i.e., category #2). At that point my code throws a ClassNotFoundException. My impression is that something in the class loader procedures prevents loading backwards by which I mean: IF Class X was loaded by the nth loader in the sequence (e.g., #4, the system loader), AND Class X references a previously unloaded class, THEN Tomcat will ignore any loader lower in the sequence the Class X's loader (e.g., loaders 1-3 (the /WEB-INF and bootstrap loaders in this example))