You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Bryan Austad <ba...@xtendsoft.com> on 2002/02/26 20:20:13 UTC

Problems with SOAP attachments and JDBC

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 I 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, my web service)

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.  I have also tried this web service with a customized
database pool manager.  When I call the method getFile it then messes up my
DriverManager.  When trying to recieve another JDBC connection, I get a
NullPointerException.

If anyone has the slightest idea of what is going on, I would appreciate
your help.

thanks,
Bryan