You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by aladdin <al...@csunv.com> on 2007/02/04 03:06:01 UTC
Tomcat can't find my Filter
I have a development machine on which everything works fine, and I'm trying to
deploy to a production machine, and for some reason it's not finding my
filter. The fact that it *knows* about the filter indicates (well, at least,
I think it indicates) that it found the web app and associated directories.
The public URL is http://www.infoisland.net, which points
to /var/www/infoisland in the file system.
I've included everything here I thought could possibly be relevant.
On the apache side, here's the apache host entry:
[CODE]
NameVirtualHost *:80
NameVirtualHost *:443
<VirtualHost *:80>
ServerName www.infoisland.net
DocumentRoot /var/www/infoisland
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/infoisland>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
</Directory>
ServerAdmin webmaster@localhost
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel debug
CustomLog /var/log/apache2/access.log combined
ServerSignature On
Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>
Alias /forums "/var/www/pubhtm/forums"
<Directory "/var/www/pubhtm/forums">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName www.mywinterpark.org
DocumentRoot /var/www/mywinterpark
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/mywinterpark>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
# Uncomment this directive is you want to see apache2's
# default start page (in /apache2-default) when you go to /
#RedirectMatch ^/$ /apache2-default/
</Directory>
ErrorLog /var/log/apache2/error.log
LogLevel debug
CustomLog /var/log/apache2/access.log combined
ServerSignature On
Alias /forums "/var/www/pubhtm/forums"
<Directory "/var/www/pubhtm/forums">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:443>
SSLEngine on
SSLCertificateFile ssl/infoisland.crt
SSLCertificateKeyFile ssl/infoisland.key
DocumentRoot /var/www/infoisland
</VirtualHost>
[/CODE]
and here's the mod_jk configuration:
[CODE]
########## Auto generated on Sun Jan 21 19:53:16 EST 2007##########
<IfModule !mod_jk.c>
LoadModule jk_module "libexec/mod_jk.so"
</IfModule>
JkWorkersFile "/etc/tomcat5.5/workers.properties"
JkLogFile "/usr/share/tomcat5.5/logs/mod_jk.log"
JkLogLevel emerg
<VirtualHost localhost>
ServerName localhost
JkMount /infoisland ajp13
JkMount /infoisland/* ajp13
</VirtualHost>
# Java Server Pages
JkMount /*.jsp ajp13_worker
# JkMount /infoisland/*.jsp ajp13_worker
# Servlets
# JkMount /infoisland/login ajp13_worker
# JkMount /infoisland/register ajp13_worker
# JkMount /infoisland/topicsAdmin ajp13_worker
JkMount /infoisland/* ajp13_worker
JkMount /servlet/* ajp13_worker
JkMount /members/* ajp13_worker
JkMount /members/servlet/* ajp13_worker
JkMount /*/servlet/* ajp13_worker
[/CODE]
On the tomcat side, here's the server.xml section:
[CODE]
<Host name="www.infoisland.net" appBase="/var/www"
unpackWARs="true" autoDeploy="true"
xmlValidation="false" xmlNamespaceAware="false">
<Context path="/infoisland" debug="255"
docBase="infoisland"
crossContext="true"
reloadable="true">
<Manager className="org.apache.catalina.session.PersistentManager"
debug="255" saveOnRestart="false">
</Manager>
<Resource name="jdbc/infoisland" auth="Container"
type="javax.sql.DataSource"
maxActive="20" maxIdle="5" maxWait="10000" username="anw"
password="anw111" driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/smsinfo?autoReconnect=true"/>
</Context>
</Host>
[/CODE]
And, on the app side, here's the web.xml entry for the filter:
[CODE]
<!-- Filters Here -->
<filter>
<filter-name>CheckUser</filter-name>
<filter-class>infoIsland.CheckUser</filter-class>
<init-param>
<param-name>loginPage</param-name>
<param-value>/login.jsp</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CheckUser</filter-name>
<url-pattern>/members/*</url-pattern>
</filter-mapping>
[/CODE]
and here's the directory listing of the WEB-INF/classes directory (directly
under the /var/www/infoisland directory):
[CODE]
total 24
drwxr-xr-- 6 anw anw 4096 2007-02-03 13:54 ./
drwxr-xr-x 4 anw anw 4096 2007-02-02 22:10 ../
drwxr-xr-x 2 root root 4096 2007-02-02 18:10 dbMgr/
drwxr-xr-x 2 anw anw 4096 2007-02-02 18:10 infoIsland/
drwxr-xr-x 2 root root 4096 2007-02-02 18:10 utils/
[/CODE]
and here is the WEB-INF/classes/infoisland listing, showing the CheckUser
class:
[CODE]
total 96
drwxr-xr-x 2 anw anw 4096 2007-02-02 18:10 ./
drwxr-xr-- 6 anw anw 4096 2007-02-03 13:54 ../
[BOLD]-rwxr-xr-x 1 anw anw 3899 2007-02-02 18:10 CheckUser.class*[/BOLD]
-rwxr-xr-x 1 anw anw 4977 2007-02-02 18:10 Client.class*
-rwxr-xr-x 1 anw anw 2624 2007-02-02 18:10 login.class*
-rwxr-xr-x 1 anw anw 2830 2007-02-02 18:10 NewTribe.class*
-rwxr-xr-x 1 anw anw 610 2007-02-02 18:10 ReqMgr$1.class*
-rwxr-xr-x 1 anw anw 8273 2007-02-02 18:10 ReqMgr.class*
-rwxr-xr-x 1 anw anw 1653 2007-02-02 18:10 reqstatus.class*
-rwxr-xr-x 1 anw anw 6867 2007-02-02 18:10 ReqTag.class*
-rwxr-xr-x 1 anw anw 1944 2007-02-02 18:10 reqtype.class*
-rwxr-xr-x 1 anw anw 3682 2007-02-02 18:10 request.class*
-rwxr-xr-x 1 anw anw 1605 2007-02-02 18:10 subscription.class*
-rwxr-xr-x 1 anw anw 1307 2007-02-02 18:10 subtopic.class*
-rwxr-xr-x 1 anw anw 4689 2007-02-02 18:10 tribe.class*
-rwxr-xr-x 1 anw anw 3501 2007-02-02 18:10 TribeMgr.class*
-rwxr-xr-x 1 anw anw 5985 2007-02-02 18:10 user.class*
-rwxr-xr-x 1 anw anw 3023 2007-02-02 18:10 UserMenu.class*
[/CODE]
And, lastly, here is the output of tomcat, throwing an exception because it
can't find CheckUser:
[CODE]
Feb 3, 2007 2:39:37 PM org.apache.catalina.core.AprLifecycleListener
lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in
production environments was not found on the
java.library.path: /usr/lib/jdk1.6.0/jre/lib/i386/server:/usr/lib/jdk1.6.0/jre/lib/i386:/usr/lib/jdk1.6.0/jre/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib
Feb 3, 2007 2:39:37 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Feb 3, 2007 2:39:37 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2332 ms
Feb 3, 2007 2:39:38 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Feb 3, 2007 2:39:38 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5
Feb 3, 2007 2:39:38 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Feb 3, 2007 2:39:39 PM org.apache.catalina.session.PersistentManagerBase start
SEVERE: No Store configured, persistence disabled
Feb 3, 2007 2:39:39 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter CheckUser
java.lang.ClassNotFoundException: infoIsland.CheckUser
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1355)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1201)
at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:209)
at
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:304)
at
org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:77)
at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3634)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4217)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
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:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
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.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
Feb 3, 2007 2:39:39 PM org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart
Feb 3, 2007 2:39:39 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/infoisland] startup failed due to previous errors
[/CODE]
I have also tried putting a infoisland.jar file in the WEB-INF/lib directory,
with exactly the same results.
TIA,
Allen
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat can't find my Filter
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Allen,
(Note that I've moved some things around in here)
aladdin wrote:
> <IfModule !mod_jk.c>
> LoadModule jk_module "libexec/mod_jk.so"
>
> JkWorkersFile "/etc/tomcat5.5/workers.properties"
> JkLogFile "/usr/share/tomcat5.5/logs/mod_jk.log"
>
> JkLogLevel emerg
> </IfModule>
This configuration should probably come before all of your <VirtualHost>
directives, though it might not matter. Note that I've moved all generic
mod_jk configuration inside the <IfModule> section. You will get fewer
errors in your log file when mod_jk is not available this way.
Let's consider this:
> <VirtualHost localhost>
> ServerName localhost
>
> JkMount /infoisland ajp13
> JkMount /infoisland/* ajp13
> </VirtualHost>
For these URLs, only requests to http://localhost/infoisland will be
forwarded to Tomcat. So, if you use
http://www.infoisland.com/infoisland, you won't get what you want.
These directives should probably be inside of your <VirtualHost> for
"infoisland", along with the rest of them.
Consider modifying your configuration fort infoisland's <VirtualHost>
like this:
> <VirtualHost *:80>
> ServerName www.infoisland.net
> DocumentRoot /var/www/infoisland
> <Directory />
> Options FollowSymLinks
> AllowOverride None
> </Directory>
>
> <Directory /var/www/infoisland>
> Options Indexes FollowSymLinks MultiViews
> AllowOverride None
> Order allow,deny
> allow from all
> # Uncomment this directive is you want to see apache2's
> # default start page (in /apache2-default) when you go to /
> #RedirectMatch ^/$ /apache2-default/
> </Directory>
>
> ServerAdmin webmaster@localhost
> ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
> <Directory "/usr/lib/cgi-bin">
> AllowOverride None
> Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
> Order allow,deny
> Allow from all
> </Directory>
>
> ErrorLog /var/log/apache2/error.log
>
> # Possible values include: debug, info, notice, warn, error, crit,
> # alert, emerg.
> LogLevel debug
>
> CustomLog /var/log/apache2/access.log combined
> ServerSignature On
>
> Alias /doc/ "/usr/share/doc/"
> <Directory "/usr/share/doc/">
> Options Indexes MultiViews FollowSymLinks
> AllowOverride None
> Order deny,allow
> Deny from all
> Allow from 127.0.0.0/255.0.0.0 ::1/128
> </Directory>
>
> Alias /forums "/var/www/pubhtm/forums"
> <Directory "/var/www/pubhtm/forums">
> Options Indexes MultiViews FollowSymLinks
> AllowOverride None
> Allow from all
> </Directory>
#====================================
# Put your mod_jk configuration here:
#====================================
[pasted]
> # Java Server Pages
> JkMount /*.jsp ajp13_worker
> # JkMount /infoisland/*.jsp ajp13_worker
>
> # Servlets
> # JkMount /infoisland/login ajp13_worker
> # JkMount /infoisland/register ajp13_worker
> # JkMount /infoisland/topicsAdmin ajp13_worker
> JkMount /infoisland/* ajp13_worker
> JkMount /servlet/* ajp13_worker
> JkMount /members/* ajp13_worker
> JkMount /members/servlet/* ajp13_worker
> JkMount /*/servlet/* ajp13_worker
#====================================
# End of mod_jk configuration
#====================================
> </VirtualHost>
> And, on the app side, here's the web.xml entry for the filter:
>
> [CODE]
> <!-- Filters Here -->
> <filter>
> <filter-name>CheckUser</filter-name>
> <filter-class>infoIsland.CheckUser</filter-class>
> <init-param>
> <param-name>loginPage</param-name>
> <param-value>/login.jsp</param-value>
> </init-param>
> </filter>
>
> <filter-mapping>
> <filter-name>CheckUser</filter-name>
> <url-pattern>/members/*</url-pattern>
> </filter-mapping>
It looks like this filter should only be active for URLs pointing to
/members/[anything], and not other URLs. What URL are you trying, and
what is the result?
Another quick question: It looks like you are implementing your own
authentication mechanism, and using <filter-mapping> as a crude
authorization configuration. Why not use the built-in container-managed
authentication and authorization provided by Tomcat?
Finally, it looks like your problem is a stray uppercase character in
your configuration. This:
> <filter-class>infoIsland.CheckUser</filter-class>
Does not match this:
> and here is the WEB-INF/classes/infoisland listing, showing the CheckUser
> class:
[BOLD]-rwxr-xr-x 1 anw anw 3899 2007-02-02 18:10 CheckUser.class*[/BOLD]
You should have used "infoisland.CheckUser".
Your directory listings are inconsistent (in one place, you /do/ have
infoIsland, and in the other, you have "infoisland"). Which is it?
> SEVERE: Exception starting filter CheckUser
> java.lang.ClassNotFoundException: infoIsland.CheckUser
> I have also tried putting a infoisland.jar file in the WEB-INF/lib directory,
> with exactly the same results.
This is where your JAR file /should/ be.
What does the "package" directive say in your CheckUser.java file?
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFxfrE9CaO5/Lv0PARAmVWAJ9TF43c/1LH7UY2PugYDBWfNjmZVQCfW8En
q1+LSSD6q3uL9V5FsXcqTlE=
=3705
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org