4 Replies Latest reply on May 6, 2002 8:14 AM by Pete Luellen

    BMP - cannot access datasource

    Pete Luellen Newbie

      OK, I know BMP is a distant second choice for persistence mechanisms. I'm creating a BMP enitity bean as part of a tutorial and seem to be having trouble getting to my MySqlDS datasource from within the bean (in order to persist the data). Here's my bean's getConnection() method:

      private Connection getConnection() throws Exception {
      try {
      Context ctx = new InitialContext();
      DataSource ds = (DataSource) ctx.lookup("java:/MySqlDS");
      return ds.getConnection();
      } catch (Exception e) {
      System.err.println("unable to get datasource: " + e.getMessage());
      throw e;

      Here's the server output when I exercise a client against the bean:

      10:34:59,914 ERROR [STDERR] java.lang.SecurityException: Invalid authentication attempt, principal=null

      Here's part of my ejb-jar.xml file:


      MySQL test database


      Here's my jboss.xml file:

      <container-configurations />
      <resource-managers />




      I believe my MySqlDS is configured properly: It has a corresponding MySqlDbRealm in the login-conf.xml file and works just fine with some CMP beans I've deployed and used. I'm running jboss-3.0.0RC1.

      What am I doing wrong? It looks to me like my bean is finding the datasource but is getting rejected for security reasons.

      Thanks for the help.