wood burning stoves 2.0*
The moose likes JBoss/WildFly and the fly likes how to set up a queueconnectionfactory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "how to set up a queueconnectionfactory" Watch "how to set up a queueconnectionfactory" New topic
Author

how to set up a queueconnectionfactory

John Gregory
Ranch Hand

Joined: Oct 05, 2006
Posts: 115
I'm trying to learn MDB's and JMS using jboss4.2.2. I have
a bean and it deploys fine. Now, I want to write a client
to test my bean. I want to create an individual
QueueConnectionFactory for my bean. I've already created
a Queue on which to send. I edited the file listed in
the link below...

Now, isthis the same file I edit to create a QueueConnectionFactory?
If not can someone point me in the right direction? I saw
this link:

http://forum.java.sun.com/thread.jspa?threadID=377058&messageID=10008325


Thanks,

John
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9955
    
163

Is this what you are looking for: Creating a new ConnectionFactory


[My Blog] [JavaRanch Journal]
John Gregory
Ranch Hand

Joined: Oct 05, 2006
Posts: 115
Jaikiran,

Yeah, it hepled, but I'm still confused, sort of.
When I created my own queue, I just copied/pasted and changed
the jndi name of the queue to suit my needs. I thought it would
be the same here. When I did copy/paste, I got an error thrown
on the server to the effect that it was trying to install an
already registered mbean. Here is what I created or tried to
create:

<mbean code="org.jboss.naming.LinkRefPairService"
name="jboss.jms:alias=QueueConnectionFactory">
<attribute name="JndiName">TestQCF</attribute>
<attribute name="RemoteJndiName">ConnectionFactory</attribute>
<attribute name="LocalJndiName">java:/JmsXA</attribute>
<depends>jboss:service=Naming</depends>
</mbean>

Is there something else I need to change here?

Thanks,

John
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9955
    
163

John,

Do you really want to create a new connection factory? JBoss already comes shipped with default connection factories which you can use. You just have to look it up using "ConnectionFactory" jndi-name. See this for an example.
John Gregory
Ranch Hand

Joined: Oct 05, 2006
Posts: 115
Jaikiran,

I've been trying to figure out how to answer this. Now, I've
finally got one. Today, I was playing around coding a client
and I got to the point where I was doing something like:

QueueConnectionFactory qcf = ic.lookup("ConnectionFactory");

I got a null pointer exception because ConnectionFactory is not
bound. In fact, when the server starts, I see the queue I created
and the jndi associated name. However, at NO point do I see anything
binding ConnectionFactory to a QueueConnectionFactory. So, how can
I use the initial context to lookup a QueueConnectionFactory.

For the record, my initialcontext is initialized with the usual
jboss environment variables.....

That's why I thought I had to create my own QueueConnectionFactory,
the same way I did my own queue.

John
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9955
    
163

Originally posted by John Gregory:

I've been trying to figure out how to answer this. Now, I've
finally got one. Today, I was playing around coding a client
and I got to the point where I was doing something like:

QueueConnectionFactory qcf = ic.lookup("ConnectionFactory");

I got a null pointer exception because ConnectionFactory is not
bound. In fact, when the server starts, I see the queue I created
and the jndi associated name. However, at NO point do I see anything
binding ConnectionFactory to a QueueConnectionFactory. So, how can
I use the initial context to lookup a QueueConnectionFactory.




Can you post the entire exception stacktrace? Where exactly is the nullpointer? I am assuming that your client is an standalone java application. If the ConnectionFactory wasn't bound then i would except a NameNotFoundException. Furthermore, you can use the JNDIView to see whether the ConnectionFactory is bound in the jndi tree. For me, i see it in the Global JNDI namespace:
John Gregory
Ranch Hand

Joined: Oct 05, 2006
Posts: 115
Jaikiran,

I played around with this some and finally got past the
QueueConnectionFactory problems I was having, to a point.

In my code, I do the following:

QueueConnectionFactory qcf =
(QueueConnectionFactory) ic.lookup("QueueConnectionFactory");

QueueConnection qConn = qcf.createQueueConnection(); (1)

When I do this, I get the following:

Exception in thread "main.lang.NoClassDefFoundError:
EDU/oswego/cs/dl/util/concurrent/ThreadFactory
org.jboss.mq.SpyConnectionFactory.internalCreateQueueConnection (line 137)
org.jboss.mq.SpyConnectionFactory.createQueueConnection (line 108)

There's a couple other lines in the stack trace, but it points ot my
main function and the line above (1). In NONE of the jboss docs I saw
using this tutorial did I see where they imported oswego anything. It's
not even mentioned.

Any ideas on what may be causing this and or how to fix it?

John
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9955
    
163

Originally posted by John Gregory:
Exception in thread "main.lang.NoClassDefFoundError:
EDU/oswego/cs/dl/util/concurrent/ThreadFactory
org.jboss.mq.SpyConnectionFactory.internalCreateQueueConnection (line 137)
org.jboss.mq.SpyConnectionFactory.createQueueConnection (line 108)



You will have to include jbossall-client.jar (which can be found in %JBOSS_HOME%\client folder) in the client's classpath.
John Gregory
Ranch Hand

Joined: Oct 05, 2006
Posts: 115
Thanks, that worked...

John
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to set up a queueconnectionfactory
 
Similar Threads
Jasper Reports - HyperLink
Java in 64 bit Linux
Struts - Error - "Cannot find ActionMappings or ActionFormBeans collection"
Need some help on struts tag library
saving canvas as an image