1
votes

I have an application that works on a standalone domain but fails in the cluster setup.

In my application I have a JCA Resource Adapter that needs to send a message over a JMS Message on a specific situation in the EIS, so in the Connection Implementation after the event I call getJMSConnectionFactory.

private Object lookup(String what) {
    try {
        // needs no environment
        Context jndiContext = new InitialContext();
        return jndiContext.lookup(what);
    } catch (NamingException ex) {
        throw MyProjectException.getInstance("lookup of " + what + " failed.", ex);
    }
}

public ConnectionFactory getJMSConnectionFactory() throws JMSException {
    return (ConnectionFactory)lookup("java:comp/DefaultJMSConnectionFactory");
}

I also lookup the Destination that way and send the JMS message afterwards. Now that works as expected when I deploy to a single domain, but when I try to do that in a clustered setup, I get this exception (relevant details below):

javax.ejb.EJBException
Caused by: myclasspath.MyProjectException: sayHelloyOverJMS
Caused by: myclasspath.MyProjectException: lookup of java:comp/DefaultJMSConnectionFactory failed.
Caused by: javax.naming.NamingException: Lookup failed for 'java:comp/DefaultJMSConnectionFactory' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: Lookup failed for 'jms/__defaultConnectionFactory' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: Unable to lookup resource : jms/__defaultConnectionFactory [Root exception is com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Lookup failed for '__SYSTEM/pools/jms/__defaultConnectionFactory-Connection-Pool' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}]]]
Caused by: javax.naming.NamingException: Lookup failed for 'jms/__defaultConnectionFactory' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NamingException: Unable to lookup resource : jms/__defaultConnectionFactory [Root exception is com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Lookup failed for '__SYSTEM/pools/jms/__defaultConnectionFactory-Connection-Pool' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}]]
Caused by: javax.naming.NamingException: Unable to lookup resource : jms/__defaultConnectionFactory [Root exception is com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Lookup failed for '__SYSTEM/pools/jms/__defaultConnectionFactory-Connection-Pool' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}]
Caused by: com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Lookup failed for '__SYSTEM/pools/jms/__defaultConnectionFactory-Connection-Pool' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
Caused by: javax.naming.NamingException: Lookup failed for '__SYSTEM/pools/jms/__defaultConnectionFactory-Connection-Pool' in SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NameNotFoundException: jms]
Caused by: javax.naming.NameNotFoundException: jms

I think the relevant details are:

Lookup failed for '__SYSTEM/pools/jms/__defaultConnectionFactory-Connection-Pool'.

That seems to find '__SYSTEM/pools' but then not 'jms'. I did look into the GUI of Glassfish to the configuration of the connection pool jms/__defaultConnectionFactory-Connection-Pool, but I did not find any information about 'targets' there, so I assume it should be available in the whole domain, including clusters. The Resources Tab of the cluster configuration does not list the connection pool (or any other '__SYSTEM' entries for that matter).

When I ask glassfish what JNDI Resources are available:

$ asadmin list-jms-resources cluster_name
jms/DataFlowClusterCommunicationTopic
jms/__defaultConnectionFactory
Command list-jms-resources executed successfully.

$ asadmin list-jms-resources domain-1-instance
remote failure: The list-jms-resources command is not allowed on target domain-1-instance because it is part of cluster cluster_name
Command list-jms-resources failed.

$ asadmin list-jms-resources domain
jms/DataFlowClusterCommunicationTopic
jms/__defaultConnectionFactory
Command list-jms-resources executed successfully.

So, as far as I understood it, the jms/__defaultConnectionFactory name is present, and should be found in the clustered setup as much as the domain setup.

Environment:

  • AS: GlassFish Server Open Source Edition 4.1.1 (build 1)
  • Java:

    • openjdk version "1.8.0_111"
    • OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-2-b14)
    • OpenJDK 64-Bit Server VM (build 25.111-b14, mixed mode)
  • OS: Linux fuchs-linux-pc 4.7.0-1-amd64 #1 SMP Debian 4.7.8-1 (2016-10-19) x86_64 GNU/Linux

  • Build with maven 3
1
Have you done any progress on this issue ?, i'm having the same oneJavier Toja
@karelss Unfortunately not and by now I don't have the issue myself anymore (am not on the project anymore). We had the opportunity to switch to a different AS and did so. There it worked, but that vague feeling of problems waiting to happen stayed.Angelo Fuchs
@karelss If you upvote this question it gets pushed up in the frontpage. If you instead choose to ask a new question please leave a link so one can eventually be closed as duplicate.Angelo Fuchs
After doing a little research i found a few bugs reported on glassfish jira related to this issue, like java.net/jira/browse/GLASSFISH-21656 or java.net/jira/browse/GLASSFISH-21655, i'm going to wait to check if this problem is fixed on versión 5.0.Javier Toja
@karelss Both issues are already closed. Did you try a version 4.1.2 already?Angelo Fuchs

1 Answers

1
votes

I found this post because I suffer the same issue with glassfish version 4.0 and 4.1.1 when i tried to move my project from standalone setup into a cluster setup.

After doing a few test I was able to discover a few issues accepted by glassfish team related with jms systems only in cluster mode as far as I was able to test, changing from Embedded openmq setup to remote or local one FIX the issue, and the system works well in cluster.

This behaviour makes me think that the issue is related with the JNDI Tree with Embedded openMQ setup