tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bryan Austad" <baus...@xtendsoft.com>
Subject javax.activation.DataSource AND javax.sql.DataSource
Date Tue, 26 Feb 2002 01:55:01 GMT
I have a big problem.  I am currently using Apache SOAP 2.2 with Tomcat
4.0.2.  I am using javax.activation package in SOAP to send file
attachments.  The problem I have is when ever a use it, it messes up my
javax.sql.DataSource.  Here is the code that retrieves a connection from a
javax.sql.DataSource:

       public static Connection getConnection (String dsName) throws
javax.naming.NamingException,Exception{
       		Context initCtx = new InitialContext();
                  javax.sql.DataSource ds =
(javax.sql.DataSource)initCtx.lookup
("java:comp/env/jdbc/MySource);

       Connection conn = ds.getConnection();
       return conn;
   } //getConnection(String)

This works just great until after this call is made:(this method is in a
seperate class)

public DataHandler getFile(String fileName, String userName, int revision)
throws Exception {
        File f = new File(this.clientPath + fileName);
        if(!f.exists())
            throw new Exception("File not found.");
        try{
            javax.activation.DataSource ds = new FileDataSource(f);
            DataHandler dh = new DataHandler(ds);
            return dh;
        }catch(Exception e){
            System.err.println(e.getMessage());
            throw new Exception(e.getMessage());
        }
}

This call works great to, but messes up my javax.sql.DataSource.  After this
method call is made, it freezes on retrieving the Context in the method
getConnection.
If anyone has the slightest idea of what is going on, I would appreciate
your help.

thanks,
Bryan


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message