You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ftpserver-users@mina.apache.org by Leo Bayer <lf...@gmail.com> on 2014/08/29 02:42:13 UTC

ftplet-api and OSGi

I'm deploying the ftpserver into an OSGi container and trying to implement
my own UserManager, but both the ftpserver-core and the ftplet-api jars
have the ftplet package and classes in them.

What this means is, since they are loaded with different classloaders, any
external bundle that references the ftplet classes can't use them together
with the core jar's classes. Two classes with the same name loaded with
different classloaders are not compatible.

So either the ftpserver-core jar needs to export its ftplet package and the
ftplet-api.jar should go away. Or the ftplet package should be removed from
ftpserver-core.jar and the manifest should instead import them from the
ftplet-api.jar.

Has anyone ever implemented their own UserManager in an OSGi environment
while uses the ftpserver jars as bundles?

The actual error I get is this:

Caused by: java.lang.LinkageError: loader constraint violation: when
resolving method
"org.apache.ftpserver.FtpServerFactory.setUserManager(Lorg/apache/ftpserver/ftplet/UserManager;)V"
the class loader (instance of
org/eclipse/osgi/internal/loader/EquinoxClassLoader) of the current class,
com/lbayer/ftpserver/FtpService, and the class loader (instance of
org/eclipse/osgi/internal/loader/EquinoxClassLoader) for the method's
defining class, org/apache/ftpserver/FtpServerFactory, have different Class
objects for the type org/apache/ftpserver/ftplet/UserManager used in the
signature

Thanks,
 - Leo