You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Javier Leyba <xl...@gmail.com> on 2006/03/22 17:15:16 UTC
jmx and jndi problem
Hi
I've two simple questions:
1 - if I've more than one broker in the same machine and enable jmx,
I receive an error related port 1099. How should I configure this port
?
Also, is possible two define a jmx server that unite all brokers to
allow administrative tasks ? I would like to start/stop brokers from a
jmx console but I noticed if enable jmx in a broker and it is stopped
I can't start it from jmx.
May be what I want is not allowed, sorry, but I never worked with jmx !! :)
2 - I'm trying to bind a topic to jndi but I received a message like this:
[code]
Caught: javax.naming.OperationNotSupportedException
javax.naming.OperationNotSupportedException
at org.apache.activemq.jndi.ReadOnlyContext.bind(ReadOnlyContext.java:312)
at javax.naming.InitialContext.bind(InitialContext.java:355)
at com.bs.proteo.notifications.transaction.HelloWorldProducer.main(HelloWorldProducer.java:37)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
[/code]
When I tried to do:
[code]
Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.activemq.jndi.ActiveMQInitialContextFactory");
props.setProperty(Context.PROVIDER_URL, "tcp://172.31.112.9:62002");
javax.naming.Context ctx = new InitialContext(props);
// Create a ConnectionFactory
ActiveMQConnectionFactory connectionFactory = new
ActiveMQConnectionFactory("failover://(tcp://172.31.112.9:62002,tcp://172.30.27.1:62003)?randomize=false");
System.out.println("Factory");
// Create a Connection
Connection connection = connectionFactory.createConnection();
connection.start();
System.out.println("Started");
// Create a Session
Session session = connection.createSession(false,
Session.AUTO_ACKNOWLEDGE);
System.out.println("created session");
// Create the destination (Topic or Queue)
Topic destination = session.createTopic("foo");
System.out.println("topic created");
ctx.bind("foo", (Topic) destination);
ctx.close();
[/code]
Is a real error or I'm missing some config setting ?
Thanks in advance
J
Re: jmx and jndi problem
Posted by James Strachan <ja...@gmail.com>.
On 3/22/06, Javier Leyba <xl...@gmail.com> wrote:
> Hi
>
> I've two simple questions:
>
>
> 1 - if I've more than one broker in the same machine and enable jmx,
> I receive an error related port 1099. How should I configure this port
> ?
See the bottom of this page for details of how to configure the remote
JMX connector..
http://activemq.org/JMX
BTW we do have an implementation of JMX-over-JMS in the Lingo project
(http://lingo.codehaus.org), which avoids the use of RMI ports for
listening to remote brokers - though we've not yet figured out a nice
way to use this when using JConsole
> Also, is possible two define a jmx server that unite all brokers to
> allow administrative tasks ?
Yes - this is what the JMX-over-JMS connector does in Lingo - allowing
you aggregate state and send group commands out etc
> I would like to start/stop brokers from a
> jmx console but I noticed if enable jmx in a broker and it is stopped
> I can't start it from jmx.
>
> May be what I want is not allowed, sorry, but I never worked with jmx !! :)
Not sure I follow - you mean the start() method is not visible in JMX?
> 2 - I'm trying to bind a topic to jndi but I received a message like this:
>
> [code]
>
> Caught: javax.naming.OperationNotSupportedException
> javax.naming.OperationNotSupportedException
> at org.apache.activemq.jndi.ReadOnlyContext.bind(ReadOnlyContext.java:312)
> at javax.naming.InitialContext.bind(InitialContext.java:355)
> at com.bs.proteo.notifications.transaction.HelloWorldProducer.main(HelloWorldProducer.java:37)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:324)
> at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
> [/code]
>
>
> When I tried to do:
The ActiveMQ JNDI provider creates a read only JNDI context that does
not allow rebinding by default. You could use another JNDI provider to
make a mutable context. Or configure the JNDI provider using
instructions here...
http://activemq.org/JNDI+Support
(see instructions on how to edit jndi.properties plus on how to use
dynamicTopic names)
--
James
-------
http://radio.weblogs.com/0112098/