We have been using a custom UserManager for sometime now in our web
application.  It works extremely well, and is very easy to implement.
However, we are now in need of some stand alone applications that need
access to our EJB's.  When we attempt to access an EJB, we are having
problems.  I have been able to trace it down to the JNDI lookup of the
datasource.  We have a utility object called ConnectionManager that handles
the lookup of a datasource.  Here is a snippet.

 public static Connection getConnection(String jndiName) {
        InitialContext       context = null;
        javax.sql.DataSource ds = null;
        Connection       conn = null;

        try {
            context = new InitialContext();
            ds = (DataSource) context.lookup(jndiName);
            conn = ds.getConnection();
        }
        catch (SQLException sqle) {
            sqle.printStackTrace();
        }
        catch (NamingException ne) {
            ne.printStackTrace();
        }

        return conn;
    }

We pass in our jndi names like 'jdbc/OraclePooledDS'.  In our UserManager,
we attempt to get a connection in this fashion from the getUser method.  We
get the following stack trace:
javax.naming.NamingException: Not in an application scope - start Orion
with the
 -userThreads switch if using user-created threads
        at com.evermind.server.g7.bi(JAX)
        at com.evermind.naming.j0.lookup(JAX)
        at javax.naming.InitialContext.lookup(InitialContext.java:350)
        at
com.ironmax.util.ConnectionManager.getConnection(ConnectionManager.java)
        at
com.ironmax.security.IronmaxUserManager.getUser(IronmaxUserManager.java)
        at com.evermind.server.rmi.ba.run(JAX)
        at com.evermind.util.f.run(JAX)
java.lang.NullPointerException
        at
com.ironmax.security.IronmaxUserManager.getUser(IronmaxUserManager.java)
        at com.evermind.server.rmi.ba.run(JAX)
        at com.evermind.util.f.run(JAX)

We have tried the -userThreads flag, but no luck.  If we comment out the
usermanager tags in the orion-application.xml file, everything works as
expected using a user identified in the principals.xml file.
I have seen only one posting to this news group outlining the same problem,
but there were no followups.  I have notified orion support, but have not
received any answers(or acknowledgement), and even went so far as to
forward on to Karl and Magnus directly.

   If anyone has any thoughts on this, please drop me a note.  I am running
out of things to try.

James Birchfield

Ironmax
a better way to buy, sell and rent construction equipment
5 Corporate Center
9960 Corporate Campus Drive,
Suite 2000
Louisville, KY 40223


Reply via email to