Announcement Announcement Module
Collapse
No announcement yet.
jms connection factory lookup troubles... Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • jms connection factory lookup troubles...

    Hi all,

    I have been trying today to lookup the JMS connection factory on my local JBOSS server to use it from the JMS template via Spring...

    Not much luck so far basically it says connection factory not bound, so it seems it cannot find it...

    I tried following some posts on this forum to set the properties of the environement in the applicationContext.xml as follows to resolve this problem:

    <bean id="connectionFactory" class="org.springframework.jndi.JndiObjectFactoryB ean">
    <property name="jndiName"><value>java:/ConnectionFactory</value></property>
    <property name="environment">
    <props>
    <prop key="java.naming.factory.initial">org.jnp.interfac es.NamingContextFactory</prop>
    <prop key="java.naming.provider.url">jnp://localhost:1099</prop>
    <prop key="java.naming.factory.url.pkgs">org.jboss.namin g:org.jnp.interfaces</prop>
    </props>
    </property>
    <property name="resourceRef"><value>true</value></property>
    </bean>

    As per one of the posts in this forum, but then it throws an exception stating environment property cannot be written to ??

    This is a stand allone java application so not much use using web.xml to pass in jndi references etc..

    Hopefully somebody will have some suggestions or examples on how to get a stand allone java appliation to talk JMS trough to JBOSS MQ

    THanks and sincere greetings,
    Leo de Blaauw

  • #2
    Re: jms connection factory lookup troubles...

    Originally posted by lblaauw
    <property name="environment">
    <props>
    <prop key="java.naming.factory.initial">org.jnp.interfac es.NamingContextFactory</prop>
    <prop key="java.naming.provider.url">jnp://localhost:1099</prop>
    <prop key="java.naming.factory.url.pkgs">org.jboss.namin g:org.jnp.interfaces</prop>
    </props>
    </property>
    Ah well,

    It seems like the property environment is changed to jndiEnvironment in my version 1.1.1 of Spring....

    Still says ConnectionFactory not bound....

    Any ideas suggestions welcome !

    Sincere greetings,
    Leo de Blaauw

    Comment


    • #3
      hmm

      Well learning along the way here so i figured i just post my findings....

      Seems resourceref must be set to false, if not it will automatically add:
      java:/comp/env to your JNDI lookup via Spring.

      As i said learning along the way. Next problem:

      java.lang.NoSuchMethodError: javax.jms.ConnectionFactory.createConnection()Ljav ax/jms/Connection;

      I will post any findings or any help still appreciated lol

      Greetings,
      Leo de Blaauw

      Comment


      • #4
        Well,

        After changing to JNDITemplate102( yes i know i should have read it !) it all works like a dream !!

        Thanks guys for this great framework !!

        Sincere greetings,
        Leo de Blaauw

        Comment


        • #5
          Re: jms connection factory lookup troubles...

          Originally posted by lblaauw
          Originally posted by lblaauw
          <property name="environment">
          <props>
          <prop key="java.naming.factory.initial">org.jnp.interfac es.NamingContextFactory</prop>
          <prop key="java.naming.provider.url">jnp://localhost:1099</prop>
          <prop key="java.naming.factory.url.pkgs">org.jboss.namin g:org.jnp.interfaces</prop>
          </props>
          </property>
          Ah well,

          It seems like the property environment is changed to jndiEnvironment in my version 1.1.1 of Spring....

          Still says ConnectionFactory not bound....

          Any ideas suggestions welcome !

          Sincere greetings,
          Leo de Blaauw
          Hmm thats too bad the above jndiEnvironment settings dont seem to get picked up by the client appliation. It seems i still need a jndi.properties in the classpath ??

          Any suggestions on how to get these props into the spring applicationContext ?

          Greetz
          Leo de Blaauw

          Comment


          • #6
            Well,

            I got rid of jndi.properties in the claspath. Only thing now is that i have
            to define:

            <property name="jndiEnvironment">
            <props>
            <prop key="java.naming.factory.initial">org.jnp.interfac es.NamingContextFactory</prop>
            <prop key="java.naming.provider.url">jnp://localhost:1099</prop>
            <prop key="java.naming.factory.url.pkgs">org.jboss.namin g:org.jnp.interfaces</prop>
            </props>
            </property>

            For both my connectionFactory and the queue on the lookup hmmm

            Wouldnt there be a better global way to instantiate these environment properties so that both JndiObjectFactoryBeans could pick them up ?

            Wel let me know, but it seems activity on this forum on JMS is pretty low unfortunately. When i do figur it out i will post my solution in this thread

            Greetz
            Leo de Blaauw

            Comment


            • #7
              You seem to be doing a pretty good job of figuring things out!

              You can define the environment once. Define a org.springframework.jndi.JndiTemplate then pass that to the jndiTemplate property of each of your JndiObjectFactoryBean instances.

              When running in an app server, you can also avoid specifying any of the server's jndi properties at all. You'll need to define your JNDI resource in web.xml and jboss-web.xml. You can then leave resourceRref set to true and Spring will look it up from the container's environment. See this thread for examples: http://forum.springframework.org/showthread.php?t=10207

              Tim
              Last edited by robyn; May 14th, 2006, 06:05 PM.

              Comment


              • #8
                Originally posted by timmorrow
                You seem to be doing a pretty good job of figuring things out!

                You can define the environment once. Define a org.springframework.jndi.JndiTemplate then pass that to the jndiTemplate property of each of your JndiObjectFactoryBean instances.

                When running in an app server, you can also avoid specifying any of the server's jndi properties at all. You'll need to define your JNDI resource in web.xml and jboss-web.xml. You can then leave resourceRref set to true and Spring will look it up from the container's environment. See this thread for examples: http://forum.springframework.org/showthread.php?t=10207

                Tim
                Tim,

                Thanks, getting there. Thing is i want to be able to run my junit tests outside of the jboss server just as inside. So inside is not much of a problem but outside is. Usually what i have done so far is a different applicationContext.xml for the unit tests...

                hmm i tried to put a JndiTemplate in my applicationContext file and to set its property called jndiEnvironment with the same props definition i used earlier... but it says in and exception cannot write property jndiEnvironment

                Weird.. oh well i will keep on tryin lol

                Greetrz
                Leo

                Greetz
                Leo
                Last edited by robyn; May 14th, 2006, 06:06 PM.

                Comment


                • #9
                  Well

                  It works !!! Offcourse the property on the JNDITemplate is environment !!!
                  and not jndiEnvironment anymore ;-)

                  Works like a charm, thanks for putting me in the right direction here Tim
                  appreciated

                  Greetz
                  Leo

                  Comment


                  • #10
                    hmm,

                    The next challenge, our should i say thing to figur out, will be to create a message converter for the JMSTemplate using castor....

                    I will keep you updated here.

                    Greetz
                    Leo de Blaauw

                    Comment


                    • #11
                      Originally posted by lblaauw
                      hmm,

                      The next challenge, our should i say thing to figur out, will be to create a message converter for the JMSTemplate using castor....

                      I will keep you updated here.

                      Greetz
                      Leo de Blaauw

                      Ok, done castor is now used to serialize our objects onto JMS queues using the JMSTemplate with a Castor converter, tomorrow i will do the read from the message queue convert stuff

                      Let me know if i need to post how

                      Greetz
                      Leo de Blaauw

                      Comment


                      • #12
                        JDNITemplaet102????

                        Originally posted by lblaauw
                        Well,

                        After changing to JNDITemplate102( yes i know i should have read it !) it all works like a dream !!

                        Thanks guys for this great framework !!

                        Sincere greetings,
                        Leo de Blaauw

                        Hey Leo

                        Im having the same problem as you and your saying that using JNDITemplate102 solved it but I cant find it! Has it been replaced or is there some otherway I can connect to JBoss MQ?

                        Appriciate your help,thx

                        Maghnus

                        Comment

                        Working...
                        X