3 Replies Latest reply on May 13, 2004 5:18 AM by Darran Lofthouse

    JNDI NameNotFoundException problem

    trendkill Newbie

      I am having trouble with bindings...im getting pretty exasperated here...

      I have a database in mysql that is called phemr. it has only one entity called party (im keeping it simple here).

      I believe there is some binding getting done as i get the following message:

      11:13:31,650 INFO [phemr] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=LocalTxCM,name=phemr to JNDI name 'java:/phemr'

      However later in the log i get:

      org.jboss.deployment.DeploymentException: Error: can't find data source: phemr; - nested throwable: (javax.naming.NameNotFoundException: phemr not bound)

      at org.jboss.ejb.plugins.cmp.jdbc.bridge.JDBCEntityBridge.init(JDBCEntityBridge.java:143)

      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.initStoreManager(JDBCStoreManager.java:420)
      etc...

      Im using JBoss 3.2.3 with mysql 4.0.18.

      I would really appreciate some help here. I'm submitting everything i think is related to the problem, let me know if you need to see something else.

      Thanks for any help you can give me.

      Here are my deployment descriptors:

      ejb-jar.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
      <ejb-jar>
      <display-name>EJBModule1</display-name>
      <enterprise-beans>

      <display-name>Party</display-name>
      <ejb-name>Party</ejb-name>
      <local-home>test2.PartyHome</local-home>
      test2.Party
      <ejb-class>test2.PartyBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.Long</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Party</abstract-schema-name>
      <cmp-field>
      <field-name>partyID</field-name>
      </cmp-field>
      <primkey-field>partyID</primkey-field>

      </enterprise-beans>
      <assembly-descriptor>
      <container-transaction>

      <ejb-name>Party</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      </assembly-descriptor>
      </ejb-jar>

      jboss.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">

      <enterprise-beans>

      <ejb-name>Party</ejb-name>
      <local-jndi-name>Party</local-jndi-name>

      </enterprise-beans>


      jbosscmp-jdbc:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jbosscmp-jdbc PUBLIC "-//JBoss//DTD JBOSSCMP-JDBC 3.2//EN" "http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_2.dtd">
      <jbosscmp-jdbc>

      phemr
      <datasource-mapping>mySQL</datasource-mapping>

      <enterprise-beans>

      <ejb-name>Party</ejb-name>
      <table-name>party</table-name>
      <cmp-field>
      <field-name>partyID</field-name>
      <column-name>Party_ID</column-name>
      </cmp-field>

      </enterprise-beans>
      </jbosscmp-jdbc>

      mysql-ds.xml:


      <local-tx-datasource>
      <jndi-name>phemr</jndi-name>
      <connection-url>jdbc:mysql://localhost:3306/phemr</connection-url>
      <driver-class>com.mysql.jdbc.Driver</driver-class>
      <user-name>martin</user-name>
      doris
      </local-tx-datasource>



      login-config.xml:

      <application-policy name="security-domain-name">

      <login-module code="login.module1.class.name" flag="control_flag">
      <module-option name = "option1-name">option1-value</module-option>
      <module-option name = "option2-name">option2-value</module-option>
      ...
      </login-module>

      <login-module code="login.module2.class.name" flag="control_flag">
      ...
      </login-module>
      ...

      </application-policy>

      $Revision: 1.6.2.2 $
      -->


      <!-- Used by clients within the application server VM such as
      mbeans and servlets that access EJBs.
      -->
      <application-policy name = "client-login">

      <login-module code = "org.jboss.security.ClientLoginModule"
      flag = "required">
      </login-module>

      </application-policy>

      <!-- Security domain for JBossMQ -->
      <application-policy name = "jbossmq">

      <login-module code = "org.jboss.mq.sm.file.DynamicLoginModule"
      flag = "required">
      <module-option name = "unauthenticatedIdentity">guest</module-option>
      <module-option name = "sm.objectname">jboss.mq:service=StateManager</module-option>
      </login-module>

      </application-policy>


      <!-- Security domains for testing new jca framework -->
      <application-policy name = "HsqlDbRealm">

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

      </application-policy>

      <application-policy name = "FirebirdDBRealm">

      <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule"
      flag = "required">
      <module-option name = "principal">sysdba</module-option>
      <module-option name = "userName">sysdba</module-option>
      <module-option name = "password">masterkey</module-option>
      <module-option name = "managedConnectionFactoryName">jboss.jca:service=XaTxCM,name=FirebirdDS</module-option>
      </login-module>

      </application-policy>

      <application-policy name = "JmsXARealm">

      <login-module code = "org.jboss.resource.security.ConfiguredIdentityLoginModule"
      flag = "required">
      <module-option name = "principal">guest</module-option>
      <module-option name = "userName">guest</module-option>
      <module-option name = "password">guest</module-option>
      <module-option name = "managedConnectionFactoryName">jboss.jca:service=TxCM,name=JmsXA</module-option>
      </login-module>

      </application-policy>

      <!-- A template configuration for the jmx-console web application. This
      defaults to the UsersRolesLoginModule the same as other and should be
      changed to a stronger authentication mechanism as required.
      -->
      <application-policy name = "jmx-console">

      <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
      flag = "required" />

      </application-policy>

      <!-- A template configuration for the web-console web application. This
      defaults to the UsersRolesLoginModule the same as other and should be
      changed to a stronger authentication mechanism as required.
      -->
      <application-policy name = "web-console">

      <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule"
      flag = "required" />

      </application-policy>

      <!-- The default login configuration used by any security domain that
      does not have a application-policy entry with a matching name
      -->
      <application-policy name = "other">
      <!-- A simple server login module, which can be used when the number
      of users is relatively small. It uses two properties files:
      users.properties, which holds users (key) and their password (value).
      roles.properties, which holds users (key) and a comma-separated list of
      their roles (value).
      The unauthenticatedIdentity property defines the name of the principal
      that will be used when a null username and password are presented as is
      the case for an unuathenticated web client or MDB. If you want to
      allow such users to be authenticated add the property, e.g.,
      unauthenticatedIdentity="nobody"
      -->

      <login-module code = "org.jboss.security.auth.spi.UsersRolesLoginModule"
      flag = "required" />

      </application-policy>

      <application-policy name = "MySqlDbRealm">

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

      </application-policy>