Maven tomcat-plugin cannot find custom realm -


i beginner custom realm. trying create demo using maven , customrealm.

when run maven project, got classnotfoundexception custom relam class.

below code snippet.

pom.xml

<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">     <modelversion>4.0.0</modelversion>     <groupid>com.example.realm</groupid>     <artifactid>realmdemo</artifactid>     <packaging>war</packaging>     <version>0.0.1-snapshot</version>     <name>realmdemo maven webapp</name>     <url>http://maven.apache.org</url>      <dependencies>         <dependency>             <groupid>org.apache.tomcat</groupid>             <artifactid>tomcat-catalina</artifactid>             <version>7.0.47</version>             <scope>provided</scope>         </dependency>     </dependencies>     <build>         <finalname>realmdemo</finalname>     </build> </project> 

custom realm class

public class testrealm extends realmbase {      @override     protected string getname() {         system.out.println("get name");         return null;     }     @override     protected string getpassword(string arg0) {         system.out.println("get password "+arg0);         return null;     }     @override     protected principal getprincipal(string arg0) {         system.out.println("get principal "+arg0);         return null;     } } 

web.xml

<web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"     xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"     id="webapp_id" version="2.5">     <display-name>realmdemo</display-name>     <welcome-file-list>         <welcome-file>index.html</welcome-file>     </welcome-file-list>     <servlet>         <servlet-name>testrealm</servlet-name>         <servlet-class>com.test.testrealm</servlet-class>     </servlet>     <servlet-mapping>         <servlet-name>testrealm</servlet-name>         <url-pattern>/test</url-pattern>     </servlet-mapping>     <security-role>         <role-name>admin</role-name>     </security-role>      <security-constraint>         <web-resource-collection>             <web-resource-name>                 entire application             </web-resource-name>             <url-pattern>/</url-pattern>         </web-resource-collection>         <auth-constraint>             <role-name>admin</role-name>           </auth-constraint>     </security-constraint>     <login-config>         <auth-method>form</auth-method>          <form-login-config>             <form-login-page>/login/login.html</form-login-page>             <form-error-page>/login/error.html</form-error-page>         </form-login-config>     </login-config> </web-app> 

i have context.xml file meta-inf folder has realm config below

/meta-inf/context.xml

<context>     <realm classname="com.test.testrealm" /> </context> 

when run project using mvn clean install tomcat:run below exception

caused by: java.lang.classnotfoundexception: com.test.testrealm 

i searching solution on google since last 2 days didn't proper solution this.

please guide.

thanks


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -