aspose file tools*
The moose likes Tomcat and the fly likes Filter not triggerring for applications outside webapps Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Filter not triggerring for applications outside webapps" Watch "Filter not triggerring for applications outside webapps" New topic
Author

Filter not triggerring for applications outside webapps

Bijesh Vijayan
Greenhorn

Joined: Aug 08, 2011
Posts: 5
Hi,

I was trying to migrate from tomcat 5 to tomcat 7.

I copied the following contents from tomcat5/conf/web.xml to tomcat7/conf/web.xml

<filter>
<filter-name>Authenticate Filter</filter-name>
<filter-class>com.emp.EmpAuthorizationFilter</filter-class>
<init-param>
<param-name>SecurityLevel</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>Debug</param-name>
<param-value>1</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Authenticate Filter</filter-name>
<url-pattern>/servlet/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Authenticate Filter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Authenticate Filter</filter-name>
<url-pattern>*.do</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Authenticate Filter</filter-name>
<url-pattern>*.exe</url-pattern>
</filter-mapping>

<servlet>
<servlet-name>Authenticate</servlet-name>
<servlet-class>com.emp.EmpPortalAuthenticationForm</servlet-class>
</servlet>

<login-config>
<auth-method>FORM</auth-method>
<realm-name>UMIPortal Form-Based Authentication Area</realm-name>
<form-login-config>
<form-login-page>/servlet/Authenticate</form-login-page>
<form-error-page>/servlet/AuthenticateError</form-error-page>
</form-login-config>
</login-config>

I have more than one context. one in Employee and one Employee/Reports
the contexts are defined in

tomcat7/conf/Catalina/localhost/Employee.xml
<Context path="/Employee"
docBase="/home/bijesh/Employee"
crossContext="true"
reloadable="false"
workDir="Employee">

tomcat7/conf/Catalina/localhost/Employee#Reports.xml
<Context path="/Employee/Reports"
docBase="/home/bijesh/Employee/Reports"
crossContext="true"
reloadable="false"
workDir="Employee/Reports">

The filter jar is available in /home/bijesh/Employee/WEB-INF/lib and /homes/bijesh/Employee/Reports/WEB-INF/lib

The filter is initiated for the second app.

Bijesh.

Bijesh Vijayan
Greenhorn

Joined: Aug 08, 2011
Posts: 5
I was also getting the below error in the front end

HTTP Status 404 - /Employee/servlet/Authenticate
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60058
    
  65

Bijesh Vijayan wrote:I have more than one context. one in Employee and one Employee/Reports

You have nested contexts? What's up with that?

the contexts are defined in

tomcat7/conf/Catalina/localhost/Employee#Reports.xml

A #?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bijesh Vijayan
Greenhorn

Joined: Aug 08, 2011
Posts: 5

not nested context. (I think so, as it has got separate context files and separate path and docBase)

# I added as in tomcat5, the context names are Employee-context.xml and Reports-context.xml
I used # as per the below site(see the heading Naming).

http://tomcat.apache.org/tomcat-7.0-doc/config/context.html

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60058
    
  65

Bijesh Vijayan wrote:not nested context.

You have one context inside the folder of another. That's nested.

Separate out the second context into its own folder before diagnosing any further.
Bijesh Vijayan
Greenhorn

Joined: Aug 08, 2011
Posts: 5

Fine, so in tomcat5, the filter is loading for each context(Employee and Employee/Reports), but in tomcat7, its not loading for both(the init() method is not getting triggered).

In both the filter is not declared in the web.xml(/homes/bijesh/Employee/WEB-INF/web.xml and /homes/Employee/Reports/WEB-INF/web.xml)

The filter is defined only in /home/bijesh/tomcat7/conf/web.xml

Do we need to do anything for tomcat7 ?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60058
    
  65

If you are going to ignore the advice given, why are you asking the question?

/unsubscribes
Bijesh Vijayan
Greenhorn

Joined: Aug 08, 2011
Posts: 5

I tried, to separate both the context

so now my directory structure is
/home/bijesh/Employee/WEB-INF/web.xml
/home/bijesh/Reports/WEB-INF/web.xml

I changed the doc base in context.xml
/home/bijesh/tomcat7/conf/Catalina/localhost/Employee.xml
/home/bijesh/tomcat7/conf/Catalina/localhost/Reports.xml
(I changed the name from Employee#Reports.xml to Reports.xml)

Still not loading the filter.
One thing also I noticed, in tomcat5 catalina.jar, there is a class named StandardHostDeployer, but its missing in tomcat7 catalina.jar. Also couple of other classes are missing in tomcat 7 catalina.jar(Eg:- HttpRequest, HttpResponse). Is there any way we can get these in tomcat 7

Bijesh.





 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Filter not triggerring for applications outside webapps
 
Similar Threads
Not able to use Struts Taglibs
Form-based authentication not working
RichFaces + Spring Security -- Problem Load RichFaces
Adding/changing java classes on eclipse project
Servlet not showing up in Browser