jruby/jndi/ConnectionFactoryAdapter - and casting

Looking at docs online for the ConnectionFactoryAdapter class, it
doesn’t appear that it or any of its superclasses implements the
setProperty method you’re looking for, nor does QueueConnectionFactory
or ConnectionFactory. Are you sure you’re looking for the right method
in the right place?

On Wed, May 12, 2010 at 6:48 PM, Robert W. [email protected]
wrote:

reasons other than it not being there. The lack of a cast is not the
Thanks again for the reply.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On May 12, 2010, at 12:20 PM, Charles Oliver N. wrote:

@conn_factory = @ctx.lookup(“jms/ExtQueueConnectionFactory”)

Set the flow to this listener to 1 - equiv to activemq.prefetchSize

@conn_factory.setProperty(ConnectionConfiguration.imqConsumerFlowLimit, “1”)

^^^  Error occurs here. Method not found.

Please provide the exact error. A method can be “not found” for
reasons other than it not being there. The lack of a cast is not the
problem, I guarantee it.

Ahh - I found it:

undefined method `setProperty' for 

#Java::ComSunMessagingJmsRa::ConnectionFactoryAdapter:0x4f124609
(NoMethodError)

This was from the lines above.

I am now getting a ‘Java::ComSunMessagingJmsRa::DirectConnectionFactory’
back from the call and there is a ‘setConfigurationProperty’ on that -
but not sure (still experimenting) that it is setting the limit for me
correctly.

Thanks again for the reply.


Robert B. Weeks


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

ConnectionFactoryAdapter does not itself have setProperty.
http://www.docjar.com/html/api/com/sun/messaging/jms/ra/ConnectionFactoryAdapter.java.html

ConnectionFactoryAdapter extends ConnectionCreator, which does not
have setProperty:
http://www.docjar.com/docs/api/com/sun/messaging/jms/ra/ConnectionCreator.html

ConnectionCreator itself is an abstract class that extends Object and
implements no interfaces that would provide setProperty:
http://www.docjar.com/html/api/com/sun/messaging/jms/ra/ConnectionCreator.java.html

Since neither of these two classes provides setProperty, the rest of
the interfaces don’t matter…but I’ll indulge you. :slight_smile:

ConnectionFactoryAdapter  extends ConnectionCreator
  implements javax.jms.ConnectionFactory,
             javax.jms.QueueConnectionFactory,
             javax.jms.TopicConnectionFactory,
             javax.resource.Referenceable,
             java.io.Serializable

Going down the list of implemented interfaces…

javax.jms.ConnectionFactory does not have setProperty and does not
extend any interfaces:
http://www.docjar.com/docs/api/javax/jms/ConnectionFactory.html

javax.jms.QueueConnectionFactory does not have setProperty and only
extends ConnectionFactory:
http://www.docjar.com/docs/api/javax/jms/QueueConnectionFactory.html

javax.jms.TopicConnectionFactory does not have setProperty and only
extends ConnectionFactory:
http://www.docjar.com/docs/api/javax/jms/TopicConnectionFactory.html

javax.resource.Referenceable does not have setProperty and only
extends javax.naming.Referenceable:
http://www.docjar.com/docs/api/javax/resource/Referenceable.html

javax.naming.Referenceable does not provide setProperty and does not
extend any interfaces:
http://www.docjar.com/docs/api/javax/naming/Referenceable.html

and of course java.io.Serializable has no methods at all.

I think you’re getting the com.sun.messaging classes confused with the
javax.jms classes. No com.sun.messaging classes are referenced by,
implemented by, or extended by
com.sun.messaging.jms.ra.ConnectionFactoryAdapter.

On Wed, May 12, 2010 at 11:18 PM, Robert W. [email protected]
wrote:

the method is in:
             javax.jms.QueueConnectionFactory,

Subject: Re: [jruby-user] jruby/jndi/ConnectionFactoryAdapter - and casting

  @conn_factory = @ctx.lookup(“jms/ExtQueueConnectionFactory”)
Ahh - I found it:

  http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hello -

I think you’re getting the com.sun.messaging classes confused with the
javax.jms classes. No com.sun.messaging classes are referenced by,
implemented by, or extended by
com.sun.messaging.jms.ra.ConnectionFactoryAdapter.

Thanks for the reply and looking into it - but no - I am not getting
any of these confused - I do this quite a bit in java only land and this
is the way it works - I created a util that will allow me to do this so
I don’t need to work it out further this way - but that being said -
this is not working the way I am told it should via jruby.

The ‘setProperty’ is a part of the AdministeredObject - which since they
are both is-a of the javax.jms.*Factory (since they both implement it -
the Adapter implementing most of the factories itself) - they are able
to be cast correctly.

Thanks again for your time.


Robert B. Weeks

To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Hi Charles -

Here are the links below - this is part of the imq suite - OpenMQ - the
implementation within Glassfish (using 3 and 3.0.1 builds).

Java::ComSunMessagingJmsRa::ConnectionFactoryAdapter:
http://www.docjar.com/html/api/com/sun/messaging/jms/ra/ConnectionFactoryAdapter.java.html

http://www.docjar.com/docs/api/com/sun/messaging/ConnectionFactory.html
http://www.docjar.com/docs/api/com/sun/messaging/QueueConnectionFactory.html

the method is in:

http://www.docjar.com/docs/api/com/sun/messaging/QueueConnectionFactory.html

It is part of the AdministeredObject:

http://www.docjar.com/docs/api/com/sun/messaging/AdministeredObject.html#setProperty(String,%20String)

ConnectionFactoryAdapter extends ConnectionCreator
implements javax.jms.ConnectionFactory,
javax.jms.QueueConnectionFactory,
javax.jms.TopicConnectionFactory,
javax.resource.Referenceable,
java.io.Serializable

QueueConnectionFactory extends com.sun.messaging.ConnectionFactory
implements javax.jms.QueueConnectionFactory

I do this on a java counterpart already - this is why I became curious
on this - since I couldn’t create the jruby counterpart the same way.

Thanks a lot for looking. I had been banging my head on a wall trying to
figure this one out. :slight_smile:


Robert B. Weeks


From: Charles Oliver N. [[email protected]]
Sent: Wednesday, May 12, 2010 6:23 PM
To: [email protected]
Subject: Re: [jruby-user] jruby/jndi/ConnectionFactoryAdapter - and
casting

Looking at docs online for the ConnectionFactoryAdapter class, it
doesn’t appear that it or any of its superclasses implements the
setProperty method you’re looking for, nor does QueueConnectionFactory
or ConnectionFactory. Are you sure you’re looking for the right method
in the right place?

On Wed, May 12, 2010 at 6:48 PM, Robert W. [email protected]
wrote:

reasons other than it not being there. The lack of a cast is not the
problem, I guarantee it.

Ahh - I found it:

undefined method `setProperty’ for #Java::ComSunMessagingJmsRa::ConnectionFactoryAdapter:0x4f124609 (NoMethodError)

This was from the lines above.

I am now getting a ‘Java::ComSunMessagingJmsRa::DirectConnectionFactory’ back from the call and there is a ‘setConfigurationProperty’ on that - but not sure (still experimenting) that it is setting the limit for me correctly.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

According to the javadoc you linked,
com.sun.messaging.jms.ra.ConnectionFactoryAdapter has no relation with
AdministeredObject. Perhaps you are actually getting back a subclass?

I’d like to figure this out, since if that method exists on the object
it should just be available without casting. The fact that it isn’t
means one of two things:

  • It doesn’t actually exist on the object
  • There’s a bug in JRuby preventing it from being exposed

Can you show the output of printing obj.class? I don’t see how the
method you want could possibly be available to Java, much less
available to Ruby, if the object is of the class you say it is…

On Fri, May 14, 2010 at 4:37 PM, Robert W. [email protected]
wrote:


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email