5 Replies Latest reply on Apr 8, 2005 1:52 PM by asdsad asdas

    ConnectionFactory not bound...

    jjman Newbie

      I have a weird problem: I have Jboss 4.0.1 running in win xp and linux. I have made similar changes to configuration files that allows me to use mysql database.

      In windows, JMS ConnectionFactory is bound but not in Linux. I have tried everything but nothing seems to work. Everething is going ok in windows.

      Context context = new InitialContext();

      TopicConnectionFactory topicFactory =
      (TopicConnectionFactory)context.lookup("ConnectionFactory");

      error:

      javax.naming.NameNotFoundException: ConnectionFactory not bound
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)
      at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)
      at org.jnp.server.NamingServer.getObject(NamingServer.java:505)
      at org.jnp.server.NamingServer.lookup(NamingServer.java:278)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:544)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:520)
      ...

      This lookup fails in linux. I have also tried to place env to context but that either doesen't work.

      env.put(InitialContext.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      env.put(InitialContext.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      envi.put(InitialContext.PROVIDER_URL, "jnp://127.0.0.1:1099");

      Context context = new InitialContext(env);

      I don't know if different operating systems have anything do with this problem but it's worth of mentioning...I have checked all the FAQs and Wikis but I haven't find a solution...

        • 1. Re: ConnectionFactory not bound...
          jjman Newbie

          Continue:

          I checked JNDIview from jmx-console:

          In windows, it looks like this:

          +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
          +- DefaultDS (class: javax.sql.DataSource)
          +- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)
          +- DefaultJMSProvider (class: org.jboss.jms.jndi.JNDIProviderAdapter)
          +- MySqlDS (class: javax.sql.DataSource)
          +- comp (class: javax.naming.Context)
          +- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
          +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
          +- jaas (class: javax.naming.Context)
          | +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext)
          | +- jbossmq (class: org.jboss.security.plugins.SecurityDomainContext)
          | +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext)
          +- timedCacheFactory (class: javax.naming.Context)
          Failed to lookup: timedCacheFactory, errmsg=null
          +- TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory)
          +- StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory)
          +- Mail (class: javax.mail.Session)
          +- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter)
          +- TransactionManager (class: org.jboss.tm.TxManager)


          Global JNDI Namespace

          +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
          +- UIL2ConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
          +- UserTransactionSessionFactory (proxy: $Proxy11 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory,interface org.jboss.proxy.IClientContainer)
          +- HTTPConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
          +- console (class: org.jnp.interfaces.NamingContext)
          | +- PluginManager (proxy: $Proxy36 implements interface org.jboss.console.manager.PluginManagerMBean)
          +- UIL2XAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
          +- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory)
          +- HTTPXAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
          +- topic (class: org.jnp.interfaces.NamingContext)
          | +- testDurableTopic (class: org.jboss.mq.SpyTopic)
          | +- IPXTopic (class: org.jboss.mq.SpyTopic)
          | +- securedTopic (class: org.jboss.mq.SpyTopic)
          +- queue (class: org.jnp.interfaces.NamingContext)
          | +- A (class: org.jboss.mq.SpyQueue)
          | +- testQueue (class: org.jboss.mq.SpyQueue)
          | +- ex (class: org.jboss.mq.SpyQueue)
          | +- DLQ (class: org.jboss.mq.SpyQueue)
          | +- D (class: org.jboss.mq.SpyQueue)
          | +- C (class: org.jboss.mq.SpyQueue)
          | +- B (class: org.jboss.mq.SpyQueue)
          +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
          +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
          +- jmx (class: org.jnp.interfaces.NamingContext)
          | +- invoker (class: org.jnp.interfaces.NamingContext)
          | | +- RMIAdaptor (proxy: $Proxy35 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt,interface org.jboss.proxy.IClientContainer)
          | +- rmi (class: org.jnp.interfaces.NamingContext)
          | | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
          +- HiLoKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory)
          +- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
          +- UILConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)

          And in Linux:

          java: Namespace

          +- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)
          +- DefaultJMSProvider (class: org.jboss.jms.jndi.JNDIProviderAdapter)
          +- MySqlDS (class: javax.sql.DataSource)
          +- comp (class: javax.naming.Context)
          +- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
          +- jaas (class: javax.naming.Context)
          | +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext)
          +- timedCacheFactory (class: javax.naming.Context)
          Failed to lookup: timedCacheFactory, errmsg=null
          +- TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory)
          +- StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory)
          +- Mail (class: javax.mail.Session)
          +- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter)
          +- TransactionManager (class: org.jboss.tm.TxManager)


          Global JNDI Namespace

          +- UIL2ConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
          +- UserTransactionSessionFactory (proxy: $Proxy11 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory,interface org.jboss.proxy.IClientContainer)
          +- console (class: org.jnp.interfaces.NamingContext)
          | +- PluginManager (proxy: $Proxy36 implements interface org.jboss.console.manager.PluginManagerMBean)
          +- UIL2XAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
          +- UUIDKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.uuid.UUIDKeyGeneratorFactory)
          +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
          +- jmx (class: org.jnp.interfaces.NamingContext)
          | +- invoker (class: org.jnp.interfaces.NamingContext)
          | | +- RMIAdaptor (proxy: $Proxy35 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt,interface org.jboss.proxy.IClientContainer)
          | +- rmi (class: org.jnp.interfaces.NamingContext)
          | | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
          +- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
          +- UILConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)



          Why these are different? I have made similar changes to both. Should thre be a ConnectionFactory in java:Namespace? That seems to be in windows but not in linux. Is this a problem?

          • 2. Re: ConnectionFactory not bound...
            Elias Ross Master


            What do your logs say on start up? Probably on Linux it failed to connect to your DB.

            • 3. Re: ConnectionFactory not bound...
              jjman Newbie

              10:02:01,438 INFO [WrapperDataSourceService] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:name=MySqlDS,service=DataSourceBinding to JNDI name 'java:MySqlDS'

              Does this mean that connection to data source is ok? When I look at the server.log, there isn't any errors or warnings.

              I have modified these files to get mysql working:

              mysql-ds.xml:


              <local-tx-datasource>
              <jndi-name>MySqlDS</jndi-name>
              <connection-url>jdbc:mysql://localhost:3306/mydb</connection-url>
              <driver-class>org.gjt.mm.mysql.Driver</driver-class>
              <user-name>root</user-name>

              <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
              <!-- sql to call when connection is created
              <new-connection-sql>some arbitrary sql</new-connection-sql>
              -->
              <!-- sql to call on an existing pooled connection when it is obtained from pool
              <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
              -->

              <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->

              <type-mapping>mySQL</type-mapping>

              </local-tx-datasource>




              standardjaws.xml:

              java:/MySqlDS
              <type-mapping>mySQL</type-mapping>
              true


              standardjbosscmp-jdbc.xml:

              java:/MySqlDS
              <datasource-mapping>mySQL</datasource-mapping>



              login-config.xml:

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

              <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule"
              flag = "required">
              <module-option name = "unauthenticatedIdentity">root</module-option>
              <module-option name = "dsJndiName">java:/MySqlDS</module-option>
              <module-option name = "principalsQuery">SELECT PASSWD FROM JMS_USERS WHERE USERID=?</module-option>
              <module-option name = "rolesQuery">SELECT ROLEID, 'Roles' FROM JMS_ROLES WHERE USERID=?</module-option>
              </login-module>

              </application-policy>


              <application-policy name = "MySqlDbRealm">

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

              </application-policy>

              • 4. Re: ConnectionFactory not bound...
                jjman Newbie

                Got it working!

                It was all about database.

                • 5. Re: ConnectionFactory not bound...
                  asdsad asdas Newbie

                  How did you fix it?

                  I'm having the same problem