tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Buglass <adam.bugl...@ncl.ac.uk>
Subject Re: Problems with JSP pages.
Date Fri, 30 Apr 2004 10:00:42 GMT
Can you post the code for the 2 pages please?
Thanks!

On Fri, 2004-04-30 at 08:51, Thomas, Kevin [OS-IE] wrote:
> Hi there,
> 
> This is my first post to this list so I hope I'm directing it at the right
> guys. Apologies if I'm not.
> 
> I'm running Tomcat 4.0 on a Sun box and everything has been going great on I
> stumbled upon a bizarre problem.
> 
> I have a two jsp pages residing in a "test" directory and I use the first to
> enter some values in a form which is passed to the second page that uses an
> JDBC connection to pull back data from an Oracle db.
> 
> The pages work fine in this directory however, I created a new context, and
> along with it a new directory and copied the 2 jsp pages into this new
> directory. I started the webapp in this new directory and then navigated to
> the page in Explorer. Immediately the page loaded, the included header.htm
> file loaded no problem but the rest of the page didn't. Checking the logs I
> saw the following:
> 
> ava.lang.ArrayIndexOutOfBoundsException
>         at org.apache.jsp.ack_0005findex$jsp._jspService(Unknown Source)
>         at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at org.apache.jasper.servlet.JspServletWrapper.service(Unknown
> Source)
>         at org.apache.jasper.servlet.JspServlet.serviceJspFile(Unknown
> Source)
>         at org.apache.jasper.servlet.JspServlet.service(Unknown Source)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknown
> Source)
>         at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown
> Source)
>         at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown
> Source)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(Unknown Source)
>         at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
>         at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
>         at org.apache.catalina.core.StandardContextValve.invoke(Unknown
> Source)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(Unknown Source)
>         at
> org.apache.catalina.authenticator.AuthenticatorBase.invoke(Unknown Source)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(Unknown Source)
>         at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
>         at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
>         at org.apache.catalina.core.StandardContext.invoke(Unknown Source)
>         at org.apache.catalina.core.StandardHostValve.invoke(Unknown Source)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(Unknown Source)
>         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(Unknown
> Source)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(Unknown Source)
>         at org.apache.catalina.valves.ErrorReportValve.invoke(Unknown
> Source)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(Unknown Source)
>         at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
>         at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
>         at org.apache.catalina.core.StandardEngineValve.invoke(Unknown
> Source)
>         at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invok
> eNext(Unknown Source)
>         at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source)
>         at org.apache.catalina.core.ContainerBase.invoke(Unknown Source)
>         at
> org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
>         at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
>         at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne
> ction(Http11Protocol.java:376)
>         at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
>         at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
> a:518)
>         at java.lang.Thread.run(Thread.java:479)
> 
> The second jsp page loads no problem at all if I type the address straight
> into the address bar on explorer with all the right parameters. So why will
> the first page work in one directory but not in another?
> 
> Any thoughts, comments on pointers in the right direction would be really
> welcome.
> 
> Cheers,
> Kev.
> 
> __________________ 
>  
> Kevin Thomas 
> Senior Technical Analyst 
> Technical Authority, Deregulated Applications
> Utilities Group, SAIC Ltd. 
> 5 Redwood Place 
> Peel Park 
> East Kilbride 
> G74 5PB 
> Tel: 013558 45260 ( 708 5260 internal ) 
> mailto: kevin.thomas@saic.com
> web: http://www.saic.com
> 
> 
> -----Original Message-----
> From: Shane Linley [mailto:shane.linley@omegatrend.com] 
> Sent: 30 April 2004 08:21
> To: Tomcat Users List
> Subject: RE: Log4j problems in Tomcat 5.x
> 
> Having successfully configuring log4j and after doing some experiments with
> Tomcat I've decided to step into the fray!
> 
> I will use 2 steps actually. Log4j for Tomcat and for Webapp. This was
> tested using TC 5.0.19 on a Windows XP machine... yes, yes, please try to
> forgive me now....
> 
> 
> Tomcat Log4j Configuration for TC5 (tested on TC 5.0.19)
> 
> 1. Obtain a recent Log4j jar file, i used log4j-1.2.8.jar
> 2. Place it in the TC common lib directory (<CATALINA_HOME>\common\lib)
> 3. Construct a log4j.properties file and place it in the TC common classes
> directory (<CATALINA_HOME>\common\classes)
> 
> Sample log4j.properties used for my test (also attached):
> 
> 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
> log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
> 
> log4j.logger.org.apache=DEBUG
> 
> 4. Start TC5 and watch the logging kick in, a sample log file is attached.
> 
> WARNING: Performance will suffer
> 
> 
> 
> Tomcat Log4j for Webapp
> 
> The steps for this were stated in an earlier mail, its quite simple to do.
> 
> 1. Place the log4j-1.2.8.jar in to the web-inf lib directory (/WEB-INF/lib)
> 1.1 I also placed the commons-logging.jar file in my web-app also as I am
> quite confortable with commons logging.
> 2. Place your log4j.properties file in the web-inf classes directory
> (WEB-INF/classes)
> 3. Configure your log4j.properties file as appropriate for your application.
> 
> As one person was enquiring about, i did activate the struts and file upload
> logging in my webapp at one time to diagnose a problem, here is the config
> i used:
> 
> 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
> log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
> 
> # Print only messages of level DEBUG or above in the Apache commons and
> struts file upload
> log4j.logger.org.apache.commons.httpclient=DEBUG
> log4j.logger.org.apache.commons.fileupload=DEBUG
> log4j.logger.org.apache.struts.upload=DEBUG
> 
> WARNING: There will be a performance impact with the above logging! :)
> WARNING: You can also activate TC logging as well from this log4j.properties
> file so don't be too general with your package paths, as again turning on to
> much logging with affect performance.
> 
> 4. Instantiate your logging class in whatever way you see fit and run your
> webapp and the logging will be activated.
> 
> If i've botched up my explanation let me know and I will correct it.
> 
> Regards,
> Shane.
> 
> -----Original Message-----
> From: Michael Greer [mailto:michaelggreer@earthlink.net]
> Sent: Friday, 30 April 2004 5:45 AM
> To: Tomcat Users List
> Subject: Re: Log4j problems in Tomcat 5.x
> 
> 
> I couldn't get it to work by following these suggestions either:
> - putting Log4J in the system classpath
> - explicitly adding Log4J and the full commons-logging.jar to the
> startup classpath
> - replacing commons-logging-api.jar with the full commons-logging.jar
> (it needs something special in there, for some reason)
> 
> I have to say, this seems broken to me, unless someone can explain how
> this behavior is intentional. Even if these had worked, this is not a
> clean solution. What is the purpose of using commons-logging if the
> underlying logging system is ignored?
> Again, I am talking about controlling the logging for included
> libraries, not my own code (which avoids the mess that is
> commons-logging).
> 
> -Michael Greer
> 
> On Thursday, April 29, 2004, at 04:53 PM, Filip Hanik - Dev wrote:
> 
> > you do have to replace the commons-logging.jar in TOMCAT/bin with the
> > jar that contains the log4j impl. That is one of the things I
> > found out
> >
> > FIlip
> > ----- Original Message -----
> > From: "Filip Hanik - Dev" <devlists@hanik.com>
> > To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
> > Sent: Thursday, April 29, 2004 3:46 PM
> > Subject: Re: Log4j problems in Tomcat 5.x
> >
> >
> > the commons logging is reading from the System classpath, I messed
> > around with this a while back, and all the binaries are in /bin/
> > so in there you must add some additional libraries, like log4j and
> > some more commons
> >
> > Filip
> > ----- Original Message -----
> > From: "Michael Greer" <michaelggreer@earthlink.net>
> > To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
> > Sent: Thursday, April 29, 2004 2:53 PM
> > Subject: Re: Log4j problems in Tomcat 5.x
> >
> >
> > Sorry, I meant that the Log4J implementation was not found:
> >
> > java.lang.reflect.InvocationTargetException
> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > at
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja
> > v
> > a:39)
> > at
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso
> > r
> > Impl.java:25)
> > at java.lang.reflect.Method.invoke(Method.java:324)
> > at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:297)
> > at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:398)
> > Caused by: java.lang.ExceptionInInitializerError
> > at
> > org.apache.catalina.core.StandardContext.start(StandardContext.java:420
> > 7
> > )
> > at
> > org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1126)
> > at org.apache.catalina.core.StandardHost.start(StandardHost.java:832)
> > at
> > org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1126)
> > at
> > org.apache.catalina.core.StandardEngine.start(StandardEngine.java:521)
> > at
> > org.apache.catalina.core.StandardService.start(StandardService.java:519
> > )
> > at
> > org.apache.catalina.core.StandardServer.start(StandardServer.java:2345)
> > at org.apache.catalina.startup.Catalina.start(Catalina.java:594)
> > ... 6 more
> > Caused by: org.apache.commons.logging.LogConfigurationException:
> > org.apache.commons.logging.LogConfigurationException:
> > java.lang.ClassNotFoundException:
> > org.apache.commons.logging.impl.Log4JLogger
> > at
> > org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryIm
> > p
> > l.java:532)
> > at
> > org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryIm
> > p
> > l.java:272)
> > at
> > org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryIm
> > p
> > l.java:246)
> > at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:395)
> > at org.apache.catalina.startup.TldConfig.<clinit>(TldConfig.java:110)
> > ... 14 more
> > Caused by: org.apache.commons.logging.LogConfigurationException:
> > java.lang.ClassNotFoundException:
> > org.apache.commons.logging.impl.Log4JLogger
> > at
> > org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFac
> > t
> > oryImpl.java:416)
> > at
> > org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryIm
> > p
> > l.java:525)
> > ... 18 more
> > Caused by: java.lang.ClassNotFoundException:
> > org.apache.commons.logging.impl.Log4JLogger
> > at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
> > at java.security.AccessController.doPrivileged(Native Method)
> > at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
> > at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
> > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
> > at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
> > at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
> > at java.lang.Class.forName0(Native Method)
> > at java.lang.Class.forName(Class.java:140)
> > at
> > org.apache.commons.logging.impl.LogFactoryImpl$1.run(LogFactoryImpl.jav
> > a
> > :466)
> > at java.security.AccessController.doPrivileged(Native Method)
> > at
> > org.apache.commons.logging.impl.LogFactoryImpl.loadClass(LogFactoryImpl
> > .
> > java:454)
> > at
> > org.apache.commons.logging.impl.LogFactoryImpl.getLogConstructor(LogFac
> > t
> > oryImpl.java:406)
> > ... 19 more
> >
> > On Thursday, April 29, 2004, at 03:43 PM, Filip Hanik - Dev wrote:
> >
> >> what class is not found? why dont you give us the error message :)
> >> ----- Original Message -----
> >> From: "Michael Greer" <michaelggreer@earthlink.net>
> >> To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
> >> Sent: Thursday, April 29, 2004 2:31 PM
> >> Subject: Log4j problems in Tomcat 5.x
> >>
> >>
> >> hello,
> >> I switched from Tomcat 4 to 5, and ever since have had unsolvable
> >> problems with logging. In short, the commons logger refuses to use
> >> Log4j. This would be fine for Tomcat itself, but all of my classes
> >> that
> >> use commons-logging get taken over in this way. i have moved my own
> >> code to use Log4j directly (so I know it works, and is configured
> >> correctly, and is in the classpath of the context), but all of my jars
> >> that use commons are out of my control.
> >> If I try and force commons to use log4j, ( with
> >> org.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLo
> >> g
> >> g
> >> er in a commons-logging.properties file in /WEB-INF/classes), it gives
> >> me a ClassNotFound exception, no matter where I place the log4j jar.
> >> I have seen many messages on this list related to this issue, but no
> >> solutions. Has anyone come up with anything?
> >>
> >> thank you,
> >> Michael Greer
> >>
> >> PS: I have tried putting the log4j.jar in server/lib. shared/lib,
> >> common/lib. This problem occurs in Linux and Mac OS X. My
> >> log4j.properties file is in my /WEB-INF/classes folder, and is being
> >> read correctly for my own classes which use log4j directly.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message