3 Replies Latest reply on May 24, 2002 4:03 AM by ionel

    username and password not used by ManagedConnectionFactoryPr

    ionel Newbie

      Hi,

      I've just switch from JBoss3.0.0beta to JBoss3.0RC3 (binary including tomcat available from Sourceforge)

      I've used the demo mysql-service.xml file to match my needs.
      the file deploys well.

      the problem appends when i try to deploy the EJB.


      16:11:47,922 INFO [MainDeployer] Starting deployment of package: file:/users/vol1/gardais/app-serv/jboss-3.0.0RC3_tomcat-4.0.3/server/default/deploy/facade-jms-fakelike.jar
      16:11:48,824 INFO [EjbModule] Creating
      16:11:48,934 INFO [EjbModule] Deploying personneBean
      16:11:48,988 INFO [EjbModule] Deploying organismeBean
      16:11:49,076 INFO [EjbModule] Deploying calendrierBean
      16:11:50,359 INFO [EjbModule] Remove JSR-77 EJB Module: jboss.management.single:J2EEApplication= ,J2EEServer=Single,j2eeType=EJBModule,name=facade-jms-fakelike.jar
      16:11:50,363 ERROR [EjbModule] Initialization failed
      org.jboss.deployment.DeploymentException: Error while fixing table name; - nested throwable: (java.sql.SQLException: ResourceException javax.resource.ResourceException: Could not create connection)
      at org.jboss.ejb.plugins.cmp.jdbc.SQLUtil.fixTableName(SQLUtil.java:67)
      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.(JDBCEntityBridge.java:103)
      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.create(JDBCStoreManager.java:333)
      at org.jboss.ejb.plugins.CMPPersistenceManager.create(CMPPersistenceManager.java:155)
      at org.jboss.ejb.EntityContainer.create(EntityContainer.java:337)
      at org.jboss.ejb.Container.invoke(Container.java:789)
      at org.jboss.ejb.EntityContainer.invoke(EntityContainer.java:1055)


      the "could not create connection" may appears because the database needs a user/pass auth.

      here is the service file I use :


      <?xml version="1.0" encoding="UTF-8"?>

      <!-- ===================================================================== -->
      <!-- -->
      <!-- JBoss Server Configuration -->
      <!-- -->
      <!-- ===================================================================== -->



      <!-- ==================================================================== -->
      <!-- New ConnectionManager setup for mysql using 2.0.11 driver -->
      <!-- Build jmx-api (build/build.sh all) and view for config documentation -->
      <!-- ==================================================================== -->




      <!-- Include a login module configuration named MySqlDbRealm.
      Update your login-conf.xml, here is an example for a
      ConfiguredIdentityLoginModule:

      <application-policy name = "MySqlDbRealm">

      <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
      <module-option name = "principal">yourprincipal</module-option>
      <module-option name = "userName">yourusername</module-option>
      <module-option name = "password">yourpassword</module-option>
      <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=BaseTestDS</module-option>
      </login-module>

      </application-policy>

      NOTE: the application-policy name attribute must match SecurityDomainJndiName, and the
      module-option name = "managedConnectionFactoryName"
      must match the object name of the ConnectionManager you are configuring here.
      -->
      <!--comment out this line if you want component managed security or want
      to use the default values in the ManagedConnectionFactoryProperties -->
      <!-- MySqlDbRealm -->

      <depends optional-attribute-name="ManagedConnectionFactoryName">
      <!--embedded mbean-->


      BaseTestDS



      <config-property name="ConnectionURL" type="java.lang.String">jdbc:mysql://localhost:3306/BaseTest</config-property>
      <config-property name="DriverClass" type="java.lang.String">org.gjt.mm.mysql.Driver</config-property>
      <!--set these only if you want only default logins, not through JAAS
      <config-property name="UserName" type="java.lang.String"></config-property>
      <config-property name="Password" type="java.lang.String"></config-property>
      -->




      <!--Below here are advanced properties -->
      <!--hack-->
      <depends optional-attribute-name="OldRarDeployment">jboss.jca:service=RARDeployment,name=JBoss LocalTransaction JDBC Wrapper




      <depends optional-attribute-name="ManagedConnectionPool">
      <!--embedded mbean-->


      0
      50
      5000
      15
      <!--criteria indicates if Subject (from security domain) or app supplied
      parameters (such as from getConnection(user, pw)) are used to distinguish
      connections in the pool. Choices are
      ByContainerAndApplication (use both),
      ByContainer (use Subject),
      ByApplication (use app supplied params only),
      ByNothing (all connections are equivalent, usually if adapter supports
      reauthentication)-->
      ByNothing



      <depends optional-attribute-name="CachedConnectionManager">jboss.jca:service=CachedConnectionManager

      <depends optional-attribute-name="JaasSecurityManagerService">jboss.security:name=JaasSecurityManager

      java:/TransactionManager
      <!--make the rar deploy! hack till better deployment-->
      jboss.jca:service=RARDeployer







      I have try all possibilities :
      - use the UserName and Password fields / no URL info added => failed
      - no use of the UserName and Password fields / URL info used =>
      - use of both UserName and Password fields and URL info => failed


      (URL info are ?username=dummy&pass=dummy at the end of the URL)

      i also tried with only the username in the URL and the pass in the Password field, only the password in the URL and the user in the UserName field, only the pass in the URL and no info anywhere ...

      well,
      i think i do my best,

      any help will be welcome,
      thanks,
      ionel

        • 1. Re: username and password not used by ManagedConnectionFacto
          Pete Luellen Newbie

          I'm not trying to be a wise guy but... did you copy the block

          <application-policy name = "MySqlDbRealm">
          <authentication>
          <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
          <module-option name = "principal">yourprincipal</module-option>
          <module-option name = "userName">yourusername</module-option>
          <module-option name = "password">yourpassword</module-option>
          <module-option name = "managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=BaseTestDS&l t;/module-option>
          </login-module>
          </authentication>
          </application-policy>
          to your JBOSS_DIST\server\default\conf\login-config.xml file? And update userName and password?

          Hope this helps.

          • 2. Re: username and password not used by ManagedConnectionFacto
            ionel Newbie

            as this block is commented, is it needed to copy it to the login-config.xml file ?

            BTW, how to use the "criteria" field to performe authentification AND authorization (I saw I can do a declarative authorization in the ejb-jar file but how do the role-name are retrieve for a special user/pass ?)

            Actually, any help/tutorial about JAAS or similar system is welcome (and if anybody know if it is possible to use the mySQL grant tables, i'll be the happiest man ;oP )


            thanks,
            ionel

            • 3. Re: username and password not used by ManagedConnectionFacto
              ionel Newbie

              I AM A DUMB !

              things works back again.
              i just forgot to uncomment some lines.

              sorry for making you loosing your time,
              ionel