UrlRewriteFilter doesn't work in combination with Virtual Host?

270 views
Skip to first unread message

acsnaterse

unread,
May 2, 2007, 9:10:34 AM5/2/07
to UrlRewrite
Hi,

I just used your UrlRwriteFilter tool and this works good when I use
it in a environment without virtual hosts.

For example:
http://localhost:8080/SiteName/test/something is perfectly redirected
to /bin/test.jsp?ID=something when I use this rule:

<rule enabled="true">
<from>^/test/([a-z]+)</from>
<to>/bin/test.jsp?test=$1</to>
</rule>


But when I want to use this in an environment with a virtual host
(like http://www.mydomain.com/test/something instead of
http://localhost:8080/SiteName/test/something) I got a 404 error and
the whole url rewrite doesn't work anymore.

Maybe you know what I'm doing wrong or where I should take a look/make
changes to get this working with virtual hosts?

Thanks in advance!

Regards,
Arjan Snaterse

Paul Tuckey

unread,
May 2, 2007, 4:47:43 PM5/2/07
to urlre...@googlegroups.com
In order to even get close to investigating this problem I need to
know the following:

- what application server are you using?
- what is "doing" the virtual hosting (the app server or is there an
apache in-front of it)?
- how is the virtual hosting configured?
- what is the 404 for? (ie, what appears in your log as the not found resource)

Cheers,
Paul.

acsnaterse

unread,
May 3, 2007, 3:03:23 AM5/3/07
to UrlRewrite
- Application sever: Apache Tomcat/5.0.28
- The virtual host is "done" by the application server in de
server.xml
- This is in my server.xml for the virtual host:

<Host name="host_name">
<Alias>www.mydomain.com</Alias>
<Valve className="org.apache.catalina.valves.AccessLogValve"
prefix="mydomain" suffix=".log" pattern="common" directory="$
{jboss.server.home.dir}/log"/>
<DefaultContext cookies="true" crossContext="true" override="true"/>
</Host>

- And this is what I get with the 404 error (when I go to www.mydomain.com):

HTTP Status 404 - /

type: Status report
message: /
description: The requested resource (/) is not available.

On May 2, 10:47 pm, "Paul Tuckey" <p...@tuckey.org> wrote:
> In order to even get close to investigating this problem I need to
> know the following:
>
> - what application server are you using?
> - what is "doing" the virtual hosting (the app server or is there an
> apache in-front of it)?
> - how is the virtual hosting configured?
> - what is the 404 for? (ie, what appears in your log as the not found resource)
>
> Cheers,
> Paul.
>

> On 5/3/07, acsnaterse <snate...@gmail.com> wrote:
>
>
>
> > Hi,
>
> > I just used your UrlRwriteFilter tool and this works good when I use
> > it in a environment without virtual hosts.
>
> > For example:

> >http://localhost:8080/SiteName/test/somethingis perfectly redirected


> > to /bin/test.jsp?ID=something when I use this rule:
>
> > <rule enabled="true">
> > <from>^/test/([a-z]+)</from>
> > <to>/bin/test.jsp?test=$1</to>
> > </rule>
>
> > But when I want to use this in an environment with a virtual host

> > (likehttp://www.mydomain.com/test/somethinginstead of

Paul Tuckey

unread,
May 3, 2007, 3:21:38 AM5/3/07
to urlre...@googlegroups.com
What log output do you get when you set urlrewritefilter to log at debug level?

On 5/3/07, acsnaterse <snat...@gmail.com> wrote:
>

acsnaterse

unread,
May 3, 2007, 9:36:45 AM5/3/07
to UrlRewrite
This appears in the log:

INFO: 2007-05-03 15:43:10,531[main::STDOUT]: Unable to load the
library: java.lang.UnsatisfiedLinkError: no HL_Wrapper_CS in
java.library.path


On May 3, 9:21 am, "Paul Tuckey" <p...@tuckey.org> wrote:
> What log output do you get when you set urlrewritefilter to log at debug level?
>

> > > >http://localhost:8080/SiteName/test/somethingisperfectly redirected

acsnaterse

unread,
May 8, 2007, 5:19:28 AM5/8/07
to UrlRewrite
Nobody?

Paul Tuckey

unread,
May 8, 2007, 6:38:50 AM5/8/07
to urlre...@googlegroups.com
I don't think this has anything to do with UrlRewriteFilter...

try setting log level to this...

<init-param>
<param-name>logLevel</param-name>
<param-value>sysout:DEBUG</param-value>
</init-param>

acsnaterse

unread,
May 8, 2007, 8:16:43 AM5/8/07
to UrlRewrite
Okay, now this is in the logs:

ERROR:[org.jboss.web.localhost.Engine]: StandardContext[]Exception
starting filter UrlRewriteFilter
java.lang.ClassNotFoundException:
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:
1340)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:
1189)
at
org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:
211)
at
org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:
308)
at
org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:
79)
at
org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:
3698)
at
org.apache.catalina.core.StandardContext.start(StandardContext.java:
4349)
at
org.apache.catalina.core.StandardContext.reload(StandardContext.java:
3043)
at
org.apache.catalina.startup.HostConfig.restartContext(HostConfig.java:
873)
at
org.apache.catalina.startup.HostConfig.checkContextLastModified(HostConfig.java:
759)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1085)
at
org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:
327)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:
119)
at
org.apache.catalina.core.StandardHost.backgroundProcess(StandardHost.java:
800)
at org.apache.catalina.core.ContainerBase
$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1619)
at org.apache.catalina.core.ContainerBase
$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1628)
at org.apache.catalina.core.ContainerBase
$ContainerBackgroundProcessor.run(ContainerBase.java:1608)
at java.lang.Thread.run(Thread.java:595)
ERROR:[tomcat.appName.ROOT.Context]: Error filterStart
ERROR:[tomcat.appName.ROOT.Context]: Context startup failed due to
previous errors

So, it seems that it cannot find the UrlRewriteFilter class, but the
jar file (urlrewrite-2.6.0.jar) is in the lib directory. What am I
doing wrong?

On May 8, 12:38 pm, "Paul Tuckey" <p...@tuckey.org> wrote:
> I don't think this has anything to do with UrlRewriteFilter...
>
> try setting log level to this...
>
> <init-param>
> <param-name>logLevel</param-name>
> <param-value>sysout:DEBUG</param-value>
> </init-param>
>

Paul Tuckey

unread,
May 8, 2007, 7:18:51 PM5/8/07
to urlre...@googlegroups.com
Unfortunately I can't help you with classpath problems.
UrlRewriteFilter is a plain old servlet filter you stick the jar in
your WEB-INF/lib and add it to web.xml. The rest is up to your web
app server.
Reply all
Reply to author
Forward
0 new messages