-
1. Re: HAILConnectionFactory Problem
ivelin.ivanov Dec 17, 2003 6:30 PM (in response to mkprim)Can you post the snippet of code where you obtain the JNDI context and the connection factory?
Are you connecting from a machine in the cluster or a remote client?
Ivelin -
2. Re: HAILConnectionFactory Problem
mkprim Dec 18, 2003 9:44 AM (in response to mkprim)Here is the code where I obtain the JNDI Context:
In a class named "Connector"
qc = serviceLocator.getQueueConnectionFactory("HAILConnectionFactory").createQueueConnection(username, password);
qc.start();
In the ServiceLocator Class:
public QueueConnectionFactory getQueueConnectionFactory(String qConnFactoryName)
throws ServiceLocatorException {
QueueConnectionFactory factory = null;
try {
factory = (QueueConnectionFactory) ic.lookup(qConnFactoryName);
} catch (NamingException ne) {
throw new ServiceLocatorException(ne);
} catch (Exception e) {
throw new ServiceLocatorException(e);
}
return factory;
}
The context is already initialized when i call this method.
I'm connecting to the server from a Swing client, running in the same machine that one node of the cluster is running. Is there any problem with that?
If I replace the "HAILConnectionFactory" with "UIL2ConnectionFactory" works perfectly.
Ivelin, thanks for your reply, I promess i won't bother you again by mail.
Thanks a lot,
Marcelo -
3. Re: HAILConnectionFactory Problem
jkharness87 Dec 19, 2003 7:26 AM (in response to mkprim)I'm reposting my experience with the same problem (originally posted on the development board since I thought it said to post any new problems there). I feel like I got a bit further, but not too much farther with it:
I tried accessing the HA JMS from a client that was not in the cluster (through a jndi lookup as Adrian suggested). I haven't had much luck, though. I'm not sure if it is my own fault or simply that this is so new (Ivelin indicated that he wasn't so confident that the non-clustered client would work with this).
Nonetheless, here is a summary of my exceptions and my attempts to fix them:
At first I got the following:
javax.naming.NamingException: Invalid reference. Error: org.jboss.mq.il.ha.HAILServerIL (no security manager: RMI class loader disabled)
at org.jboss.mq.referenceable.ObjectRefAddr.extractObjectRefFrom(ObjectRefAddr.java:82)
at org.jboss.mq.referenceable.SpyConnectionFactoryObjectFactory.getObjectInstance(SpyConnectionFactoryObjectFactory.java:48)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:620)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at HATest.connect(HATest.java:54)
at HATest.main(HATest.java:20)
java.lang.NullPointerException
at HATest.connect(HATest.java:55)
at HATest.main(HATest.java:20)
So, I added the jbossmq-hail.jar to my classpath. Then I got the following:
java.lang.NoClassDefFoundError: javax/management/NotificationListener
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:219)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:154)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:631)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:257)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:200)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1513)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
at org.jboss.mq.referenceable.ObjectRefAddr.extractObjectRefFrom(ObjectRefAddr.java:80)
at org.jboss.mq.referenceable.SpyConnectionFactoryObjectFactory.getObjectInstance(SpyConnectionFactoryObjectFactory.java:48)
at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:301)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:620)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at HATest.connect(HATest.java:54)
at HATest.main(HATest.java:20)
java.lang.NullPointerException
at HATest.connect(HATest.java:55)
at HATest.main(HATest.java:20)
I wasn't real sure why, but it seemed lke it wanted the jmx stuff. So, I added the jboss-jmx.jar to my classpath. I then got the following:
org.jboss.mq.SpyJMSException: Cannot authenticate user; - nested throwable: (java.lang.IllegalStateException: No 'jboss' MBeanServer found!)
at org.jboss.mq.Connection.authenticate(Connection.java:883)
at org.jboss.mq.Connection.(Connection.java:238)
at org.jboss.mq.Connection.(Connection.java:315)
at org.jboss.mq.SpyConnection.(SpyConnection.java:60)
at org.jboss.mq.SpyConnectionFactory.createQueueConnection(SpyConnectionFactory.java:116)
at HATest.connect(HATest.java:55)
at HATest.main(HATest.java:20)
Caused by: java.lang.IllegalStateException: No 'jboss' MBeanServer found!
at org.jboss.mx.util.MBeanServerLocator.locateJBoss(MBeanServerLocator.java:46)
at org.jboss.mq.il.ha.HAILServerIL.createConnection(HAILServerIL.java:102)
at org.jboss.mq.il.uil2.UILServerIL.getSocketMgr(UILServerIL.java:500)
at org.jboss.mq.il.uil2.UILServerIL.authenticate(UILServerIL.java:302)
at org.jboss.mq.Connection.authenticate(Connection.java:876)
... 6 more
Looks like I'm going to have to cluster a session bean that can then utilize the HA JMS since it'll be a part of the cluster (and have the client talk to the clustered session bean). I was under the impression that it should work just like looking up "ConnectionFactory" from jndi without any new classes being in my path (of course I'm looking up "HAILConnectionFactory" here). I could just be acting like an idiot, though. Any ideas? This stuff is so new and I haven't seen any real comments from people on the message boards.
Josh -
4. Re: HAILConnectionFactory Problem
ivelin.ivanov Dec 19, 2003 7:37 PM (in response to mkprim)Let me look into this a bit further.
In the meanwhile, I suggest you run and study the HA JMS examples.
In deploy/jms/jbossmq-hail.sar/META-INF/jboss-service.xml uncomment the example MBean - jboss.mq.examples:service=HAJMSClient.
The source code for the examples can be found here
http://cvs.sourceforge.net/viewcvs.py/jboss/jbossmx/src/examples/org/jboss/mq/il/ha/examples/
Ivelin -
5. Re: HAILConnectionFactory Problem
ivelin.ivanov Dec 19, 2003 10:38 PM (in response to mkprim)Let me make sure that I understand the problems.
In Marcelo's case the client code is on a cluster node. Is this correct?
In Josh' case, this is not true. The client executes on a node which is not in the cluster.
Marcelo, let me know if the example code works for you and it gave you a hint how to fix your problem.
Josh, I think that I know what the problem is in your case. I cannot promise a quick fix. There is a considerable amount of effort that will go into unifying the remoting layers in JBoss. The remote HA JMS client requires that the stub keeps track of the live cluster nodes as well as the current singleton. These two are not implemented together currently. Certainly in the plan.
What is your use case? How remote is the remote client? Can you join it to to the cluster as a WAN node (over TCP/IP)?
Ivelin -
6. Re: HAILConnectionFactory Problem
mkprim Dec 22, 2003 10:23 AM (in response to mkprim)"ivelin" wrote:
In Marcelo's case the client code is on a cluster node. Is this correct?
Sorry Ibelin, I'm not sure if I understand the "cluster node client" term.
I mean, actually my client is running in a diferent VM than the server, and it tries to connect through JMS to the JBoss server. It's just a Swing client, currently in my local machine.
But in the future, it is planed to be deployed wherever (and i really mean wherever).
I don't know if this helps.
Thanks a lot,
Marcelo. -
7. Re: HAILConnectionFactory Problem
mkprim Dec 22, 2003 10:32 AM (in response to mkprim)A few extra notes that might help:
1. I connect through the QCFactory providing a username and password.
2. There's a moment that I try to make a temporary connection (the ones that last only for the current connection).
Thanks,
Marcelo -
8. Re: HAILConnectionFactory Problem
mkprim Dec 26, 2003 9:12 AM (in response to mkprim)anyone has a clue for solving this problem?
-
9. Re: HAILConnectionFactory Problem
jkharness87 Dec 29, 2003 12:18 PM (in response to mkprim)Sorry for the delay in responding...Iwas out of town last week.
Ivelin and Marcelo,
Thanks for looking into this. I suspected that I was using it properly and that it was just an implementation issue on the HAJMS side of things (with this being the first real HAJMS implentation). I've solved the problem for now by having a stateless session been be a proxy for the HAJMS stuff. My client looks up the stateless session bean (which is clustered). It then passes the information to the statless bean that it wants to send in a message. The stateless bean then constructs the JMS message and sends it to the clustered message queue. It works for me. I can kill the jboss instance that the singleton queue is on and the secondary takes over (and the client also still finds the stateless proxy bean since it too is clustered). Marcelo, you may want to try a solution like this for now. All in all, it's pretty cool stuff.
Many Thanks,
Josh -
10. Re: HAILConnectionFactory Problem
mkprim Dec 29, 2003 4:10 PM (in response to mkprim)Josh, thanks for your help and time.
I actually cannot solve the problem the way you did, because I will not use any RMI (which is needed to use the Stateless Session Bean) for client-server connections. I can just use JMS as the base connection.
Is there any way to implement a JMS queue between a client-server, being distributed and with fail-over capabilities? Can the current version manage this kind of connections?
Thanks Josh and Ivelin. -
11. Re: HAILConnectionFactory Problem
jkharness87 Dec 30, 2003 7:56 AM (in response to mkprim)
"Is there any way to implement a JMS queue between a client-server, being distributed and with fail-over capabilities?"
The way I understand the current HA JMS is that it is a singleton implementation. Thus, you get the fail over capability but not the distributed capability (Ivelin correct me if I'm wrong here). So even in my case where I've clustered session beans that are sending the messages, all messages are sent to exactly one node in the cluster. If I kill the JBoss node running the master MQ, though, a new Master MQ node is elected. Thus, all new messages shall go to that node. -
12. Re: HAILConnectionFactory Problem
mkprim Jan 5, 2004 8:05 AM (in response to mkprim)Ok, so I understand that in the near future, I won't be able to connect an external client to the JBoss servers via JMS, with distributed failover capabilities.
Maybe I'll just have to code it.
Thanks.