I have a web-bundle that uses a custom ServletFilter. The filter class is located in:
The manifest.mf contains the classpath:
It is a typical osgi bundle build with tycho. The problem is that during startup of virgo a ClassNotFoundException is thrown:
[2012-11-23 15:24:15.704] ERROR start-signalling-5 o.a.catalina.core.ContainerBase.[Catalina].[localhost].[/csar] Exception starting filter Test1Filter java.lang.ClassNotFoundException: xxx.yyy.Test1Filter
First I thought I might have to put the classes under WEB-INF/classes because it is a web-bundle. So I moved the classes to:
This indeed works if I adjust the classpath accordingly:
The "classes" directory can also be named differently. The only matter seems to be that it is within the WEB-INF directory.
The funny thing is that classes other than filters are found in the . classpath.
For example I added a ServletRequestListener in the web.xml which I put as such:
The listener class is resolved just fine whereas the filter class must reside somewhere within WEB-INF. The osgi specification about web-bundles says
Unlike a WAR, a WAB is not constrained to package classes and code resources in the WEB-INF/
classes/ directory or dependent JARs in WEB-INF/lib/ only. These entries can be packaged in any way
that's valid for an OSGi bundle as long as such directories and JARs are part of bundle class path as set
with the Bundle-ClassPath header and any attached fragments.
So I assume this is some kind of weird bug? Or am I missing something?
[Updated on: Fri, 23 November 2012 09:53]
Report message to a moderator