2 Replies Latest reply on May 6, 2004 7:34 AM by jinu

    Problem with BMP with JBoss and MySQL

    jinu Newbie

      Hi,

      When i start the JBoss i get the following exception

      ------------------------------------------------------------------------------------
      11:10:20,390 ERROR [PersistenceManager] Starting failed
      java.lang.SecurityException: Invalid authentication attempt, principal=null
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.getSubject(BaseConnectionManager2.java:660)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:487)


      ------------------------------------------------------------------------------------




      and while accessing the home interface create method from my client i get the exception as below
      ------------------------------------------------------------------------------------
      13:11:42,734 ERROR [LogInterceptor] RuntimeException:
      java.lang.SecurityException: Invalid authentication attempt, principal=null
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.getSubject(BaseConnectionManager2.java:660)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:487)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:798)
      at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:102)
      at com.tutorial.ejb.BMPBean.makeConnection(BMPBean.java:103)

      ------------------------------------------------------------------------------------





      In my Bean class i wrote the following code for connecting to the database
      ------------------------------------------------------------------------------------
      public Connection makeConnection() throws SQLException {
      try {
      Context jndictx = new InitialContext();
      DataSource ds = (DataSource) jndictx.lookup("java:comp/env/MySqlDS");
      con = ds.getConnection();
      System.out.println("Connection got");
      return con;
      } catch (NamingException ne) {
      throw new EJBException(ne);
      }
      }
      ------------------------------------------------------------------------------------


      I modified the mysql-ds.xml as
      ------------------------------------------------------------------------------------

      <local-tx-datasource>
      <jndi-name>MySqlDS</jndi-name>
      <connection-url>jdbc:mysql://localhost/bmp</connection-url>
      <driver-class>com.mysql.jdbc.Driver</driver-class>
      <user-name>jinu</user-name>

      </local-tx-datasource>

      ------------------------------------------------------------------------------------


      accordingly i modified login-config.xml as

      ------------------------------------------------------------------------------------
      <application-policy name="MySqlDbRealm">

      <login-module code="org.jboss.resource.security.ConfiguredIdentityLoginModule" flag="required">
      <module-option name="unauthenticatedIdentity">Anonymous</module-option>
      <module-option name = "principal">jinu</module-option>
      <module-option name = "userName">jinu</module-option>
      <module-option name ="password"></module-option>
      <module-option name ="managedConnectionFactoryName">
      jboss.jca:service=LocalTxCM,name=MySqlDS
      </module-option>
      </login-module>

      </application-policy>
      ------------------------------------------------------------------------------------

      and standardjaws.xml as
      ------------------------------------------------------------------------------------

      java:/MySqlDS
      <type-mapping>mySql</type-mapping>
      false
      ..................
      ------------------------------------------------------------------------------------

      and standardjbosscmp-jdbc.xml as
      ------------------------------------------------------------------------------------
      <jbosscmp-jdbc>


      java:/MySqlDS
      <datasource-mapping>mySql</datasource-mapping>
      ........................

      ------------------------------------------------------------------------------------




      If somebody can help me out, i will be much grateful

      Thanks in advance.

        • 1. Re: Problem with BMP with JBoss and MySQL
          jinu Newbie

          some part of it didn't come properly while posting its given below

          and standardjaws.xml as
          ------------------------------------------------------------------------------------

          java:/MySqlDS
          <type-mapping>mySql</type-mapping>
          false
          ..................

          ------------------------------------------------------------------------------------

          and standardjbosscmp-jdbc.xml as
          ------------------------------------------------------------------------------------
          <jbosscmp-jdbc>


          java:/MySqlDS
          <datasource-mapping>mySql</datasource-mapping>
          ........................

          .............
          </jbosscmp-jdbc>
          ------------------------------------------------------------------------------------




          do respond

          Thanks in advance.

          • 2. Re: Problem with BMP with JBoss and MySQL
            jinu Newbie

            got it,

            You don't have to include the following in login-config.xml
            ------------------------------------------------------------------------------------
            <application-policy name="MySqlDbRealm">

            <login-module code="org.jboss.resource.security.ConfiguredIdentityLoginModule" flag="required">
            <module-option name="unauthenticatedIdentity">Anonymous</module-option>
            <module-option name = "principal">jinu</module-option>
            <module-option name = "userName">jinu</module-option>
            <module-option name ="password"></module-option>
            <module-option name ="managedConnectionFactoryName">
            jboss.jca:service=LocalTxCM,name=MySqlDS
            </module-option>
            </login-module>
            </application-policy>

            hope someonewill gain by this ("")