Hi,
I am trying to implement my own authentication system (extending
AuthenticatorBase).
I would like this valve to be set up at the host level so my server.xml,
looks like
<Host name="localhost" debug="0" appBase="webapps" unpackWARs="true"
autoDeploy="true">
<Context path="/myContext" docBase="ina" debug="0">
<Manager
classname="org.apache.catalina.session.StandardManager" pathname="" />
<Logger
className="org.apache.catalina.logger.FileLogger" directory="logs"
prefix="myLog." suffix=".log" timestamp="true"/>
</Context>
<Logger className="org.apache.catalina.logger.FileLogger"
directory="logs" prefix="localhost_log." suffix=".txt" timestamp="true"/>
<Valve className="com.mycompany.MyAuthenticator"
debug="10" myParam1="p1" myParam2="p2"/>
</Host>
When I try to start my tomcat, it crashes at startup with the following :
....
Catalina.start: java.lang.IllegalArgumentException: Configuration error:
Must be attached to a Context
java.lang.IllegalArgumentException: Configuration error: Must be attached
to a Context
at
org.apache.commons.digester.Digester.createSAXException(Digester.java:2540)
at
org.apache.commons.digester.Digester.createSAXException(Digester.java:2566)
at
org.apache.commons.digester.Digester.endElement(Digester.java:1061)
at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown
Source)
at
org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.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.DTDConfiguration.parse(Unknown
Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown
Source)
at org.apache.commons.digester.Digester.parse(Digester.java:1548)
at org.apache.catalina.startup.Catalina.start(Catalina.java:449)
at org.apache.catalina.startup.Catalina.execute(Catalina.java:400)
at org.apache.catalina.startup.Catalina.process(Catalina.java:180)
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:324)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:203)
First question : Am I trying to do it in the bad way?
Second question : What can be the reason why it crashes when I attach my
valve to the host but starts normally when I attach it to the context?
Thanks for giving opinions.
PS : any link to information related to custom authentication in tomcat is
welcome!!!
Cheers,
Thomas