title: Tomcat 6 customized Realm
body: <p>I'm trying to write my own Realm to authenticate my users.
  I have written a class extending org.apache.catalina.realm.RealmBase, compiled to a .jar file and put it in the /lib library.
  Then I added this to server.xml:</p>
  
  <pre><code>&lt;Realm className="wstest.tomcat.security.MyRealm"
               resourceName="myrealm"/&gt;
  </code></pre>
  
  <p>Tomcat doesn't seem to "see" my new jar...
  When I start Tomcat I get:</p>
  
  <pre><code>ERROR main org.apache.commons.digester.Digester - Begin event threw exception
  java.lang.ClassNotFoundException: wstest.tomcat.security.MyRealm
      at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
      at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:205)
      at org.apache.tomcat.util.digester.Rule.begin(Rule.java:153)
      at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1356)
      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:501)
      at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:179)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1343)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
      at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
      at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
      at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
      at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
      at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
      at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1642)
      at org.apache.catalina.startup.Catalina.load(Catalina.java:526)
      at org.apache.catalina.startup.Catalina.load(Catalina.java:560)
      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:597)
      at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:261)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
  </code></pre>