You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ole Ersoy <ol...@gmail.com> on 2008/02/02 21:53:16 UTC

StandardContext start,SEVERE: Error filterStart When Including HttpServletRequestWrapper in Filter in 6.0.14

Hi,

I'm getting a:

org.apache.catalina.core.StandardContext start
SEVERE: Error filterStart

When inluding an HttpServletRequestWrapper in a filter.  The code compiles fine and the filter part causing the ruckus looks like this:

		HttpServletRequestWrapper wrapper = 
			new HttpServletRequestWrapper((HttpServletRequest)servletRequest) 
			{
			   public java.lang.String getParameter(java.lang.String name) 
			   {
			      if ("foo".equals(name)) 
			      {
			         return "bar";   
			      }
			      else 
			      {
			         return super.getParameter(name);   
			      }
			   }
			};
Thoughts?

Thanks,
- Ole









---------------------------------------------------------------------
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: StandardContext start,SEVERE: Error filterStart When Including HttpServletRequestWrapper in Filter in 6.0.14

Posted by Ole Ersoy <ol...@gmail.com>.
Konstantin,

Man - you are so right.  Thanks for hanging in there.  I should have looked at the target/classes directory and the log a little closer :-).  

Thanks again,
- Ole


> 
> Once again, just to be sure.
> 
> The compiler creates two files, "TestFilter.class" and
> "TestFilter$1.class".  Do you copy both of them? You wrote "it", not
> "they".
> 
> 
>> Strange right?
> 
> Yes, it is strange.
> 
> Do you restart the web application after copying the files? What
> tomcat version are you using?
> 
> ---------------------------------------------------------------------
> 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
> 
> 

---------------------------------------------------------------------
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: StandardContext start,SEVERE: Error filterStart When Including HttpServletRequestWrapper in Filter in 6.0.14

Posted by Konstantin Kolinko <kn...@gmail.com>.
Hi, Ole

> In this case I just recompiling the filter and copying it over the the classes
> folder of the webapp.  It's definitely there.

Once again, just to be sure.

The compiler creates two files, "TestFilter.class" and
"TestFilter$1.class".  Do you copy both of them? You wrote "it", not
"they".


> Strange right?

Yes, it is strange.

Do you restart the web application after copying the files? What
tomcat version are you using?

---------------------------------------------------------------------
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: StandardContext start,SEVERE: Error filterStart When Including HttpServletRequestWrapper in Filter in 6.0.14

Posted by Ole Ersoy <ol...@gmail.com>.
Hi Konstantin,

In this case I just recompiling the filter and copying it over the the classes folder of the webapp.  It's definitely there.  If I compile and copy with a statement like this in the filter:

HttpServletRequestWrapper wrapper = new HttpServletRequestWrapper((HttpServletRequest)servletRequest); 

The filter works.  As soon as I override getParameter like this:


HttpServletRequestWrapper wrapper =  new HttpServletRequestWrapper((HttpServletRequest)servletRequest)
{
public String getParameter(String name)
{
   return "foo";
}
}; 

I get the class not found exception.  Strange right?

- Ole



Konstantin Kolinko wrote:
> How do you package and deploy your application?
> 
> If you are seeing
> java.lang.NoClassDefFoundError: test/filter/TestFilter$1
> 
> please check, that the class file "TestFilter$1.class" is present in
> your app's WEB-INF/classes/test/filter/ directory on the web server.
> 
> 
>>> still present.  The localhost log has this:
>>>
>>> SEVERE: Exception starting filter testFilter
>>> java.lang.NoClassDefFoundError: test/filter/TestFilter$1
>>>        at java.lang.Class.getDeclaredConstructors0(Native Method)
>>>        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
>>>        at java.lang.Class.getConstructor0(Class.java:2699)
>>>        at java.lang.Class.newInstance0(Class.java:326)
>>>        at java.lang.Class.newInstance(Class.java:308)
> 
> ---------------------------------------------------------------------
> 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
> 
> 

