[10/27/06 14:08:22:760 UYT] 0000001d WebApp E SRVE0026E: [Servlet Error]-[Filter [AccessFilter]: could not be loaded]: java.lang.ExceptionInInitializerError
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:80)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java(Compiled Code))
at java.lang.reflect.Constructor.newInstance(Constructor.java(Compiled Code))
at java.lang.Class.newInstance3(Class.java(Compiled Code))
at java.lang.Class.newInstance(Class.java(Compiled Code))
at java.beans.Beans.instantiate(Beans.java:219)
at java.beans.Beans.instantiate(Beans.java:63)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:287)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:152)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:200)
at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.invokeFilters(DefaultExtensionProcessor.java:764)
at com.ibm.ws.webcontainer.extension.DefaultExtensionProcessor.handleRequest(DefaultExtensionProcessor.java:477)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2965)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:221)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:210)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1931)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:84)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:472)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:411)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:288)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java:207)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:109)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1470)
..
[10/27/06 14:08:23:556 UYT] 0000001e WebApp E SRVE0026E: [Servlet Error]-[/js/menu_items.jsp]: java.lang.NoClassDefFoundError: uy/com/mcommerceadmin/filters/AccessFilter
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:80)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java(Compiled Code))
at java.lang.reflect.Constructor.newInstance(Constructor.java(Compiled Code))
at java.lang.Class.newInstance3(Class.java(Compiled Code))
at java.lang.Class.newInstance(Class.java(Compiled Code))
at java.beans.Beans.instantiate(Beans.java:219)
at java.beans.Beans.instantiate(Beans.java:63)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.loadFilter(WebAppFilterManager.java:287)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterInstanceWrapper(WebAppFilterManager.java:152)
at com.ibm.ws.webcontainer.filter.WebAppFilterManager.getFilterChain(WebAppFilterManager.java:200)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:636)
at com.ibm.wsspi.webcontainer.servlet.GenericServletWrapper.handleRequest(GenericServletWrapper.java:117)
at com.ibm.ws.jsp.webcontainerext.JSPExtensionServletWrapper.handleRequest(JSPExtensionServletWrapper.java:178)
at com.ibm.ws.jsp.webcontainerext.JSPExtensionProcessor.handleRequest(JSPExtensionProcessor.java:252)
at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:2965)
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:221)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:210)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:1931)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:84)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:472)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:411)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:288)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java:207)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:109)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java:566)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java:619)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java:952)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java:1039)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1470)
I'm using WAS 6.0.2.9 on Linux CentOS (RedHat).
Any help to solve this problem will be appreciated.
Thanks, Pablo.
[snip]
>
> I'm using WAS 6.0.2.9 on Linux CentOS (RedHat).
> Any help to solve this problem will be appreciated.
>
> Thanks, Pablo.
It appears that your filter is trying to load a Native class, and
there's some problem with loading the native class. Make sure the .so
that your class depends on is somewhere on the native path, AND that the
Java class that wraps the native code is NOT in the EAR, but in a shared
library loaded by the application server.
When the server starts up, it prints out the native paths, so you can
see where you might want your .so file.
Ken
I'd take a look at the static initializers to see what's going wrong.
Cheers,
Vinod
Pablo.
> The ExceptionInInitializer error tells me that some
> class (probably
> AccessFilter) is performing some sort of static
> initialization and that is
> generating a runtime exception.
>
> I'd take a look at the static initializers to see
> what's going wrong.
>
> Cheers,
> Vinod
>
> pac...@isaltda.com.uy wrote:
> > I'm getting the following exceptions when I run a
> web application that has a filter:
> >
> > [10/27/06 14:08:22:760 UYT] 0000001d WebApp
> E SRVE0026E: [Servlet Error]-[Filter
> [Filter [AccessFilter]: could not be loaded]:
> java.lang.ExceptionInInitializerError
..
I think the problem comes from some JNI stuff or something, because it
looks like native code, not Java code, that is causing the problem.
I've got a tutorial on creating filters, along with a complete EAR that
uses a filter. I've deployed it to WebSphere, so I know that it
compiles. If you want a simple reference for creating a filter, it's a
good one.
http://www.technicalfacilitation.com/examscam/tf/get.php?link=08servletfilters
Cheers!
-Cameron McKenzie
Author of What is WebSphere?
All about WebSphere: www.pulpjava.com
Free WebSphere Tutorials: www.mcnz.com
Free SCJA Mock Certification Exams: www.scja.com
www.technicalfacilitation.com www.cameronmckenzie.com
public class AmericanFilter implements Filter {
public void init(FilterConfig arg0) throws ServletException {
// TODO Auto-generated method stub
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
String language = request.getLocale().getDisplayLanguage();
if (language!="Spanish") {
response.getWriter().print("Only people speaking American can view
this Servlet.");
}
else{
chain.doFilter(request, response);
}
System.out.println("Time after the servlet is run: " +
System.currentTimeMillis());
}
public void destroy() {
// TODO Auto-generated method stub
}
}
<filter>
<description>
</description>
<display-name>
AmericanFilter</display-name>
<filter-name>AmericanFilter</filter-name>
<filter-class>com.examscam.web.filter.AmericanFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>AmericanFilter</filter-name>
<url-pattern>/AmericanFilter</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>AmericanFilter</filter-name>
<servlet-name>CountrySnooper</servlet-name>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>