javainstantiationexceptionpicocontainer

Error instantiating org.picocontainer.web.PicoServletContainerFilter


I'm green in Java development. I'm trying to use PicoContainer in a servlet application. I configured the container in the web.xml and it fails when it try to create the filter. So I tried to instantiate the filter manually like this:

Class<?> clazz = Class.forName("org.picocontainer.web.PicoServletContainerFilter");
Object test = clazz.newInstance();

and I obtain the same exception:

java.lang.InstantiationException

but I have no detailed message. I guess something is missing in the JAR in deployment ( shouldn't have in this case ClassNotFoundExeption? )

because it is not clear to me the dependency needed. ( Seems the old dll hell era ) At the moment I'm deploying the following jars:

What is the problem? Is it a missing Jar or something else? If there is a missing Jar and because I have no additional message, how can I understand what Jar is missing? Deployng the whole picocontainer jars is not the preferred option since it is a huge mess of files.

EDIT

Problem seems that the class is abstract! So I don't know how this configuration found in the docs can works: http://picocontainer.com/web/


Solution

  • I get the answer myself. Problem was of course org.picocontainer.web.PicoServletContainerFilter being abstract. There is an implementation in that class called servlet filter. Here the working cofig: enter image description here