Hi,
I can't describe exactly the problem because I'm not familiar with all the terms...
But the big picture is that I want to create a pool of ftp connections to work like a
database connection and I want to get the connection from JNDI.
So far I extended BaseKeyedPoolableObjectFactory and StackKeyedObjectPool and it works
fine like this:
FTPConnectionPool pool = new FTPConnectionPool();
String key = "key";
try{
FTPClient ftp = pool.borrowClient(key);
if( ftp.sendNoOp() ){
System.out.println("OK");
}else{
System.out.println("NOPE");
}
pool.returnClient( key, ftp );
}catch(Exception ex){
ex.printStackTrace();
}
But I want to make it work from "JNDI" almost like a datasource
InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/backup");
Anyway I am completely lost if it can be done or not.
So far I get an exception when I try to start Tomcat:
GlobalResourcesLifecycleListener: Exception processing Global JNDI Resources
javax.naming.NamingException: Could not create resource factory instance, null
at
org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceFactory.java:146)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)
at org.apache.naming.NamingContext.lookup(NamingContext.java:834)
at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
regards,
viorel