1 Reply Latest reply on May 12, 2004 6:07 PM by Adrian Brock

    Binding issues with env-entry 3.2.3 JBoss

    Jerrold Eads Newbie

      JBoss 3.2.3
      Windows 2000 Server

      After deploying a session bean I get a javax.naming.NameNotFoundException: jdbc not bound error?
      It is when I call:
      // Look up the ENC, and find the entry requested
      Context ctx = (Context)new InitialContext().lookup("java:comp/env");
      value = ctx.lookup(name);
      where name = jdbc/MetaDataDS

      or when I call:
      // Look up the ENC, and find the entry requested
      Context ctx = (Context)new InitialContext().lookup("java:comp/env");
      value = (String)ctx.lookup(name);
      where name = SecurityDAODataSourceName

      I use the value out of the last call to feed the name of the first call, but I have tried either
      way. I have copied the JMX Console - JNDI section of the session bean, the ejb-jar.xml, the
      jboss.xml and the error below.

      Can anyone suggest anything I am doing wrong?


      ejb-jar.xml

      < enterprise-beans>
      < session>
      < display-name>SecurityController</display-name >
      < ejb-name>SecurityController</ejb-name >
      < home>com.genecodes.security.securitycontroller.SecurityControllerRemoteHome
      < remote>com.genecodes.security.securitycontroller.SecurityControllerRemote
      < local-home>com.genecodes.security.securitycontroller.SecurityControllerHome</local-home >
      < local>com.genecodes.security.securitycontroller.SecurityController
      < ejb-class>com.genecodes.security.securitycontroller.SecurityControllerBean</ejb-class >
      < session-type>Stateless</session-type >
      < transaction-type>Container</transaction-type >
      < ejb-local-ref>
      < description>Password entity bean reference
      < ejb-ref-name>ejb/MSSQLServer2000MetaData_Password</ejb-ref-name >
      < ejb-ref-type>Entity</ejb-ref-type >
      < local-home>com.genecodes.mssqlserver2000metadata.password.PasswordHome</local-home >
      < local>com.genecodes.mssqlserver2000metadata.password.Password
      < ejb-link>MSSQLServer2000MetaData_Password</ejb-link >
      </ejb-local-ref >
      < env-entry>
      < description>The name of the data source used by the SecurityDAO.
      < env-entry-name>SecurityDAODataSourceName</env-entry-name >
      < env-entry-type>java.lang.String</env-entry-type >
      < env-entry-value>jdbc/MetaDataDS</env-entry-value >
      </env-entry >
      < resource-ref>
      < description>Data source referenced inside the session bean
      < res-ref-name>jdbc/MetaDataDS</res-ref-name >
      < res-type>javax.sql.DataSource</res-type >
      < res-auth>Container</res-auth >
      </resource-ref >
      < env-entry>
      < description>The getUserRoles SQL query used by the SecurityDAO.
      < env-entry-name>getUserRoles(String)</env-entry-name >
      < env-entry-type>java.lang.String</env-entry-type >
      < env-entry-value>SELECT Role FROM User_Role WHERE UserID = ? ORDER BY Role</env-entry-value >
      </env-entry >
      < env-entry>
      < description>The logActivity SQL INSERT statement used by the SecurityDAO.
      < env-entry-name>logActivity(userId, event, application, dataStore, additionalInfo)</env-entry-name >
      < env-entry-type>java.lang.String</env-entry-type >
      < env-entry-value>INSERT INTO ActivityLog VALUES(?,?,?,?,?,?,?,?,?,?)</env-entry-value >
      </env-entry >

      </enterprise-beans >


      JBoss.xml

      < enterprise-beans>
      < session>
      < ejb-name>SecurityController</ejb-name >
      < jndi-name>SecurityController</jndi-name >
      < local-jndi-name>SecurityController</local-jndi-name >
      < ejb-local-ref>
      < ejb-ref-name>ejb/MSSQLServer2000MetaData_Password</ejb-ref-name >
      < jndi-name>MSSQLServer2000MetaData_Password</jndi-name >
      </ejb-local-ref >
      < resource-ref>
      < res-ref-name>jdbc/MetaDataDS</res-ref-name >
      < jndi-name>java:/MSSQLServer2000MetaData</jndi-name >
      </resource-ref >

      </enterprise-beans >


      Error in Server.log:

      2004-05-12 17:26:36,031 ERROR [com.synapps.j2eeutility.jndi.JndiUtilities] Couldn't find the JNDI object named: jdbc/MetaDataDS
      javax.naming.NameNotFoundException: jdbc not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:495)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:503)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:509)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:253)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:256)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:528)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
      at com.synapps.j2eeutility.jndi.JndiUtilities.lookupEnvironmentObject(JndiUtilities.java:54)
      at com.synapps.utilities.db.DBUtilities.getDataSource(DBUtilities.java:62)

      JMXConsole JNDI output:

      java:comp namespace of the SecurityController bean:
      +- env (class: org.jnp.interfaces.NamingContext)
      | +- getUserRoles(String) (class: java.lang.String)
      | +- jdbc (class: org.jnp.interfaces.NamingContext)
      | | +- MetaDataDS[link -> java:/MSSQLServer2000MetaData] (class: javax.naming.LinkRef)
      | +- ejb (class: org.jnp.interfaces.NamingContext)
      | | +- MSSQLServer2000MetaData_Password[link -> null] (class: javax.naming.LinkRef)
      | +- security (class: org.jnp.interfaces.NamingContext)
      | | +- subject[link -> java:/jaas/MSSQLServer2000MetaDataSecurityRealm/subject] (class: javax.naming.LinkRef)
      | | +- security-domain[link -> java:/jaas/MSSQLServer2000MetaDataSecurityRealm] (class: javax.naming.LinkRef)
      | +- logActivity(userId, event, application, dataStore, additionalInfo) (class: java.lang.String)
      | +- SecurityDAODataSourceName (class: java.lang.String)