-
1. Re: "Failed to create session factory" from client connecting to jboss-as7 hornetq
ataylor Oct 17, 2012 4:08 AM (in response to lucapaone)first thing ive noticed is you are looking up the wrong jndi name for the connection factory, it should be 'java:jboss/exported/jms/RemoteConnectionFactory'. I would start by looking at one of the javaee examples in HornetQ master or one of the AS7 quick starts
-
2. Re: "Failed to create session factory" from client connecting to jboss-as7 hornetq
lucapaone Oct 17, 2012 8:44 AM (in response to ataylor)I tried but now the app stops even the line before in
ConnectionFactory cf = (ConnectionFactory) initialContext.lookup("java:jboss/exported/jms/RemoteConnectionFactory");
What is the reason?
-
3. Re: "Failed to create session factory" from client connecting to jboss-as7 hornetq
ataylor Oct 18, 2012 4:59 AM (in response to lucapaone)Have you tried any of the examples or quickstarts?
-
4. Re: "Failed to create session factory" from client connecting to jboss-as7 hornetq
jbertram Oct 18, 2012 9:45 AM (in response to lucapaone)Actually, you should be using "jms/RemoteConnectionFactory" just like the JMS quick-start. Based on the log on the server it looks to me like the JNDI lookup is succeeding. However, the fact that you're getting "Cannot connect to server(s). Tried with all available servers." tells me that perhaps your HornetQ connector is not configured correctly. Are you binding AS7 to 0.0.0.0?
-
5. Re: "Failed to create session factory" from client connecting to jboss-as7 hornetq
lucapaone Oct 19, 2012 7:55 AM (in response to jbertram)No way , i tried all the suggested names.
I solved using instead of the JMS lookup
ConnectionFactory cf = (ConnectionFactory)initialContext.lookup(connectionfactory);
the netty classes:
Properties env = new Properties();
// env.put(Context.INITIAL_CONTEXT_FACTORY,
env.put(Context.INITIAL_CONTEXT_FACTORY, org.jboss.naming.remote.client.InitialContextFactory.class.getName());
env.put(Context.PROVIDER_URL, jndi_provider_url);
env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
initialContext = new InitialContext(env);
HashMap map = new HashMap();
map.put("host", netty_url);
map.put("port", 5445);
TransportConfiguration transportConfiguration = new TransportConfiguration("org.hornetq.core.remoting.impl.netty.NettyConnectorFactory", map);
ConnectionFactory connectionFactory = (ConnectionFactory) HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.TOPIC_CF, transportConfiguration);
connection = connectionFactory.createConnection();
AND ALL worked
-
6. Re: "Failed to create session factory" from client connecting to jboss-as7 hornetq
jbertram Oct 19, 2012 9:14 AM (in response to lucapaone)This makes me think even more that the HornetQ connector(s) in your AS7 instance are not configured correctly. You see, when you do a JNDI look-up for a connection factory you download a connector which is basically just a simple stub which hold a bit of information (e.g. the host and port of the server) which the client then uses to connect to the server. If the connector isn't configured correctly on the server then even if the JNDI lookup succeeds when the client downloads the connector it will have problems connecting to the server (e.g. it will receive "Cannot connect to server(s). Tried with all available servers.").
If you're ok with just instantiating the connection factory via HornetQJMSClient.createConnectionFactoryWithoutHA() then you can remove all the code dealing with the InitialContext.
-
7. Re: "Failed to create session factory" from client connecting to jboss-as7 hornetq
lucapaone Oct 19, 2012 10:46 AM (in response to jbertram)I tried to remove the initialcontext stuff but the code fails! It seems it is needed for some reasons....
In the first message I attached the jboss configuration (standalone-full.xml) we are using on the remote host. Could you try to see if therte is something wrong in the Hornetq configuration?
-
8. Re: "Failed to create session factory" from client connecting to jboss-as7 hornetq
jbertram Oct 19, 2012 10:57 AM (in response to lucapaone)I tried to remove the initialcontext stuff but the code fails! It seems it is needed for some reasons....
My guess is that you're still using JNDI to lookup the JMS destination.
In the first message I attached the jboss configuration (standalone-full.xml) we are using on the remote host. Could you try to see if therte is something wrong in the Hornetq configuration?
I looked at the standalone-full.xml you attached and I see a potential problem:
<interface name="public">
<inet-address value="${jboss.bind.address:0.0.0.0}"/>
</interface>
If you are not explicitly setting the "jboss.bind.address" when the server boots (either via -Djboss.bind.address or -b) then it will bind to 0.0.0.0. I asked about this earlier and you said, "No way , i tried all the suggested names," although I'm not sure what you meant by that. If AS7 is binding to 0.0.0.0 then you will have problems as outlined in HORNETQ-952.
-
9. Re: "Failed to create session factory" from client connecting to jboss-as7 hornetq
lucapaone Oct 19, 2012 11:11 AM (in response to jbertram)I think this is the problem!
Thank you so much!
(I was saying I tried all the jms/ConnectionFactort .. REmoteConnectionFActory ... etc)