I'm new to jboss too so forgive if I ask stuff you already tried.
Have you created a xxxx-ds.xml file in your deploy directory that binds to this jndi name?
Yes I tried that too - although I called it -ds.xml (as I didn't know to give it a prefix) and this only caused errors since it said the name was not bound to JNDI - which only served to confuse me more?
What exactly should go in the xxx-ds.xml file (assuming that xxx means any name I give to it) - are there any reference docs for this? Sorry to be asking probably very simple questions - but I have no previous experience with JBOss. The annoying thing is that I got my code running in SunApp server immediately as they have a UI for configuring ConnectionFactory etc.
Well thanking you in advance....
My file looked something like this (I since deleted it as it wasn't working!)
<config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
<config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
I got this from another posting on the forums you see.. but have no real idea of what should go in it?
Forget the -ds.xml, that is not what you are trying to achieve at all.
In your web application in the web.xml you have specified a resource reference, the error is saying that you need a jboss-web.xml deployment descriptor to be packaged in your war that also contains a resource-ref with the JBoss specific settings.
The jboss-web.xml should be something similar to: -
<!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.4//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd"> <jboss-web> <resource-ref> <res-ref-name>jms/QueueFactory</res-ref-name> <jndi-name>ConnectionFactory</jndi-name> </resource-ref> </jboss-web>
Oh ok - in my jboss-web.xml I alread have this - is it wrong?
Will 'borrow' your version and have a looksee.... thankyou!
The jndi-name element should contain the jndi name of the item you are linking to not the jndi name you want it to be bound to.
In this case the connection factory is bound to JNDI as ConnectionFactory so that is the name to enter in the jndi-name element.
From the jboss-web.dtd: -
<!ELEMENT resource-ref (res-ref-name , (jndi-name | res-url))>
For your example the resource ref element should just contain a res-ref-name element and a jndi-name element.
Thanks for that - am trying it out right now. Will post to let you know how it goes. However - how do you know that it is being bound to jndi using the name 'ConnectionFactory' and not an-other name??
A brill - this is what it says:
ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
However I get a cast exception trying to cast that to a ConnectionFactory for some weird reason - I think there are duplicate classes for Connectionfactory on the classpath .. am checking it out right now!
Thanks again! Have a beer for me tomorrow on POETS day!
OK - firstly may I thank those that helped (particularly darranl!) it is all working thank fek!
In essence the NameNotFoundException was entirely a result of me asking for the wrong name from JNDI - so thanks for the reference to the MBean stuff. The second problem was the ClassCastException and that was due to more than one jar on my classpath containing an implementation of the QueueConnectionFactory class and both were loaded by the app server. I got around that one by altering the ant script to specifically include only the files I knew I needed and discarding all others at build time.
No idea what has happened - I posted to say thankyou but the post has dissapeared - lets hope I didn't do it on the wrong subject??!
Anyway - thankyou - all sorted now. Yes there was more than one implementation of the QueueConnectionFactory on my classpath - once rmeoved it all worked out fine!
Thanks for your help - really appreciate it!