---------------------------------------------------------------------
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: StandardContext start,SEVERE: Error filterStart When Including HttpServletRequestWrapper in Filter in 6.0.14

Posted by Konstantin Kolinko <kn...@gmail.com>.
How do you package and deploy your application?

If you are seeing
java.lang.NoClassDefFoundError: test/filter/TestFilter$1

please check, that the class file "TestFilter$1.class" is present in
your app's WEB-INF/classes/test/filter/ directory on the web server.


> > still present.  The localhost log has this:
> >
> > SEVERE: Exception starting filter testFilter
> > java.lang.NoClassDefFoundError: test/filter/TestFilter$1
> >        at java.lang.Class.getDeclaredConstructors0(Native Method)
> >        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
> >        at java.lang.Class.getConstructor0(Class.java:2699)
> >        at java.lang.Class.newInstance0(Class.java:326)
> >        at java.lang.Class.newInstance(Class.java:308)

---------------------------------------------------------------------
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: StandardContext start,SEVERE: Error filterStart When Including HttpServletRequestWrapper in Filter in 6.0.14

Posted by Ole Ersoy <ol...@gmail.com>.
I managed to narrow it down a little further.  The same exception appears if the HttpServletRequestWrapper instance is defined like this:

		HttpServletRequestWrapper wrapper = 
			new HttpServletRequestWrapper((HttpServletRequest)servletRequest)
			{
			   public String getParameter(String name) 
			   { 
				return "foo";
			   }
			};

The filter runs fine if I replace the above with this:
		HttpServletRequestWrapper wrapper = 
			new HttpServletRequestWrapper((HttpServletRequest)servletRequest);

Any ideas?

Thanks,
- Ole


Ole Ersoy wrote:
> Well, I was certain it had to be the difference in the JDKs causing it, 
> but after compiling the filter with the Sun JDK, the same exception is 
> still present.  The localhost log has this:
> 
> SEVERE: Exception starting filter testFilter
> java.lang.NoClassDefFoundError: test/filter/TestFilter$1
>        at java.lang.Class.getDeclaredConstructors0(Native Method)
>        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
>        at java.lang.Class.getConstructor0(Class.java:2699)
>        at java.lang.Class.newInstance0(Class.java:326)
>        at java.lang.Class.newInstance(Class.java:308)
> 
> So for some reason it does not see the filter after I add this code:
> 
>         HttpServletRequestWrapper wrapper =             new 
> HttpServletRequestWrapper((HttpServletRequest)servletRequest)             {
>                public java.lang.String getParameter(java.lang.String 
> name)                {
>                   if ("foo".equals(name))                   {
>                      return "bar";                     }
>                   else                   {
>                      return super.getParameter(name);                     }
>                }
>             };
> 
> Without this code the filter runs fine.  Any ideas?
> 
> Thanks,
> - Ole
> 
> 
> 
> Ole Ersoy wrote:
>> Actually I probably got this one.  I'm compiling the filter with 
>> IcedTea, but using the Sun JDK to run tomcat, since IcedTea has issues 
>> with keystore certificates.  So if I compile with the Sun JDK I think 
>> the issue will go away.
>>
>> Cheers,
>> - Ole
>> Ole Ersoy wrote:
>>> Hi,
>>>
>>> I'm getting a:
>>>
>>> org.apache.catalina.core.StandardContext start
>>> SEVERE: Error filterStart
>>>
>>> When inluding an HttpServletRequestWrapper in a filter.  The code 
>>> compiles fine and the filter part causing the ruckus looks like this:
>>>
>>>         HttpServletRequestWrapper wrapper =             new 
>>> HttpServletRequestWrapper((HttpServletRequest)servletRequest)             
>>> {
>>>                public java.lang.String getParameter(java.lang.String 
>>> name)                {
>>>                   if ("foo".equals(name))                   {
>>>                      return "bar";                     }
>>>                   else                   {
>>>                      return 
>>> super.getParameter(name);                     }
>>>                }
>>>             };
>>> Thoughts?
>>>
>>> Thanks,
>>> - Ole
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
> 

