tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Randall Svancara" <rsvanc...@adaweb.net>
Subject RE: JNDI / pooling
Date Fri, 09 Jul 2004 14:13:04 GMT
Most ftp connections time out, so you would have to have an auto-reconnect feature right? 
This sounds like a kewl idea.    

-----Original Message-----
From: Ryan Lissack [mailto:rlissack@buildonline.com]
Sent: Friday, July 09, 2004 6:30 AM
To: 'Tomcat Users List'
Subject: RE: JNDI / pooling


http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources-howto.html

See the 'Adding Custom Resource Factories' section.

Ryan.

-----Original Message-----
From: Viorel Dragomir [mailto:bc@vio.ro]
Sent: 09 July 2004 13:12
To: Tomcat Users List
Subject: JNDI / pooling


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

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message