tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Sabroff <mike.sabr...@cygnusb2b.com>
Subject Re: Context fails to load with Filter
Date Tue, 09 May 2006 16:39:58 GMT
Disreguard my previous statement as I am obviously brain dead....sorry

Mike Sabroff wrote:
> If this is truly what your web.xml looks like, you are missing the end 
> tag '>' in the following line
> <filter-class>com.affinity.tasc.filters.AuthenticateFilter
>
> Jason Beck wrote:
>>
>> Hello list,
>>
>> I have written my first filter and think that I have it right, but 
>> when I
>> try to start Tomcat 5.5.9 after applying the necessary configuration 
>> changes
>> to web.xml, the Context that the Filter is in fails to start.   Perhaps
>> someone can tell me what I may have done wrong.
>>
>> <-- web.xml -->
>>    <filter>
>>       <filter-name>AuthenticateFilter</filter-name>
>>       <filter-class>com.affinity.tasc.filters.AuthenticateFilter
>> </filter-class>
>>    </filter>
>>    <filter-mapping>
>>       <filter-name>AuthenticateFilter</filter-name>
>>       <servlet-name>Index</servlet-name>
>>    </filter-mapping>
>>
>>    <servlet>
>>       <servlet-name>Index</servlet-name>
>>       <servlet-class>com.affinity.tasc.core.Index</servlet-class>
>>    </servlet>
>>    <servlet-mapping>
>>       <servlet-name>Index</servlet-name>
>>       <url-pattern>/Index</url-pattern>
>>    </servlet-mapping>
>>
>> <-- end web.xml -->
>>
>> <-- Filter code -->
>>
>> package com.affinity.tasc.filters;
>>
>> import java.io.IOException;
>> import javax.servlet.*;
>> import javax.servlet.http.*;
>> import com.affinity.tasc.beans.SiteUserBean;
>>
>> public abstract class AuthenticateFilter implements Filter {
>>
>>         private FilterConfig fc;
>>
>>         public void doFilter(ServletRequest req, ServletResponse res,
>> FilterChain chain)
>>                 throws IOException, ServletException {
>>
>>                 /* Make sure we are dealing with HTTP */
>>                 if (req instanceof HttpServletRequest) {
>>                         HttpServletRequest request =
>> (HttpServletRequest)req;
>>                         HttpServletResponse response =
>> (HttpServletResponse)res;
>>
>>                         HttpSession session = request.getSession(false);
>>
>>                         if 
>> (request.getParameter("Authenticate").equals("1"))
>> {
>>
>>                                 try {
>>                                         SiteUserBean user = new
>> SiteUserBean();
>>                                         user.setUsername(
>> request.getParameter("username"));
>>                                         user.setPassword(
>> request.getParameter("password"));
>>
>>                                         int authed = 
>> user.getUserAuthed();
>>
>>                                         /* Successful authentication */
>>                                         if (authed > 0) {
>>                                                 
>> session.setAttribute("user",
>> user);
>>                                         }
>>
>>                                         session.setAttribute("authed",
>> authed);
>>
>>                                 } catch (NullPointerException nx) {
>>                                         nx.printStackTrace();
>>                                 } catch (Exception ex) {
>>                                         ex.printStackTrace();
>>                                 }
>>                         }
>>                 }
>>
>>                 /* Continue filtering */
>>                 chain.doFilter(req, res);
>>         }
>>
>>         public void init(FilterConfig filterConfig) throws 
>> ServletException
>> {
>>                 this.fc = filterConfig;
>>         }
>>
>>         public void destroy() {
>>                 this.fc = null;
>>         }
>> }
>>
>> <-- end filter code -->
>>
>> Here is the output from catalina.out when I try to start tomcat with 
>> this
>> filter installed...
>>
>> May 9, 2006 11:46:31 AM org.apache.coyote.http11.Http11Protocol init
>> INFO: Initializing Coyote HTTP/1.1 on http-8080
>> May 9, 2006 11:46:31 AM org.apache.catalina.startup.Catalina load
>> INFO: Initialization processed in 1270 ms
>> May 9, 2006 11:46:32 AM org.apache.catalina.core.StandardService start
>> INFO: Starting service Catalina
>> May 9, 2006 11:46:32 AM org.apache.catalina.core.StandardEngine start
>> INFO: Starting Servlet Engine: Apache Tomcat/5.5.9
>> May 9, 2006 11:46:32 AM org.apache.catalina.core.StandardHost start
>> INFO: XML validation disabled
>> May 9, 2006 11:46:32 AM org.apache.catalina.core.StandardContext 
>> filterStart
>> SEVERE: Exception starting filter AuthenticateFilter
>> java.lang.InstantiationException
>>         at
>> sun.reflect.InstantiationExceptionConstructorAccessorImpl.newInstance(
>> InstantiationExceptionConstructorAccessorImpl.java:30)
>>         at 
>> java.lang.reflect.Constructor.newInstance(Constructor.java:494)
>>         at java.lang.Class.newInstance0(Class.java:350)
>>         at java.lang.Class.newInstance(Class.java:303)
>>         at org.apache.catalina.core.ApplicationFilterConfig.getFilter(
>> ApplicationFilterConfig.java:212)
>>         at 
>> org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(
>> ApplicationFilterConfig.java:308)
>>         at org.apache.catalina.core.ApplicationFilterConfig.<init>(
>> ApplicationFilterConfig.java:79)
>>         at org.apache.catalina.core.StandardContext.filterStart(
>> StandardContext.java:3540)
>>         at org.apache.catalina.core.StandardContext.start(
>> StandardContext.java:4110)
>>         at 
>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java
>> :1012)
>>         at org.apache.catalina.core.StandardHost.start(StandardHost.java
>> :718)
>>         at 
>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java
>> :1012)
>>         at 
>> org.apache.catalina.core.StandardEngine.start(StandardEngine.java
>> :442)
>>         at org.apache.catalina.core.StandardService.start(
>> StandardService.java:450)
>>         at 
>> org.apache.catalina.core.StandardServer.start(StandardServer.java
>> :683)
>>         at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke(
>> NativeMethodAccessorImpl.java:39)
>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>> DelegatingMethodAccessorImpl.java:25)
>>         at java.lang.reflect.Method.invoke(Method.java:585)
>>         at 
>> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
>>         at 
>> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
>> May 9, 2006 11:46:32 AM org.apache.catalina.core.StandardContext start
>> SEVERE: Error filterStart
>> May 9, 2006 11:46:32 AM org.apache.catalina.core.StandardContext start
>> SEVERE: Context [/TASC] startup failed due to previous errors
>> May 9, 2006 11:46:33 AM org.apache.catalina.core.ApplicationContext log
>> INFO: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [
>> org.apache.webapp.balancer.RuleChain: [
>> org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: 
>> News /
>> Redirect URL: http://www.cnn.com], [
>> org.apache.webapp.balancer.rules.RequestParameterRule: Target param 
>> name:
>> paramName / Target param value: paramValue / Redirect URL:
>> http://www.yahoo.com], [
>> org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL:
>> http://jakarta.apache.org]]
>> May 9, 2006 11:46:33 AM 
>> org.apache.catalina.loader.WebappClassLoaderloadClass
>> INFO: Illegal access: this web application instance has been stopped
>> already.  Could not load org.apache.xerces.impl.dtd.DTDGrammar.  The
>> eventual following stack trace is caused by an error thrown for 
>> debugging
>> purposes as well as to attempt to terminate the thread which caused the
>> illegal access, and has no functional impact.
>> May 9, 2006 11:46:33 AM 
>> org.apache.commons.modeler.RegistryregisterComponent
>> SEVERE: Null component Catalina:type=JspMonitor,name=jsp,WebModule=//sa-
>> test.valueweb.net/servlets-examples,J2EEApplication=none,J2EEServer=none
>> May 9, 2006 11:46:33 AM 
>> org.apache.catalina.startup.HostConfigdeployDirectory
>> SEVERE: Error deploying web application directory servlets-examples
>> java.lang.ThreadDeath
>>         at org.apache.catalina.loader.WebappClassLoader.loadClass(
>> WebappClassLoader.java:1221)
>>         at org.apache.catalina.loader.WebappClassLoader.loadClass(
>> WebappClassLoader.java:1181)
>>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
>>         at 
>> org.apache.xerces.impl.dtd.XMLDTDValidator.doctypeDecl(Unknown
>> Source)
>>         at 
>> org.apache.xerces.impl.XMLDocumentScannerImpl.scanDoctypeDecl(Unknown
>> Source)
>>         at
>> org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(Unknown 
>>
>> Source)
>>         at
>> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown 
>>
>> Source)
>>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
>> Source)
>>         at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
>> Source)
>>         at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
>>         at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown 
>> Source)
>>         at 
>> org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown
>> Source)
>>         at org.apache.tomcat.util.digester.Digester.parse(Digester.java
>> :1561)
>>         at 
>> org.apache.catalina.startup.ContextConfig.applicationWebConfig(
>> ContextConfig.java:339)
>>         at org.apache.catalina.startup.ContextConfig.start(
>> ContextConfig.java:1031)
>>         at org.apache.catalina.startup.ContextConfig.lifecycleEvent(
>> ContextConfig.java:255)
>>         at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
>> LifecycleSupport.java:119)
>>         at org.apache.catalina.core.StandardContext.start(
>> StandardContext.java:4053)
>>         at org.apache.catalina.core.ContainerBase.addChildInternal(
>> ContainerBase.java:759)
>>         at org.apache.catalina.core.ContainerBase.addChild(
>> ContainerBase.java:739)
>>         at 
>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java
>> :524)
>>         at org.apache.catalina.startup.HostConfig.deployDirectory(
>> HostConfig.java:894)
>>         at org.apache.catalina.startup.HostConfig.deployDirectories(
>> HostConfig.java:857)
>>         at 
>> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java
>> :475)
>>         at org.apache.catalina.startup.HostConfig.start(HostConfig.java
>> :1102)
>>         at org.apache.catalina.startup.HostConfig.lifecycleEvent(
>> HostConfig.java:311)
>>         at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(
>> LifecycleSupport.java:119)
>>         at 
>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java
>> :1020)
>>         at org.apache.catalina.core.StandardHost.start(StandardHost.java
>> :718)
>>         at 
>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java
>> :1012)
>>         at 
>> org.apache.catalina.core.StandardEngine.start(StandardEngine.java
>> :442)
>>         at org.apache.catalina.core.StandardService.start(
>> StandardService.java:450)
>>         at 
>> org.apache.catalina.core.StandardServer.start(StandardServer.java
>> :683)
>>         at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>         at sun.reflect.NativeMethodAccessorImpl.invoke(
>> NativeMethodAccessorImpl.java:39)
>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(
>> DelegatingMethodAccessorImpl.java:25)
>>         at java.lang.reflect.Method.invoke(Method.java:585)
>>         at 
>> org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
>>         at 
>> org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)
>> May 9, 2006 11:46:33 AM org.apache.catalina.core.ApplicationContext log
>> INFO: ContextListener: contextInitialized()
>> May 9, 2006 11:46:33 AM org.apache.catalina.core.ApplicationContext log
>> INFO: SessionListener: contextInitialized()
>> May 9, 2006 11:46:34 AM org.apache.coyote.http11.Http11Protocol start
>> INFO: Starting Coyote HTTP/1.1 on http-8080
>> May 9, 2006 11:46:34 AM org.apache.jk.common.ChannelSocket init
>> INFO: JK: ajp13 listening on /0.0.0.0:8009
>> May 9, 2006 11:46:34 AM org.apache.jk.server.JkMain start
>> INFO: Jk running ID=0 time=0/25  config=null
>> May 9, 2006 11:46:34 AM org.apache.catalina.storeconfig.StoreLoader load
>> INFO: Find registry server-registry.xml at classpath resource
>> May 9, 2006 11:46:34 AM org.apache.catalina.startup.Catalina start
>> INFO: Server startup in 2637 ms
>>
>> thanks for your help.
>>
>

-- 
Mike Sabroff
Web Services Developer
mike.sabroff@cygnusb2b.com
920-568-8379


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


Mime
View raw message