---------------------------------------------------------------------
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: StandardContext start,SEVERE: Error filterStart When Including HttpServletRequestWrapper in Filter in 6.0.14

Posted by Ole Ersoy <ol...@gmail.com>.
Well, I was certain it had to be the difference in the JDKs causing it, but after compiling the filter with the Sun JDK, the same exception is still present.  The localhost log has this:

SEVERE: Exception starting filter testFilter
java.lang.NoClassDefFoundError: test/filter/TestFilter$1
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
        at java.lang.Class.getConstructor0(Class.java:2699)
        at java.lang.Class.newInstance0(Class.java:326)
        at java.lang.Class.newInstance(Class.java:308)

So for some reason it does not see the filter after I add this code:

		HttpServletRequestWrapper wrapper = 
			new HttpServletRequestWrapper((HttpServletRequest)servletRequest) 
			{
			   public java.lang.String getParameter(java.lang.String name) 
			   {
			      if ("foo".equals(name)) 
			      {
			         return "bar";   
			      }
			      else 
			      {
			         return super.getParameter(name);   
			      }
			   }
			};

Without this code the filter runs fine.  Any ideas?

Thanks,
- Ole



Ole Ersoy wrote:
> Actually I probably got this one.  I'm compiling the filter with 
> IcedTea, but using the Sun JDK to run tomcat, since IcedTea has issues 
> with keystore certificates.  So if I compile with the Sun JDK I think 
> the issue will go away.
> 
> Cheers,
> - Ole
> Ole Ersoy wrote:
>> Hi,
>>
>> I'm getting a:
>>
>> org.apache.catalina.core.StandardContext start
>> SEVERE: Error filterStart
>>
>> When inluding an HttpServletRequestWrapper in a filter.  The code 
>> compiles fine and the filter part causing the ruckus looks like this:
>>
>>         HttpServletRequestWrapper wrapper =             new 
>> HttpServletRequestWrapper((HttpServletRequest)servletRequest)             
>> {
>>                public java.lang.String getParameter(java.lang.String 
>> name)                {
>>                   if ("foo".equals(name))                   {
>>                      return "bar";                     }
>>                   else                   {
>>                      return 
>> super.getParameter(name);                     }
>>                }
>>             };
>> Thoughts?
>>
>> Thanks,
>> - Ole
>>
>>
>>
>>
>>
>>
>>
>>
>>
> 

---------------------------------------------------------------------
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: StandardContext start,SEVERE: Error filterStart When Including HttpServletRequestWrapper in Filter in 6.0.14

Posted by Ole Ersoy <ol...@gmail.com>.
Actually I probably got this one.  I'm compiling the filter with IcedTea, but using the Sun JDK to run tomcat, since IcedTea has issues with keystore certificates.  So if I compile with the Sun JDK I think the issue will go away.

Cheers,
- Ole 

Ole Ersoy wrote:
> Hi,
> 
> I'm getting a:
> 
> org.apache.catalina.core.StandardContext start
> SEVERE: Error filterStart
> 
> When inluding an HttpServletRequestWrapper in a filter.  The code 
> compiles fine and the filter part causing the ruckus looks like this:
> 
>         HttpServletRequestWrapper wrapper =             new 
> HttpServletRequestWrapper((HttpServletRequest)servletRequest)             {
>                public java.lang.String getParameter(java.lang.String 
> name)                {
>                   if ("foo".equals(name))                   {
>                      return "bar";                     }
>                   else                   {
>                      return super.getParameter(name);                     }
>                }
>             };
> Thoughts?
> 
> Thanks,
> - Ole
> 
> 
> 
> 
> 
> 
> 
> 
> 

---------------------------------------------------------------------
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